Stellaris

Stellaris

Growing planets
Yandersen  [developer] 31 May, 2017 @ 5:32am
Become a contributor, help me out making this mod better!
Glad to see you interested! In this post I will crack the mod's guts open for u in a hope u will help me making this mod better.

This mod is composed of the following files:

common\spaceport_modules\terraformer_spaceport_module_GP.txt
It defines a dedicated spaceport module, existence of which is crucial for a planet to allow it's growth. The definition is the following:
terraformer = { icon = "GFX_spaceport_module_atmospheric_manipulator" section = "SCIENCE_SPACEPORT_SECTION" construction_days = 360 prerequisites = { "tech_terrestrial_sculpting" } spaceport_level = 5 cost = { minerals = 400 influence = 50 } required_resources = { energy = 10 } }

localisation\english\l_english_GP.yml
This is a localization file adding few strings for terraforming station:
l_english: sm_terraformer:0 "Terraforming Station" sm_terraformer_desc:0 "This station dumps massive amounts of sediment obtained from our space mining stations onto the planet artificially raising it's mass."

localisation\english\events_l_english_GP.yml
This is a localization file adding few strings for the popup message:
l_english: growing_planets.max_size.name:0 "Planet is too large" growing_planets.max_size.desc:0 "Further increase of planet's mass is dangerous. Our scientists advise to stop the terraforming efforts at this point." growing_planets.remove_terraformer.ok:0 "Disband the terraforming module." REMOVE_SPACEPORT_MODULE:0 "Spaceport module removed"

common\scripted_triggers\00_scripted_triggers_GP.txt
It defines conditions that donor candidates are checked upon:
#Checks if the celestial object can be used as a donor of matter for a habitable planet #Expected scope: planet is_celestial_body_can_be_donor = { OR = { #Must be one of the following types: is_planet_class = pc_barren is_planet_class = pc_barren_cold is_planet_class = pc_frozen is_planet_class = pc_asteroid } #Can not be colonizable or terraformable is_colonizable = no NOT = { has_modifier = terraforming_candidate } #Must be left untouched until anomaly researched has_anomaly = no #Must not have deposit for research station (it couldn't be mined then) NOT = { has_deposit_for = shipclass_research_station } #Can not be too small planet_size > 3 }

