Update main.lua

This commit is contained in:
PHIDIAS
2023-03-17 19:11:00 +09:00
parent 994496d71a
commit 26eba64c9f

View File

@@ -1,26 +1,26 @@
local alpha_order = {"b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"} local alpha_order = {'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm'}
local base_battery_energy = 5 local base_battery_energy = 5
local base_battery_flow = 300 local base_battery_flow = 300
local base_solar_energy = 60 local base_solar_energy = 60
local graphics_location = "__PHI-EN__/graphics/" local graphics_location = '__PHI-EN__/graphics/'
local items = {"accumulator", "solar-panel"} local items = {'accumulator', 'solar-panel'}
-- entity -- entity
local function EE(source, tier) local function EE(source, tier)
local item = table.deepcopy(data.raw[source][source]) local item = table.deepcopy(data.raw[source][source])
item.name = source .. "-mk" .. tier item.name = source .. '-mk' .. tier
item.minable.result = source .. "-mk" .. tier item.minable.result = source .. '-mk' .. tier
item.max_health = 200 * (2 ^ (tier - 1)) item.max_health = 200 * (2 ^ (tier - 1))
item.picture.layers[1].filename = graphics_location .. source .. "-e.png" item.picture.layers[1].filename = graphics_location .. source .. '-e.png'
item.picture.layers[1].hr_version.filename = graphics_location .. source .."-eh.png" item.picture.layers[1].hr_version.filename = graphics_location .. source ..'-eh.png'
item.icon = graphics_location .. source .. "-i.png" item.icon = graphics_location .. source .. '-i.png'
item.icon_size = 64 item.icon_size = 64
item.icon_mipmaps = 4 item.icon_mipmaps = 4
if (source == "accumulator") then if (source == 'accumulator') then
item.energy_source.buffer_capacity = (base_battery_energy * 4 ^ (tier - 1)) .. "MJ" item.energy_source.buffer_capacity = (base_battery_energy * 4 ^ (tier - 1)) .. 'MJ'
item.energy_source.input_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. "kW" item.energy_source.input_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. 'kW'
item.energy_source.output_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. "kW" item.energy_source.output_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. 'kW'
item.charge_animation.layers[1].layers[1].filename = item.picture.layers[1].filename item.charge_animation.layers[1].layers[1].filename = item.picture.layers[1].filename
item.charge_animation.layers[1].layers[1].tint = {r = 1, g = 1, b = 1, a = 1} item.charge_animation.layers[1].layers[1].tint = {r = 1, g = 1, b = 1, a = 1}
item.charge_animation.layers[1].layers[1].hr_version.filename = item.picture.layers[1].hr_version.filename item.charge_animation.layers[1].layers[1].hr_version.filename = item.picture.layers[1].hr_version.filename
@@ -30,11 +30,11 @@ local function EE(source, tier)
item.discharge_animation.layers[1].layers[1].hr_version.filename = item.picture.layers[1].hr_version.filename item.discharge_animation.layers[1].layers[1].hr_version.filename = item.picture.layers[1].hr_version.filename
item.discharge_animation.layers[1].layers[1].hr_version.tint = {r = 1, g = 1, b = 1, a = 1} item.discharge_animation.layers[1].layers[1].hr_version.tint = {r = 1, g = 1, b = 1, a = 1}
else else
item.production = (base_solar_energy * (4 ^ (tier - 1))) .. "kW" item.production = (base_solar_energy * (4 ^ (tier - 1))) .. 'kW'
end end
if (tier <= 7) then if (tier <= 7) then
item.next_upgrade = source .. "-mk" .. (tier + 1) item.next_upgrade = source .. '-mk' .. (tier + 1)
end end
data:extend({item}) data:extend({item})
@@ -43,18 +43,18 @@ end
-- item -- item
local function EI(source, tier) local function EI(source, tier)
local item = table.deepcopy(data.raw.item[source]) local item = table.deepcopy(data.raw.item[source])
item.name = source .. "-mk" .. tier item.name = source .. '-mk' .. tier
item.place_result = source .. "-mk" .. tier item.place_result = source .. '-mk' .. tier
item.max_health = 200 * (2 ^ (tier - 1)) item.max_health = 200 * (2 ^ (tier - 1))
item.subgroup = "energy" item.subgroup = 'energy'
item.stack_size = 50 item.stack_size = 50
item.default_request_amount = 50 item.default_request_amount = 50
item.icons = {{icon = graphics_location .. source .. "-i.png", icon_mipmaps = 4, icon_size = 64}} item.icons = {{icon = graphics_location .. source .. '-i.png', icon_mipmaps = 4, icon_size = 64}}
if (source == "accumulator") then if (source == 'accumulator') then
item.order = "d[" .. source .. "]-a" .. alpha_order[tier - 1] .. "[" .. source .. "-mk" .. tier .. "]" item.order = 'd[' .. source .. ']-a' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
else else
item.order = "e[" .. source .. "]-a" .. alpha_order[tier - 1] .. "[" .. source .. "-mk" .. tier .. "]" item.order = 'e[' .. source .. ']-a' .. alpha_order[tier - 1] .. '[' .. source .. '-mk' .. tier .. ']'
end end
data:extend({item}) data:extend({item})
@@ -65,52 +65,52 @@ local function ER(source, tier)
local na = source local na = source
if (tier >= 3) then if (tier >= 3) then
na = na .. "-mk" .. (tier - 1) na = na .. '-mk' .. (tier - 1)
end end
data:extend({{ data:extend({{
type = "recipe", type = 'recipe',
name = source .. "-mk" .. tier, name = source .. '-mk' .. tier,
energy_required = 5, energy_required = 5,
enabled = "false", enabled = 'false',
ingredients = {{na, 4}}, ingredients = {{na, 4}},
result = source .. "-mk" .. tier, result = source .. '-mk' .. tier,
}}) }})
end end
-- technology -- technology
local function ET(tier) local function ET(tier)
if (tier == 2) then if (tier == 2) then
local prereq = {"solar-energy", "advanced-electronics", "electric-energy-accumulators"} local prereq = {'solar-energy', 'advanced-electronics', 'electric-energy-accumulators'}
else else
local prereq = {"compound-energy-" .. (tier - 2)} local prereq = {'compound-energy-' .. (tier - 2)}
end end
data:extend({{ data:extend({{
type = "technology", type = 'technology',
name = "compound-energy-" .. (tier - 1), name = 'compound-energy-' .. (tier - 1),
icon_size = 256, icon_size = 256,
icon = graphics_location .. "solar-energy" .. "-t.png", icon = graphics_location .. 'solar-energy' .. '-t.png',
effects = { effects = {
{ {
type = "unlock-recipe", type = 'unlock-recipe',
recipe = "solar-panel-mk" .. tier recipe = 'solar-panel-mk' .. tier
}, },
{ {
type = "unlock-recipe", type = 'unlock-recipe',
recipe = "accumulator-mk" .. tier recipe = 'accumulator-mk' .. tier
} }
}, },
prerequisites = prereq, prerequisites = prereq,
unit = { unit = {
count = 200 * (2 ^ (tier - 1)), count = 200 * (2 ^ (tier - 1)),
ingredients = { ingredients = {
{"automation-science-pack", 1}, {'automation-science-pack', 1},
{"logistic-science-pack", 1} {'logistic-science-pack', 1}
}, },
time = 60 time = 60
}, },
order = "a-h-" .. alpha_order[tier + 1] order = 'a-h-' .. alpha_order[tier + 1]
}}) }})
end end