From 8f828bd86a14af41e7157afeeadbacf7428f80eb Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Sat, 30 Jan 2021 20:43:53 +0100 Subject: [PATCH] minor changes to mnt fortress --- maps/mountain_fortress_v3/icw/functions.lua | 1 - maps/mountain_fortress_v3/icw/main.lua | 8 -------- maps/mountain_fortress_v3/locomotive.lua | 5 +++-- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/maps/mountain_fortress_v3/icw/functions.lua b/maps/mountain_fortress_v3/icw/functions.lua index 973b6cc9..0c2f7eed 100644 --- a/maps/mountain_fortress_v3/icw/functions.lua +++ b/maps/mountain_fortress_v3/icw/functions.lua @@ -644,7 +644,6 @@ function Public.create_wagon_room(icw, wagon) e2.minable = false wagon.transfer_entities = {e1, e2} end - return end end diff --git a/maps/mountain_fortress_v3/icw/main.lua b/maps/mountain_fortress_v3/icw/main.lua index 06d15e99..419ff40d 100644 --- a/maps/mountain_fortress_v3/icw/main.lua +++ b/maps/mountain_fortress_v3/icw/main.lua @@ -86,13 +86,6 @@ local function on_train_created() Functions.request_reconstruction(icw) end -local function on_built_entity(event) - local icw = ICW.get() - local created_entity = event.created_entity - Functions.create_wagon(icw, created_entity) - Functions.add_wagon_entity_count(icw, created_entity) -end - local function on_gui_click(event) local icw = ICW.get() Functions.toggle_minimap(icw, event) @@ -160,6 +153,5 @@ Event.add(defines.events.on_gui_opened, on_gui_opened) Event.add(defines.events.on_player_built_tile, on_player_or_robot_built_tile) Event.add(defines.events.on_robot_built_tile, on_player_or_robot_built_tile) Event.add(defines.events.on_gui_switch_state_changed, on_gui_switch_state_changed) -Event.add(defines.events.on_built_entity, on_built_entity) return Public diff --git a/maps/mountain_fortress_v3/locomotive.lua b/maps/mountain_fortress_v3/locomotive.lua index 283be044..8be348df 100644 --- a/maps/mountain_fortress_v3/locomotive.lua +++ b/maps/mountain_fortress_v3/locomotive.lua @@ -1479,8 +1479,8 @@ local function on_built_entity(event) local chest_created local increased = false - for k, v in pairs(outside_chests) do - if v and v.valid then + for k, data in pairs(outside_chests) do + if data and data.chest and data.chest.valid then if chests_linked_to[train.unit_number] then local linked_to = chests_linked_to[train.unit_number].count if linked_to == chest_limit_outside_upgrades then @@ -1492,6 +1492,7 @@ local function on_built_entity(event) chests_linked_to[train.unit_number].count = linked_to + 1 chests_linked_to[train.unit_number][entity.unit_number] = true increased = true + goto continue end else