1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-30 04:40:54 +02:00

Re-open GUI of teleported items when the boat moves

This commit is contained in:
danielmartin0 2024-10-17 16:00:30 +01:00
parent d5c40d6cd1
commit 337579040a

View File

@ -1043,6 +1043,8 @@ local function process_entity_on_boat_unteleportable(
-- end
boat.deck_whitebelts[#boat.deck_whitebelts + 1] = ee
end
return ee
end
end
@ -1214,6 +1216,8 @@ local function process_entity_on_boat_teleportable(
end
end
end
return ee
end
local function process_entity_on_boat(
@ -1233,6 +1237,15 @@ local function process_entity_on_boat(
unique_entities_list[#unique_entities_list + 1] = e
local name = e.name
local players_with_gui_open = {}
for _, player in pairs(game.connected_players) do
if player.opened == e then
table.insert(players_with_gui_open, player)
end
end
local ee
-- NOTE: This sometimes causes items on belts to be sent to cabin, which maybe could be fixed?
if name == 'item-on-ground' then
Common.give_items_to_crew({ { name = e.stack.name, count = e.stack.count } })
@ -1249,7 +1262,7 @@ local function process_entity_on_boat(
Utils.contains(CoreData.unteleportable_names, name)
or (name == 'entity-ghost' and Utils.contains(CoreData.unteleportable_names, e.ghost_name))
then
process_entity_on_boat_unteleportable(
ee = process_entity_on_boat_unteleportable(
memory,
boat,
newsurface,
@ -1261,7 +1274,7 @@ local function process_entity_on_boat(
name
)
else
process_entity_on_boat_teleportable(
ee = process_entity_on_boat_teleportable(
memory,
boat,
newsurface,
@ -1274,6 +1287,12 @@ local function process_entity_on_boat(
)
end
end
if ee and ee.valid then
for _, player in ipairs(players_with_gui_open) do
player.opened = ee
end
end
end
end