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

fixed enemy force destroyed buildings not being unregistered

This commit is contained in:
Aaron Veden 2021-12-01 20:27:59 -08:00
parent cca1598de9
commit b33f0e674c
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
2 changed files with 31 additions and 29 deletions

View File

@ -38,6 +38,7 @@ Date: 23. 11. 2021
- Fixed unit groups spawned by factorio in noctural mode during the day would give points to the AI (Thanks Deathlymad)
- Added command timeout for unit groups in case a command hangs or unit groups are stuck gathering (Thank you Dimm2101)
- Corrected spelling of wonder command to wander command
- Fixed enemy structures destroyed by the enemy were not being unregistered from Rampants map
Framework:
- Fixed Rampant in-memory map visualization tool for debugging
- Added debug mod settings for showing enemy structures being upgraded in place

View File

@ -519,36 +519,8 @@ local function onDeath(event)
rallyUnits(chunk, map, tick)
end
end
elseif event.force and (event.force.name ~= "enemy") and
((entityType == "unit-spawner") or (entityType == "turret"))
then
if (entityType == "unit-spawner") then
map.points = map.points + RECOVER_NEST_COST
if universe.aiPointsPrintGainsToChat then
game.print(map.surface.name .. ": Points: +" .. RECOVER_NEST_COST .. ". [Nest Lost] Total: " .. string.format("%.2f", map.points))
end
else
map.points = map.points + RECOVER_WORM_COST
if universe.aiPointsPrintGainsToChat then
game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points))
end
end
unregisterEnemyBaseStructure(map, entity, event.damage_type)
if (chunk ~= -1) then
rallyUnits(chunk, map, tick)
if cause and cause.valid then
retreatUnits(chunk,
cause,
map,
tick,
RETREAT_SPAWNER_GRAB_RADIUS)
end
end
else
elseif map.drainPylons[entity.unit_number] then
local entityUnitNumber = entity.unit_number
local pair = map.drainPylons[entityUnitNumber]
if pair then
@ -568,6 +540,34 @@ local function onDeath(event)
end
end
end
else
if (event.force and (event.force.name ~= "enemy")) then
if (entityType == "unit-spawner") then
map.points = map.points + RECOVER_NEST_COST
if universe.aiPointsPrintGainsToChat then
game.print(map.surface.name .. ": Points: +" .. RECOVER_NEST_COST .. ". [Nest Lost] Total: " .. string.format("%.2f", map.points))
end
else
map.points = map.points + RECOVER_WORM_COST
if universe.aiPointsPrintGainsToChat then
game.print(map.surface.name .. ": Points: +" .. RECOVER_WORM_COST .. ". [Worm Lost] Total: " .. string.format("%.2f", map.points))
end
end
if (chunk ~= -1) then
rallyUnits(chunk, map, tick)
if cause and cause.valid then
retreatUnits(chunk,
cause,
map,
tick,
RETREAT_SPAWNER_GRAB_RADIUS)
end
end
end
unregisterEnemyBaseStructure(map, entity, event.damage_type)
end
elseif (entity.force.name ~= "enemy") then
@ -658,6 +658,7 @@ local function onEnemyBaseBuild(event)
chunk,
event.tick)
end
upgradeEntity(entity,
base.alignment,
map,