Whistle Stop Factories


Spawns massive furnaces and assembly machines around the map to make the game all about building trains to connect them

Content
3 years ago
0.16 - 1.1
2.90K
Manufacturing

a Factory Planet

5 years ago

Nice! Looks like a creative and fun way to implement Whistle Stop. Cool! I love it!

Did you have to reimplement it due to my not so careful regard for surfaces? Or did you have to make a lot of changes? I had someone suggest that I should implement LuaRemote to allow other mods to make API calls to blacklist or whitelist various surfaces for factory spawning, but I never actually got around to that.

5 years ago
(updated 5 years ago)

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.

New response