#Pop Quiz
1 messages · Page 1 of 1 (latest)
renaming a surface does not change the index does it?
wait no that only changes the name
you wouldn't be making this post if the answer was yes so I'm going with no
I'm guessing if another mod makes a surface in their on_init or something it breaks
not sure if before or after in terms of mod load order
wait I was right
but not the on_surface_renamed event, it's the on_surface_imported event, since that creates a new surface
I think
Only if they run before this code, since the on_surface_created doesn't check existence of storage.surface_indexes and thus would result in an error
If they run after us it should be fine as we have initialized storage.surface_indexes in on_init()
on_surface_imported is only triggered when importing a surface from the map editor, so it depends if
at the end of the tick
is considered to be only the first tick on initialization or the end of every tick. In the first case - while not impossible - you have to be lightning fast to go into editor mode immediately after loading the game in order to import the surface
The on_surface_created can't run until after on_init
So the on_init should catch it
I suspect it's that it's not listening toon_configuration_changed
Something with indexes being re-used?
why would on_configuration_changed matter
Because mods can add/remove surfaces (planets) in data stage
but when the planet gets made to generate it's surface the event will still properly fire tho
alright here's the answer:
if this mod is in a save, and you add a new mod that creates a surface in their own on_init, then this mod would not have gotten the event
so a on_configuration_changed handler would be needed to do a full scan like in on_init
indeed