on_surface_created event
Posted: Wed Apr 06, 2016 6:23 pm
We have event which is raised when force is created by script,but there seems to be no event which alerts mods about creation of new surface.
why would you need it ? a surface can't be renamed, and when the surface is created, no chunks are generated yet ... You'd be better off looking at the on_chunk_generated event if you want to do stuff to the surface !Adil wrote:We have event which is raised when force is created by script,but there seems to be no event which alerts mods about creation of new surface.
Code: Select all
global.stuff[nauvis]={detailed stuff}
Can do this now from chunk generation event. It provides surface in the event handler directly.Adil wrote:I've though of storing some surface-specific info into global tables indexed by surface. As inCurrently my mods do okay by checking whether an index has been initialized in the table but I suppose there might be some situations, when you'd want to perform initialization beforehand and maybe even start performing calculations from there on.Code: Select all
global.stuff[nauvis]={detailed stuff}
It is still a needless waste of performance no matter how little you do in a function.orzelek wrote: Can do this now from chunk generation event. It provides surface in the event handler directly.
Unless you are planning some extensive precalculations then you'd need to use ticks to do the job in small parts as not to lag the game.