Update data.lua

This commit is contained in:
2023-04-18 02:27:56 +09:00
parent d53cf773f5
commit f319fb82d5

View File

@@ -4,6 +4,7 @@ local graphics_location = '__PHI-EQ__/graphics/'
local items = {
['solar-panel'] = {
enabled = true,
type = 'solar-panel',
name = 'solar-panel',
tech = 'solar-panel-equipment',
min = 2,
@@ -13,6 +14,7 @@ local items = {
},
['fusion-reactor'] = {
enabled = true,
type = 'fusion-reactor',
name = 'fusion-reactor',
tech = 'fusion-reactor-equipment',
min = 2,
@@ -20,17 +22,9 @@ local items = {
base = 750,
graphics_source = nil
},
['personal-laser-defense'] = {
enabled = true,
name = 'personal-laser-defense',
tech = 'personal-laser-defense-equipment',
min = 2,
max = 8,
base = 3,
graphics_source = nil
},
['battery'] = {
enabled = true,
type = 'battery',
name = 'battery',
tech = 'battery-mk2-equipment',
min = 3,
@@ -40,6 +34,7 @@ local items = {
},
['personal-laser-defense'] = {
enabled = true,
type = 'personal-laser-defense',
name = 'personal-laser-defense',
tech = 'personal-laser-defense-equipment',
min = 2,
@@ -49,6 +44,7 @@ local items = {
},
['energy-shield'] = {
enabled = true,
type = 'energy-shield',
name = 'energy-shield',
tech = 'energy-shield-mk2-equipment',
min = 3,
@@ -58,6 +54,7 @@ local items = {
},
['personal-roboport'] = {
enabled = true,
type = 'personal-roboport',
name = 'personal-roboport',
tech = 'personal-roboport-mk2-equipment',
min = 3,
@@ -67,6 +64,7 @@ local items = {
},
['night-vision'] = {
enabled = true,
type = 'night-vision',
name = 'night-vision',
tech = 'night-vision-equipment',
min = 2,
@@ -76,6 +74,7 @@ local items = {
},
['exoskeleton'] = {
enabled = true,
type = 'exoskeleton',
name = 'exoskeleton',
tech = 'exoskeleton-equipment',
min = 2,
@@ -157,48 +156,48 @@ else
end
-- equipment
local function EE(source, tier, base, graphics_source)
local function EE(source, tier)
local item = {}
item['name'] = source .. '-mk' .. tier .. '-equipment'
item['name'] = source.name .. '-mk' .. tier .. '-equipment'
item['categories'] = {'armor'}
local w = 1
local h = 1
if (source == 'solar-panel') then
if (source.type == 'solar-panel') then
item['type'] = 'solar-panel-equipment'
item['power'] = (base * (2 ^ (tier - 1))) .. 'kW'
item['power'] = (source.base * (2 ^ (tier - 1))) .. 'kW'
item['energy_source'] = {type = 'electric', usage_priority = 'primary-output'}
elseif (source == 'battery') then
elseif (source.type == 'battery') then
h = 2
item['type'] = 'battery-equipment'
item['energy_source'] = {type = 'electric', usage_priority = 'tertiary', buffer_capacity= (base * (2 ^ (tier - 2))) .. 'MJ'}
elseif (source == 'fusion-reactor') then
elseif (source.type == 'fusion-reactor') then
w = 4
h = 4
item['type'] = 'generator-equipment'
item['power'] = (base * (2 ^ (tier - 1))) .. 'kW'
item['power'] = (source.base * (2 ^ (tier - 1))) .. 'kW'
item['energy_source'] = {type = 'electric', usage_priority = 'primary-output'}
elseif (source == 'personal-laser-defense') then
elseif (source.type == 'personal-laser-defense') then
w = 2
h = 2
item['type'] = 'active-defense-equipment'
item['energy_source'] = {type = 'electric', usage_priority = 'secondary-input', buffer_capacity = (250 * (2 ^ (tier - 1))) .. 'kJ'}
-- item['source_direction_count'] = 64
-- item['source_offset'] = {0, -3.423489 / 4}
item['attack_parameters'] = {type = 'beam', cooldown = 60, range = (18 + tier), damage_modifier = (base * (2 ^ (tier - 1))), ammo_type = {category = 'laser', energy_consumption = (50 * (2 ^ (tier - 1))) .. 'kJ', action = {type = 'direct', action_delivery = {type = 'beam', beam = 'laser-beam', max_length = (18 + tier), duration = 60, source_offset = {0, -1.31439}}}}}
item['attack_parameters'] = {type = 'beam', cooldown = 60, range = (18 + tier), damage_modifier = (source.base * (2 ^ (tier - 1))), ammo_type = {category = 'laser', energy_consumption = (50 * (2 ^ (tier - 1))) .. 'kJ', action = {type = 'direct', action_delivery = {type = 'beam', beam = 'laser-beam', max_length = (18 + tier), duration = 60, source_offset = {0, -1.31439}}}}}
item['automatic'] = true
elseif (source == 'energy-shield') then
elseif (source.type == 'energy-shield') then
w = 2
h = 2
item['type'] = 'energy-shield-equipment'
item['energy_source'] = {type = 'electric', usage_priority = 'primary-input', input_flow_limit = (1000 * (2 ^ (tier - 1))) .. 'kW', buffer_capacity = (480 * (2 ^ (tier - 1))) .. 'kJ'}
item['max_shield_value'] = (base * (2 ^ (tier - 2)))
item['max_shield_value'] = (source.base * (2 ^ (tier - 2)))
item['energy_per_shield'] = '80kJ'
elseif (source == 'personal-roboport') then
elseif (source.type == 'personal-roboport') then
w = 2
h = 2
item['type'] = 'roboport-equipment'
item['energy_source'] = {type = 'electric', usage_priority = 'secondary-input', buffer_capacity = (base * 32 * (2 ^ (tier - 1))) .. 'MJ'}
item['energy_source'] = {type = 'electric', usage_priority = 'secondary-input', buffer_capacity = (source.base * 32 * (2 ^ (tier - 1))) .. 'MJ'}
item['robot_limit'] = 50
item['construction_radius'] = 32
item['spawn_and_station_height'] = 0.4
@@ -210,10 +209,10 @@ local function EE(source, tier, base, graphics_source)
item['stationing_offset'] = {0, -0.6}
item['charging_station_shift'] = {0, 0.5}
item['charging_station_count'] = 16
item['charging_energy'] = (base * (2 ^ (tier - 2))) .. 'MW'
item['charging_energy'] = (source.base * (2 ^ (tier - 2))) .. 'MW'
item['charging_distance'] = 1.6
item['charging_threshold_distance'] = 5
elseif (source == 'night-vision') then
elseif (source.type == 'night-vision') then
w = 2
h = 2
item['type'] = 'night-vision-equipment'
@@ -221,23 +220,23 @@ local function EE(source, tier, base, graphics_source)
item['energy_input'] = '20kW'
item['activate_sound'] = {filename = '__base__/sound/nightvision-on.ogg', volume = 0.5}
item['deactivate_sound'] = {filename = '__base__/sound/nightvision-off.ogg', volume = 0.5}
item['darkness_to_turn_on'] = base
item['darkness_to_turn_on'] = source.base
item['color_lookup'] = {{0, '__core__/graphics/color_luts/lut-sunset.png'}}
elseif (source == 'exoskeleton') then
elseif (source.type == 'exoskeleton') then
w = 2
h = 4
item['type'] = 'movement-bonus-equipment'
item['energy_source'] = {type = 'electric', usage_priority = 'secondary-input', buffer_capacity = '10MJ'}
item['energy_consumption'] = '400kW'
item['movement_bonus'] = base
item['movement_bonus'] = source.base
end
item['shape'] = {width = w, height = h, type = 'full'}
if graphics_source == nil then
if source.graphics_source == nil then
item['sprite'] = {filename = graphics_location .. source .. '-equipment-e.png', width = w * 32, height = h * 32, priority = 'medium', hr_version = {filename = graphics_location .. source .. '-equipment-eh.png', width = w * 64, height = h *64, priority = 'medium', scale = 0.5}}
else
item['sprite'] = {filename = graphics_source, width = w * 32, height = h * 32, priority = 'medium', hr_version = {filename = graphics_location .. source .. '-equipment-eh.png', width = w * 64, height = h *64, priority = 'medium', scale = 0.5}}
item['sprite'] = {filename = source.graphics_source, width = w * 32, height = h * 32, priority = 'medium'}
end
data:extend({item})
@@ -245,30 +244,30 @@ end
-- item
local function EI(source, tier)
local item = table.deepcopy(data.raw.item[source .. '-equipment'])
item.name = source .. '-mk' .. tier .. '-equipment'
item.placed_as_equipment_result = source .. '-mk' .. tier .. '-equipment'
local item = table.deepcopy(data.raw.item[source.name .. '-equipment'])
item.name = source.name .. '-mk' .. tier .. '-equipment'
item.placed_as_equipment_result = source.name .. '-mk' .. tier .. '-equipment'
item.subgroup = 'equipment'
item.stack_size = 20
item.default_request_amount = 5
item.icons = {{icon = graphics_location .. source .. '-equipment-i.png', icon_mipmaps = 4, icon_size = 64}}
item.icons = {{icon = graphics_location .. source.name .. '-equipment-i.png', icon_mipmaps = 4, icon_size = 64}}
if (source == 'solar-panel') then
item.order = 'a[energy-source]-a' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
elseif (source == 'battery') then
item.order = 'b[battery]-b' .. alpha_order[tier] .. '[' .. source .. 'equipment-mk' .. tier .. ']'
elseif (source == 'fusion-reactor') then
item.order = 'a[energy-source]-b' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
elseif (source == 'personal-laser-defense') then
item.order = 'd[active-defense]-b' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
elseif (source == 'energy-shield') then
item.order = 'b[shield]-c' .. alpha_order[tier - 1] .. '[' .. source .. '-equipment-mk' .. tier .. ']'
elseif (source == 'personal-roboport') then
item.order = 'e[robotics]-b' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. '-equipment]'
elseif (source == 'night-vision') then
item.order = 'f[night-vision]-a' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
elseif (source == 'exoskeleton') then
item.order = 'd[exoskeleton]-a' .. alpha_order[tier - 1] .. '[' .. source .. 'equipment-mk' .. tier .. ']'
if (source.type == 'solar-panel') then
item.order = 'a[energy-source]-a' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']'
elseif (source.type == 'battery') then
item.order = 'b[battery]-b' .. alpha_order[tier] .. '[' .. source.name .. 'equipment-mk' .. tier .. ']'
elseif (source.type == 'fusion-reactor') then
item.order = 'a[energy-source]-b' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']'
elseif (source.type == 'personal-laser-defense') then
item.order = 'd[active-defense]-b' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']'
elseif (source.type == 'energy-shield') then
item.order = 'b[shield]-c' .. alpha_order[tier - 1] .. '[' .. source.name .. '-equipment-mk' .. tier .. ']'
elseif (source.type == 'personal-roboport') then
item.order = 'e[robotics]-b' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. '-equipment]'
elseif (source.type == 'night-vision') then
item.order = 'f[night-vision]-a' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']'
elseif (source.type == 'exoskeleton') then
item.order = 'd[exoskeleton]-a' .. alpha_order[tier - 1] .. '[' .. source.name .. 'equipment-mk' .. tier .. ']'
end
data:extend({item})
@@ -276,36 +275,36 @@ end
-- recipe
local function ER(source, tier)
na = source
na = source.name
if (tier == 2) then
na = source .. '-equipment'
na = source.name .. '-equipment'
elseif (tier >= 3) then
na = source .. '-mk' .. (tier - 1) .. '-equipment'
na = source.name .. '-mk' .. (tier - 1) .. '-equipment'
end
data:extend({{
type = 'recipe',
name = source .. '-mk' .. tier .. '-equipment',
name = source.name .. '-mk' .. tier .. '-equipment',
energy_required = 2,
enabled = false,
ingredients = {{na, 2}},
result = source .. '-mk' .. tier .. '-equipment',
result = source.name .. '-mk' .. tier .. '-equipment',
}})
end
-- tech
local function ET(source, tier, tech)
table.insert(data.raw.technology[tech].effects, {type='unlock-recipe', recipe=source .. '-mk' .. tier .. '-equipment'})
local function ET(source, tier)
table.insert(data.raw.technology[source.tech].effects, {type='unlock-recipe', recipe=source.name .. '-mk' .. tier .. '-equipment'})
end
for _, v in pairs(items) do
if v.enabled then
for j=v.min, v.max, 1 do
EE(v.name, j, v.base, v.graphics_source)
EI(v.name, j)
ER(v.name, j)
ET(v.name, j, v.tech)
EE(v, j)
EI(v, j)
ER(v, j)
ET(v, j)
end
end
end