1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-03-17 20:58:13 +02:00
This commit is contained in:
danielmartin0 2022-03-20 11:41:23 +00:00
parent c0185d42d2
commit 4b1949c4a1
13 changed files with 30 additions and 25 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
.vscode/
.history/
.git/
maps/biter_battles_v3/
**/.DS_Store

View File

@ -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

View File

@ -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

View File

@ -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']

View File

@ -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

View File

@ -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

View File

@ -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']

View File

@ -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()

View File

@ -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']

View File

@ -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()

View File

@ -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

View File

@ -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)

View File

@ -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