diff --git a/.gitignore b/.gitignore index 95ba8e14..900e5dc6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .vscode/ .history/ .git/ -maps/biter_battles_v3/ +**/.DS_Store \ No newline at end of file diff --git a/maps/pirates/common.lua b/maps/pirates/common.lua index a0081b33..939d99d8 100644 --- a/maps/pirates/common.lua +++ b/maps/pirates/common.lua @@ -840,6 +840,7 @@ function Public.default_map_gen_settings(width, height, seed) return map_gen_settings end + function Public.build_from_blueprint(bp_string, surface, pos, force, flipped) flipped = flipped or false diff --git a/maps/pirates/gui/color.lua b/maps/pirates/gui/color.lua index c0345732..0c547fc4 100644 --- a/maps/pirates/gui/color.lua +++ b/maps/pirates/gui/color.lua @@ -49,7 +49,7 @@ end -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end end diff --git a/maps/pirates/gui/crew.lua b/maps/pirates/gui/crew.lua index 9afb3f25..1a49312d 100644 --- a/maps/pirates/gui/crew.lua +++ b/maps/pirates/gui/crew.lua @@ -365,7 +365,7 @@ end -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end if not player.gui.screen[window_name .. '_piratewindow'] then return end local flow = player.gui.screen[window_name .. '_piratewindow'] diff --git a/maps/pirates/gui/evo.lua b/maps/pirates/gui/evo.lua index af100f67..73d53095 100644 --- a/maps/pirates/gui/evo.lua +++ b/maps/pirates/gui/evo.lua @@ -50,7 +50,7 @@ local Public = {} -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end local memory = Memory.get_crew_memory() local pirates_flow = player.gui.top diff --git a/maps/pirates/gui/fuel.lua b/maps/pirates/gui/fuel.lua index 757590ef..b4168ce0 100644 --- a/maps/pirates/gui/fuel.lua +++ b/maps/pirates/gui/fuel.lua @@ -92,7 +92,7 @@ end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end local flow diff --git a/maps/pirates/gui/info.lua b/maps/pirates/gui/info.lua index dc10c26b..343625e6 100644 --- a/maps/pirates/gui/info.lua +++ b/maps/pirates/gui/info.lua @@ -213,7 +213,7 @@ end -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end if not player.gui.screen[window_name .. '_piratewindow'] then return end local flow = player.gui.screen[window_name .. '_piratewindow'] diff --git a/maps/pirates/gui/minimap.lua b/maps/pirates/gui/minimap.lua index dc232d16..04de9fe0 100644 --- a/maps/pirates/gui/minimap.lua +++ b/maps/pirates/gui/minimap.lua @@ -119,7 +119,7 @@ end -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end local flow local memory = Memory.get_crew_memory() diff --git a/maps/pirates/gui/progress.lua b/maps/pirates/gui/progress.lua index 3a5b5dc6..928811a6 100644 --- a/maps/pirates/gui/progress.lua +++ b/maps/pirates/gui/progress.lua @@ -88,7 +88,7 @@ end -- end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end if not player.gui.screen[window_name .. '_piratewindow'] then return end local flow = player.gui.screen[window_name .. '_piratewindow'] diff --git a/maps/pirates/gui/runs.lua b/maps/pirates/gui/runs.lua index c4717ac0..d7564b25 100644 --- a/maps/pirates/gui/runs.lua +++ b/maps/pirates/gui/runs.lua @@ -409,7 +409,7 @@ end function Public.full_update(player) - Public.regular_update(player) + if Public.regular_update then Public.regular_update(player) end local global_memory = Memory.get_global_memory() local memory = Memory.get_crew_memory() diff --git a/maps/pirates/overworld.lua b/maps/pirates/overworld.lua index 9d22e7bd..46582e77 100644 --- a/maps/pirates/overworld.lua +++ b/maps/pirates/overworld.lua @@ -170,14 +170,16 @@ function Public.generate_destination_type_and_subtype(overworld_position) end end - -- debug override to test islands: - if _DEBUG and type == Surfaces.enum.ISLAND then - -- warning: the first map is unique in that it isn't all loaded by the time you arrive, which can cause issues. For example, structures might get placed after ore, thereby deleting the ore underneath them. - subtype = Surfaces.Island.enum.MAZE - -- subtype = nil - -- type = Surfaces.enum.DOCK - end + --== DEBUG override to test islands: + + -- if _DEBUG and type == Surfaces.enum.ISLAND then + -- subtype = Surfaces.Island.enum.MAZE + -- -- subtype = nil + -- -- type = Surfaces.enum.DOCK + -- end + + -- warning: the first map is unique in that it isn't all loaded by the time you arrive, which can cause issues. For example, structures might get placed after ore, thereby deleting the ore underneath them. -- if _DEBUG and ((macro_p.x > 0 and macro_p.x < 25)) and type ~= Surfaces.enum.DOCK then -- type = nil diff --git a/maps/pirates/structures/boats/boats.lua b/maps/pirates/structures/boats/boats.lua index cb29938b..ae09e549 100644 --- a/maps/pirates/structures/boats/boats.lua +++ b/maps/pirates/structures/boats/boats.lua @@ -976,7 +976,7 @@ local function process_entity_on_boat(memory, boat, newsurface, newposition, vec end -local function teleport_handle_wake_tiles(boat, newsurface_name, oldsurface_name, oldsurface, newposition, vector, scope, vectordirection, vectorlength, old_water_tile, friendlyboat_bool) +local function teleport_handle_wake_tiles(boat, dummyboat, newsurface_name, oldsurface_name, oldsurface, newposition, vector, scope, vectordirection, vectorlength, old_water_tile, friendlyboat_bool) local static_params = Common.current_destination().static_params @@ -1012,11 +1012,6 @@ local function teleport_handle_wake_tiles(boat, newsurface_name, oldsurface_name oldsurface.set_tiles(newtiles, true, true, true) else - -- place waterboat - local dummyboat - if oldsurface_name ~= newsurface_name then - dummyboat = Utils.deepcopy(boat) - end local p = dummyboat.position @@ -1141,6 +1136,12 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile local friendlyboat_bool = (memory.force_name == boat.force_name) local oldsurface, newsurface = game.surfaces[oldsurface_name], game.surfaces[newsurface_name] + local dummyboat + if oldsurface_name ~= newsurface_name then + -- we will place this with water: + dummyboat = Utils.deepcopy(boat) + end + game.surfaces['nauvis'].request_to_generate_chunks({0,0}, 1) game.surfaces['nauvis'].force_generate_chunk_requests() --WARNING: THIS DOES NOT PLAY NICELY WITH DELAYED TASKS. log(_inspect{global_memory.working_id}) was observed to vary before and after this function. @@ -1334,9 +1335,7 @@ function Public.teleport_boat(boat, newsurface_name, newposition, new_floor_tile Hold.connect_up_linked_belts_to_deck() Cabin.connect_up_linked_belts_to_deck() - - - teleport_handle_wake_tiles(boat, newsurface_name, oldsurface_name, oldsurface, newposition, vector, scope, vectordirection, vectorlength, old_water_tile, friendlyboat_bool) + teleport_handle_wake_tiles(boat, dummyboat, newsurface_name, oldsurface_name, oldsurface, newposition, vector, scope, vectordirection, vectorlength, old_water_tile, friendlyboat_bool) teleport_handle_renderings(boat, oldsurface_name, newsurface_name, vector, scope, memory, newsurface) diff --git a/maps/pirates/tick_functions.lua b/maps/pirates/tick_functions.lua index b8d677d9..a7f3ffa4 100644 --- a/maps/pirates/tick_functions.lua +++ b/maps/pirates/tick_functions.lua @@ -436,6 +436,8 @@ function Public.interpret_shorthanded_force_name(shorthanded_name) ret = memory.force_name elseif shorthanded_name == 'enemy' then ret = memory.enemy_force_name + else + ret = shorthanded_name end return ret end @@ -566,6 +568,7 @@ function Public.place_cached_structures(tickinterval) local c2 = {type = c.type, force_name = force_name, built_entities = {}} local es = Common.build_from_blueprint(c.bp_string, surface, Utils.psum{position, c.offset}, game.forces[force_name]) + for l = 1, #es do c2.built_entities[#c2.built_entities + 1] = es[l] end