1
0
mirror of https://github.com/veden/Rampant.git synced 2025-03-17 20:58:35 +02:00

e1f61d1: Fixed crash when gates and walls didn't have resistance

property with add acid resistance to walls mod setting
This commit is contained in:
Aaron Veden 2023-01-15 12:04:31 -08:00
parent 4a72f7fb9a
commit 6864bd6a97
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
2 changed files with 23 additions and 18 deletions

View File

@ -44,6 +44,7 @@ Version: 3.2.0
- Fixed chunk scanning have a false negative for impassable chunks
- Fixed non-settler unit groups being created when player or base pheromone is effectively zero
- When the last player structure is destroyed on a chunk, the base pheromone is set to 0
- Fixed crash when walls or gates didn't have a resistence property with the add acid resistance to walls mod settings
Optimizations:
- Moved most constants out of global
- Removed new enemy variations setting

View File

@ -21,34 +21,38 @@ function vanillaUpdates.addWallAcidResistance()
for _,wall in pairs(walls) do
local foundAcid = false
for _,resistance in pairs(wall.resistances) do
if resistance.type == "acid" then
if resistance.percent < 60 then
resistance.percent = 60
if wall.resistances then
for _,resistance in pairs(wall.resistances) do
if resistance.type == "acid" then
if resistance.percent < 60 then
resistance.percent = 60
end
foundAcid = true
break
end
foundAcid = true
break
end
end
if not foundAcid then
wall.resistances[#wall.resistances+1] = {type="acid",percent=60}
if not foundAcid then
wall.resistances[#wall.resistances+1] = {type="acid",percent=60}
end
end
end
walls = data.raw["gate"]
for _,wall in pairs(walls) do
local foundAcid = false
for _,resistance in pairs(wall.resistances) do
if resistance.type == "acid" then
if resistance.percent < 60 then
resistance.percent = 60
if wall.resistances then
for _,resistance in pairs(wall.resistances) do
if resistance.type == "acid" then
if resistance.percent < 60 then
resistance.percent = 60
end
foundAcid = true
break
end
foundAcid = true
break
end
end
if not foundAcid then
wall.resistances[#wall.resistances+1] = {type="acid",percent=60}
if not foundAcid then
wall.resistances[#wall.resistances+1] = {type="acid",percent=60}
end
end
end
end