This commit is contained in:
2023-04-18 14:52:27 +09:00
parent ce9cfcdf85
commit b23590667f
3 changed files with 45 additions and 45 deletions

View File

@@ -1,49 +1,46 @@
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_flow = 300
local base_solar_energy = 60
local graphics_location = '__PHI-EN__/graphics/' local graphics_location = '__PHI-EN__/graphics/'
local items = {'accumulator', 'solar-panel'}
local items = { local items = {
['solar-panel'] = { ['solar-panel'] = {
enabled = true, enabled = true,
type = 'solar-panel', type = 'solar-panel',
name = 'solar-panel', name = 'solar-panel',
tech = 'solar-panel-equipment',
min = 2, min = 2,
max = 8, max = 8,
base = 30, base = 60
graphics_source = nil
}, },
['accumulator'] = { ['accumulator'] = {
enabled = true, enabled = true,
type = 'solar-panel', type = 'accumulator',
name = 'solar-panel', name = 'accumulator',
tech = 'solar-panel-equipment',
min = 2, min = 2,
max = 8, max = 8,
base = 30, base = 5
graphics_source = nil
} }
} }
if mods['space-exploration'] then
items['solar-panel'].base = 100
items['accumulator'].base = 10
end
-- 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.type][source.name])
item.name = source .. '-mk' .. tier item.name = source.name .. '-mk' .. tier
item.minable.result = source .. '-mk' .. tier item.minable.result = source.name .. '-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.name .. '-e.png'
item.picture.layers[1].hr_version.filename = graphics_location .. source ..'-eh.png' item.picture.layers[1].hr_version.filename = graphics_location .. source.name ..'-eh.png'
item.icon = graphics_location .. source .. '-i.png' item.icon = graphics_location .. source.type .. '-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 = (source.base * 4 ^ (tier - 1)) .. 'MJ'
item.energy_source.input_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. 'kW' item.energy_source.input_flow_limit = (source.base * 60 * (4 ^ (tier - 1))) .. 'kW'
item.energy_source.output_flow_limit = (base_battery_flow * (4 ^ (tier - 1))) .. 'kW' item.energy_source.output_flow_limit = (source.base * 60 * (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
@@ -53,11 +50,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 = (source.base * (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.name .. '-mk' .. (tier + 1)
end end
data:extend({item}) data:extend({item})
@@ -66,18 +63,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.name .. '-mk' .. tier
item.place_result = source .. '-mk' .. tier item.place_result = source.name .. '-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.name .. '-i.png', icon_mipmaps = 4, icon_size = 64}}
if (source == 'accumulator') then if (source.type == 'accumulator') then
item.order = 'd[' .. source .. ']-a' .. tier .. '[' .. source .. '-mk' .. tier .. ']' item.order = 'd[' .. source.type .. ']-a' .. tier .. '[' .. source.name .. '-mk' .. tier .. ']'
else else
item.order = 'e[' .. source .. ']-a' .. tier .. '[' .. source .. '-mk' .. tier .. ']' item.order = 'e[' .. source.type .. ']-a' .. tier .. '[' .. source.name .. '-mk' .. tier .. ']'
end end
data:extend({item}) data:extend({item})
@@ -85,7 +82,7 @@ end
-- recipe -- recipe
local function ER(source, tier) local function ER(source, tier)
local na = source local na = source.name
if (tier >= 3) then if (tier >= 3) then
na = na .. '-mk' .. (tier - 1) na = na .. '-mk' .. (tier - 1)
@@ -93,11 +90,11 @@ local function ER(source, tier)
data:extend({{ data:extend({{
type = 'recipe', type = 'recipe',
name = source .. '-mk' .. tier, name = source.name .. '-mk' .. tier,
energy_required = 2, energy_required = 2,
enabled = false, enabled = false,
ingredients = {{na, 4}}, ingredients = {{na, 4}},
result = source .. '-mk' .. tier, result = source.name .. '-mk' .. tier,
}}) }})
end end
@@ -126,7 +123,7 @@ local function ET(tier)
}, },
prerequisites = prereq, prerequisites = prereq,
unit = { unit = {
count = 200 * (2 ^ (tier - 1)), count = 100 * (2 * (tier - 1)),
ingredients = { ingredients = {
{'automation-science-pack', 1}, {'automation-science-pack', 1},
{'logistic-science-pack', 1} {'logistic-science-pack', 1}
@@ -137,11 +134,14 @@ local function ET(tier)
}}) }})
end end
for i=1, 2, 1 do for _, v in pairs(items) do
for j=2, 8, 1 do if v.enabled then
EE(items[i], j) for j=v.min, v.max, 1 do
EI(items[i], j) EE(v, j)
ER(items[i], j) EI(v, j)
ET(j) ER(v, j)
ET(j)
end
end end
end end

View File

@@ -1,14 +1,15 @@
{ {
"name": "PHI-EN", "name": "PHI-EN",
"version": "1.1.5", "version": "1.1.6",
"factorio_version": "1.1", "factorio_version": "1.1",
"date": "2023-04-13", "date": "2023-04-18",
"title": "Phidias Energy", "title": "Phidias Energy",
"author": "PHIDIAS0303", "author": "PHIDIAS0303",
"contributers": "", "contributers": "",
"homepage": "", "homepage": "",
"description": "Additional Compound Solars, Accumulator", "description": "Additional Compound Solars, Accumulator",
"dependencies": [ "dependencies": [
"base >= 1.1.0" "base >= 1.1.0",
"? space-exploration >= 0.6.0"
] ]
} }

View File

@@ -87,7 +87,6 @@ local items = {
if mods['space-exploration'] then if mods['space-exploration'] then
items['solar-panel'].base = 40 items['solar-panel'].base = 40
items['fusion-reactor'].name = 'se-rtg-equipment'
items['fusion-reactor'].tech = 'se-rtg-equipment' items['fusion-reactor'].tech = 'se-rtg-equipment'
items['fusion-reactor'].base = 800 items['fusion-reactor'].base = 800
@@ -231,7 +230,7 @@ local function EE(source, tier)
item['shape'] = {width = w, height = h, type = 'full'} item['shape'] = {width = w, height = h, type = 'full'}
if source.graphics_source == nil then if source.graphics_source == nil then
item['sprite'] = {filename = graphics_location .. source.type .. '-equipment-e.png', width = w * 32, height = h * 32, priority = 'medium', hr_version = {filename = graphics_location .. source.type .. '-equipment-eh.png', width = w * 64, height = h *64, priority = 'medium', scale = 0.5}} item['sprite'] = {filename = graphics_location .. source.name .. '-equipment-e.png', width = w * 32, height = h * 32, priority = 'medium', hr_version = {filename = graphics_location .. source.name .. '-equipment-eh.png', width = w * 64, height = h *64, priority = 'medium', scale = 0.5}}
else else
item['sprite'] = {filename = source.graphics_source, width = w * 32, height = h * 32, priority = 'medium'} item['sprite'] = {filename = source.graphics_source, width = w * 32, height = h * 32, priority = 'medium'}
end end
@@ -247,7 +246,7 @@ local function EI(source, tier)
item.subgroup = 'equipment' item.subgroup = 'equipment'
item.stack_size = 20 item.stack_size = 20
item.default_request_amount = 5 item.default_request_amount = 5
item.icons = {{icon = graphics_location .. source.type .. '-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.type == 'solar-panel') then if (source.type == 'solar-panel') then
item.order = 'a[energy-source]-a' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']' item.order = 'a[energy-source]-a' .. alpha_order[tier - 1] .. '[' .. source.name .. '-mk' .. tier .. ']'