A workaround for bug 118405, where the map of a space platform is out of date and contains stuff that no longer exists.
This mod has three modes of operation, which can be chosen in the settings:
- (the default) the map of a platform is refreshed every-time an entity/ghost/tile on the platform is created/destroyed. If this causes lag for you, please let me know and give me the save file! But it shouldn't be a problem on fast computers with small platforms.
- Update the map of a platform everytime you switch to it (this was the way the original version of this mod worked), so you have to switch back and forth to something else to force a refresh.
- Update all platforms when CTRL R is pressed (the key sequence can be changed in the controls setting)
Note: if you use this in multiplayer, any map refresh will occur for all players (assuming they can see your platform in the first place).
If you don't want to play with mods (which cause problems for achievements), for option #1, you can just add the following code to the control.lua file in your save's zip:
function rechart(surface)
if not surface.platform then return end
for _, f in pairs(game.forces) do f.rechart(surface) end end
script.on_event(defines.events.on_built_entity, function (event) rechart(event.entity.surface) end)
script.on_event(defines.events.on_space_platform_mined_item, function (event) rechart(event.platform.surface) end)
script.on_event(defines.events.on_pre_ghost_deconstructed, function (event) rechart(event.ghost.surface) end)
script.on_event(defines.events.on_entity_died, function (event) rechart(event.entity.surface) end)
For option #2, you can add:
script.on_event(defines.events.on_player_changed_surface, function(event)
if event.surface_index then
local surface = game.surfaces[event.surface_index]
if not surface.platform then return end
for _, f in pairs(game.forces) do f.rechart(surface) end end)
Sadly, option #3 requires a mod as it adds a new keyboard shortcut to the game.
Let me know if you get any performance issues or the map is still incorrect (preferably with a save I can test it with).