diff --git a/sharedPlugins/remoteMap/control.lua b/sharedPlugins/remoteMap/control.lua index 18301e45..be329396 100644 --- a/sharedPlugins/remoteMap/control.lua +++ b/sharedPlugins/remoteMap/control.lua @@ -26,18 +26,27 @@ function write_file(data) must_write_initstuff = false writeout_initial_stuff() end - - game.write_file("remoteMap.txt", data, true) + stringsToWriteNextTick = stringsToWriteNextTick .. data .. '\n' + -- game.write_file("remoteMap.txt", data, true) end + +function dump_cached_writes() + game.write_file("remoteMap.txt", stringsToWriteNextTick, true) +end + function complain(text) - print(text) - game.forces["player"].print(text) + if false then -- only print during development + print(text) + game.forces["player"].print(text) + end end local todo_next_tick = {} function on_tick(event) + dump_cached_writes() + stringsToWriteNextTick = '' if #todo_next_tick > 0 then - print("on_tick executing "..#todo_next_tick.." stored callbacks") + complain("on_tick executing "..#todo_next_tick.." stored callbacks") for _,func in ipairs(todo_next_tick) do func() end @@ -45,10 +54,8 @@ function on_tick(event) end end - function writeout_objects(surface, area) --if my_client_id ~= 1 then return end - header = "objects "..area.left_top.x..","..area.left_top.y..";"..area.right_bottom.x..","..area.right_bottom.y..": " line = '' for idx, ent in pairs(surface.find_entities(area)) do if area.left_top.x <= ent.position.x and ent.position.x < area.right_bottom.x and area.left_top.y <= ent.position.y and ent.position.y < area.right_bottom.y then @@ -99,6 +106,7 @@ script.on_event(defines.events.on_tick, on_tick) script.on_event(defines.events.on_biter_base_built, on_some_entity_created) --entity script.on_event(defines.events.on_built_entity, on_some_entity_created) --created_entity script.on_event(defines.events.on_robot_built_entity, on_some_entity_created) --created_entity +script.on_event(defines.events.on_player_rotated_entity, on_some_entity_created) --created_entity script.on_event(defines.events.on_entity_died, on_some_entity_deleted) --entity script.on_event(defines.events.on_player_mined_entity, on_some_entity_deleted) --entity diff --git a/sharedPlugins/remoteMap/info.json b/sharedPlugins/remoteMap/info.json index ce55594f..9808728f 100644 --- a/sharedPlugins/remoteMap/info.json +++ b/sharedPlugins/remoteMap/info.json @@ -2,10 +2,10 @@ { "name": "remoteMap", "title": "Clusterio remote map", -"version": "2.0.0", +"version": "2.1.0", "date": "18-11-2017", "author": "Danielv123", "dependencies": ["base >= 0.15"], "factorio_version": "0.16", -"description": "Clusterio plugin for external mapping and possibly building?" +"description": "Clusterio plugin for external mapping and soon also building. Mobile factorio confirmed" }