From 290993776526dbeb24a2a15c0838a90e441df270 Mon Sep 17 00:00:00 2001 From: Simon Brodtmann Date: Sat, 1 Nov 2025 17:54:21 +0100 Subject: [PATCH] Move parent planet calculation to data-updates --- .../prototypes/content/lignumis/planet-updates.lua | 14 ++++++++++++++ lignumis/prototypes/content/lignumis/planet.lua | 9 ++------- lignumis/prototypes/content/updates.lua | 3 ++- 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 lignumis/prototypes/content/lignumis/planet-updates.lua diff --git a/lignumis/prototypes/content/lignumis/planet-updates.lua b/lignumis/prototypes/content/lignumis/planet-updates.lua new file mode 100644 index 0000000..c40262b --- /dev/null +++ b/lignumis/prototypes/content/lignumis/planet-updates.lua @@ -0,0 +1,14 @@ +local target_planet = settings.startup["lignumis-second-planet"].value or "nauvis" +if mods["any-planet-start"] then + target_planet = settings.startup["aps-planet"].value ~= "none" and settings.startup["aps-planet"].value or target_planet +end + +local lignumis = data.raw.planet["lignumis"] + +-- Set final solar power depending on parent planet +local solar_power = data.raw.planet[target_planet].surface_properties["solar-power"] or 100 +local solar_power_in_space = data.raw.planet[target_planet].solar_power_in_space or 300 +solar_power = solar_power * 1.2 +solar_power_in_space = solar_power_in_space * 1.2 +lignumis.solar_power_in_space = solar_power_in_space +lignumis.surface_properties["solar-power"] = solar_power \ No newline at end of file diff --git a/lignumis/prototypes/content/lignumis/planet.lua b/lignumis/prototypes/content/lignumis/planet.lua index f21ccd1..c4fd03c 100644 --- a/lignumis/prototypes/content/lignumis/planet.lua +++ b/lignumis/prototypes/content/lignumis/planet.lua @@ -21,11 +21,6 @@ local nauvis_lignumis = { } } -local solar_power = data.raw.planet[target_planet].surface_properties["solar-power"] or 100 -local solar_power_in_space = data.raw.planet[target_planet].solar_power_in_space or 300 -solar_power = solar_power * 1.2 -solar_power_in_space = solar_power_in_space * 1.2 - PlanetsLib:extend({ { type = "planet", @@ -53,7 +48,7 @@ PlanetsLib:extend({ map_seed_offset = 100, map_gen_settings = planet_map_gen, pollutant_type = "noise", - solar_power_in_space = solar_power_in_space, + solar_power_in_space = 300, draw_orbit = false, planet_procession_set = { arrival = { "default-b" }, @@ -63,7 +58,7 @@ PlanetsLib:extend({ ["day-night-cycle"] = 2 * minute, ["gravity"] = 4, ["pressure"] = 900, - ["solar-power"] = solar_power + ["solar-power"] = 100 }, asteroid_spawn_influence = 1, asteroid_spawn_definitions = asteroid_util.spawn_definitions(nauvis_lignumis, 0.9), diff --git a/lignumis/prototypes/content/updates.lua b/lignumis/prototypes/content/updates.lua index c6d2a3f..7087806 100644 --- a/lignumis/prototypes/content/updates.lua +++ b/lignumis/prototypes/content/updates.lua @@ -1 +1,2 @@ -require("fuel-category-updates") \ No newline at end of file +require("fuel-category-updates") +require("lignumis/planet-updates") \ No newline at end of file