diff --git a/changelog.txt b/changelog.txt index 3415936..4a1a0a7 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 2.0.4 +Date: 2024-11-09 + Bugfixes: + - Fix another crash on surface deletion +--------------------------------------------------------------------------------------------------- Version: 2.0.3 Date: 2024-11-08 Bugfixes: diff --git a/control.lua b/control.lua index 07ffb04..5983680 100644 --- a/control.lua +++ b/control.lua @@ -132,13 +132,13 @@ end local function remove_surface_from_list(event) --Whenever a surface is renamed or deleted, move/remove all entities in/from the global table. - for force,_ in pairs(game.forces) do + for _,force in pairs(game.forces) do local index if event.new_name then - storage.ammo_entities[new_name.."_"..force.name] = table.deepcopy(storage.ammo_entities[old_name.."_"..force.name]) - index = old_name.."_"..force.name + storage.ammo_entities[event.new_name.."_"..force.name] = table.deepcopy(storage.ammo_entities[event.old_name.."_"..force.name]) + index = event.old_name.."_"..force.name elseif event.surface_index then - index = game.surfaces[surface_index].name.."_"..force.name + index = game.surfaces[event.surface_index].name.."_"..force.name end if index then diff --git a/info.json b/info.json index 7ee28eb..5146369 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "Gun_Turret_Alerts", - "version": "2.0.3", + "version": "2.0.4", "title": "Ammo Alerts", "author": "Wyrrrd", "factorio_version": "2.0",