events\planet_size_increase_GP.txt
This is a core of this mod containing the main event script that increases/decreases planet sizes and removes terraformer on condition; the initial mineral deposit distribution event is also here:
namespace = growing_planets #Planet growth event planet_event = { id = growing_planets.1 hide_window = yes mean_time_to_happen = { days = 360 } trigger = { has_owner = yes owner = { has_technology = tech_terrestrial_sculpting } planet_size < 25 has_ground_combat = no is_occupied_flag = no num_pops > 0 has_spaceport = yes } immediate = { #ensure there are minable donors exists within the empire borders owner = { country_event = { id = growing_planets.3 } } #Check if terraforming can occur if = { limit = { #Check if the corresponding module is present on the planet has_spaceport_module = terraformer #Ensure there are any mining stations orbiting suitable celestial objects owner = { any_owned_ship = { is_ship_class = shipclass_mining_station orbit = { is_celestial_body_can_be_donor = yes } } } } #Pick a celestial object that can serve as donor owner = { random_owned_ship = { limit = { is_ship_class = shipclass_mining_station orbit = { is_celestial_body_can_be_donor = yes } } orbit = { #Enter the planet scope #Check if the planet has ring if = { limit = { has_ring = yes } #If it does - just remove it instead of shrinking the planet set_ring = no #No ring? Then it will be shrinked else = { #Shrink the planet size change_planet_size = -1 #Shrinking planet may give a boost to mineral production if = { limit = { planet_size < 15 planet_size > 5 } random_list = { 7 = {} 2 = { orbital_deposit_tile = { add_deposit = d_mineral_deposit } } } } } } } #Now go back to the main planet's scope... root = { #...to spawn a new tile on the main planet... change_planet_size = 1 #...and if the maximum size reached, remove the module (but not for AI) if = { limit = { planet_size = 25 owner = { is_ai = no } } planet_event = { id = growing_planets.2 } } } } } } } } #Planet reached the maximum size - show event window, disband the terraformer planet_event = { id = growing_planets.2 #Configure the message window title = "growing_planets.max_size.name" desc = "growing_planets.max_size.desc" picture = GFX_evt_gas_giant location = ROOT is_triggered_only = yes option = { remove_spaceport_module = terraformer name = growing_planets.remove_terraformer.ok } } #Mineral deposit distribution event ensuring that there is at least one rock with minerals country_event = { id = growing_planets.3 hide_window = yes is_triggered_only = yes trigger = { #Ensure there are any donor planets exists within the empire borders... any_planet_within_border = { is_celestial_body_can_be_donor = yes #...which are either minable or could be made minable OR = { has_deposit_for = shipclass_mining_station orbital_deposit_tile = { has_deposit = no } } } #Check if there are no possible donors that can be mined NOT = { any_planet_within_border = { is_celestial_body_can_be_donor = yes has_deposit_for = shipclass_mining_station } } } immediate = { #Pick a system inside the empire borders which contains donor candidate random_system_within_border = { limit = { any_planet = { is_celestial_body_can_be_donor = yes orbital_deposit_tile = { has_deposit = no } } } #Pick a celestial object that is random_system_planet = { limit = { is_celestial_body_can_be_donor = yes orbital_deposit_tile = { has_deposit = no } } orbital_deposit_tile = { add_deposit = d_mineral_deposit } } } } }
Last edited by Yandersen; 24 Jun, 2017 @ 4:02pm
< >
Showing 1-8 of 8 comments
PicardOrion 31 May, 2017 @ 7:43am 
If you want to stick to your idea: If no donor is found you cannot create new tiles.
Is it possible instead to make size 1 planets dissapear instead of shrinking them?
Yandersen  [developer] 31 May, 2017 @ 8:45am 
Possible, I think, since there is a mod introducing doomsday weapons. Good suggestion, thank you, will see if it is possible.

UPD: nope, seems like technically not possible. Turned out that in doomsday weapons modes planets do not disappear completely - rather change their types to barren/destroyed or whatever.
Last edited by Yandersen; 31 May, 2017 @ 9:38am
Risa 31 May, 2017 @ 9:49am 
limit = { habitable_planet = no is_star = no planet_size > 1 }
That is not good enough. habitable_planet is a scripted trigger, which just check if the planet is of one of nine usual classes of climate, or gaia. So the above condition can be met by Tomb world, habitat, any part of a ringworld, or any other classes introduced by other mods (if they don't override habitable_planet scripted trigger).

Better just use another scripted trigger uninhabitable_regular_planet = yes. Or
limit = { OR = { uninhabitable_regular_planet = yes is_planet_class = pc_gas_giant is_asteroid = yes } planet_size > 1 }
if you want to include gas giants and asteroids.
Yandersen  [developer] 31 May, 2017 @ 12:20pm 
Oh, it is a trigger? I see! I think I'll write my own trigger then. :)
Thanks, Risa!
Yandersen  [developer] 31 May, 2017 @ 5:43pm 
I feel much more confident now, seems like I start to understand what I am writing. :D
Also, I finally found the full info, existence of which surprised me:
Scopes[www.stellariswiki.com]
Conditions[www.stellariswiki.com]
Effects[www.stellariswiki.com]
Last edited by Yandersen; 31 May, 2017 @ 5:49pm
Kepler68 7 Jun, 2017 @ 11:54am 
For the destroy planets thing, there is code in ringworld megastructures that deletes them entirely
Yandersen  [developer] 7 Jun, 2017 @ 12:13pm 
Thanks, Kepler68, I had it working, but currently decided that it is better to keep them all limiting the shrink size at 5 since the donors become selected from suitable planets with mining stations. Destroying them would punish mineral production.
Lazard 14 Aug, 2017 @ 8:02am 
Is it possible to make a pop up to announce that there is no donor planet that is big enogh?
< >
Showing 1-8 of 8 comments
Per page: 1530 50