Skip to content

Commit

Permalink
Fix stack traceback
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerkiz committed Nov 28, 2023
1 parent 08d7bef commit 80d8814
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 3 additions & 9 deletions maps/mountain_fortress_v3/icw/linked_chests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -765,14 +765,8 @@ local function built_entity_robot(event)
return
end

local s = create_chest(entity)
if s then
event.player_index = player.index
event.gui_type = defines.gui_type.entity
event.entity = entity
gui_opened(event)
return
end
create_chest(entity)
return
else
local created = event.created_entity
if created and created.valid then
Expand Down Expand Up @@ -922,7 +916,7 @@ local function on_gui_checked_state_changed(event)

if element.name == 'disconnect_state' then
container.chest.link_id = uid_counter()
AG.append_scenario_history(player, container.chest, player.name .. ' disconnected link from chest (' .. container.unit_number .. ') to chest (' .. container.linked_to .. ')')
AG.append_scenario_history(player, container.chest, player.name .. ' disconnected link from chest (' .. container.unit_number .. ') to chest (' .. container.linked_to or 'unknown' .. ')')
local destination_chest = fetch_container(container.linked_to)
if destination_chest then
create_message(player, 'Disconnected link', container.chest.position, destination_chest.chest.position)
Expand Down
4 changes: 4 additions & 0 deletions utils/gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ end

-- Associates data with the LuaGuiElement. If data is nil then removes the data
function Public.set_data(element, value)
if not element or not element.valid then
return
end

local player_index = element.player_index
local values = data[player_index]

Expand Down

0 comments on commit 80d8814

Please sign in to comment.