Page 1 of 1
Possible to get list of all added surfaces?
Posted: Thu Feb 13, 2025 7:21 pm
by HarroldSaxon
Is it possible to generate a list of all surfaces added by other mods for use in config? Or would this be blind to any mod loading after my mod?
Re: Possible to get list of all added surfaces?
Posted: Thu Feb 13, 2025 8:37 pm
by robot256
Surfaces are generated at runtime by either the game or by mod scripts. Your mod can track them by listening to the on_surface_created and on_surface_deleted events, or by iterating over pairs(game.surfaces).
Planets are added in the data phase and are how you alter the map creation dialog. Mods can add planet definitions in the data phase which then have associated surfaces generated in game. Your mod can read the surface definitions added by other mods at prior phases in the data stage or if you mark them as a dependency.
The settings stage happens before the data stage so you cannot add or rename settings based on things that happen in the data stage. You can read which mods are installed and add settings on the assumption that particular mods will add particular settings.