need overrides for script.on_event(defines.events.on_chunk_generated)
I manually call events like this based on planets table
if(not remote.interfaces["warptorio"])then
.. register events as per normal
else
remote.add_interface("warptorio_planet_factory",{
["on_chunk_generated"]=whistle_OnChunkGenerated,
})
.
With just the remote and the on_chunk_generated override, i can make the bridging code used by the "Factory Planet" mod function correctly.
See the Maze Planet for an example showing how this would work if you managed your surfaces internally:
https://mods.factorio.com/mod/warptorio_planet_maze
Planet code (see bottom of control.lua).
local factory={
key="factory",name="A Factory Planet",zone=50,rng=2,
desc="There, in the distance! Is that.... Is that civilization? Have we made it back?!",
modifiers={
{"nauvis"},
},
on_chunk_generated_call={"warptorio_planet_factory","on_chunk_generated"},
}
local function RegisterPlanets()
remote.call("warptorio","registerplanet",factory)
end
script.on_init(function() whistle_on_init() RegisterPlanets() end)
script.on_load(RegisterPlanets)
This is bridging code and is optional and does not need to be included in your base mod.
This includes the on_init override - leave that as per normal.
The chunk function only.