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

FACTO-108: Fixed wasps and drones deaths affecting AI stats

This commit is contained in:
Aaron Veden 2022-04-19 19:54:15 -07:00
parent 9487323843
commit 1fdde02a54
No known key found for this signature in database
GPG Key ID: FF5990B1C6DD3F84
4 changed files with 33 additions and 15 deletions

View File

@ -436,8 +436,8 @@ end
function upgrade.attempt(universe)
local starting = global.version
if not global.version or global.version < 301 then
global.version = 301
if not global.version or global.version < 302 then
global.version = 302
if not universe then
universe = {}

View File

@ -36,7 +36,7 @@ Version: 3.0.0
- Fixed base recycling on invalid surfaces
- Fixed base chunk count not being decremented when chunks are removed
- Fixed base iterator processing being nil
- Fixed spawner spawns and wasp drones being included in kill stats
- Fixed spawner spawns and wasp drones being included in kill stats, death pheromones, and AI stats
---------------------------------------------------------------------------------------------------
Version: 2.2.0

View File

@ -409,11 +409,13 @@ local function onDeath(event)
end
local artilleryBlast = (cause and ((cause.type == "artillery-wagon") or (cause.type == "artillery-turret")))
if entityType == "unit" then
if (entityType == "unit") and not universe.entitySkipCountLookup[entity.name] then
if base then
base.lostEnemyUnits = base.lostEnemyUnits + 1
base.damagedBy[damageTypeName] = (base.damagedBy[damageTypeName] or 0) + 0.01
base.deathEvents = base.deathEvents + 1
if damageTypeName then
base.damagedBy[damageTypeName] = (base.damagedBy[damageTypeName] or 0) + 0.01
base.deathEvents = base.deathEvents + 1
end
base.unitPoints = base.unitPoints - UNIT_DEATH_POINT_COST
if universe.aiPointsPrintSpendingToChat then
game.print(map.surface.name .. ": Points: -" .. UNIT_DEATH_POINT_COST .. ". [Unit Lost] Total: " .. string.format("%.2f", base.unitPoints))

View File

@ -517,6 +517,15 @@ function baseUtils.createBase(map, chunk, tick)
return base
end
local function isMember(lst, x)
for _,l in pairs(lst) do
if l == x then
return true
end
end
return false
end
function baseUtils.rebuildNativeTables(universe, rg)
local alignmentSet = {}
universe.evolutionTableAlignment = alignmentSet
@ -534,8 +543,10 @@ function baseUtils.rebuildNativeTables(universe, rg)
universe.buildingHiveTypeLookup = buildingHiveTypeLookup
local proxyEntityLookup = {}
universe.proxyEntityLookup = proxyEntityLookup
local vanillaEntityLookups = {}
universe.vanillaEntityTypeLookup = vanillaEntityLookups
local vanillaEntityLookup = {}
universe.vanillaEntityTypeLookup = vanillaEntityLookup
local entitySkipCountLookup = {}
universe.entitySkipCountLookup = entitySkipCountLookup
buildingHiveTypeLookup["biter-spawner"] = "biter-spawner"
buildingHiveTypeLookup["spitter-spawner"] = "spitter-spawner"
@ -544,12 +555,12 @@ function baseUtils.rebuildNativeTables(universe, rg)
buildingHiveTypeLookup["big-worm-turret"] = "turret"
buildingHiveTypeLookup["behemoth-worm-turret"] = "turret"
vanillaEntityLookups["biter-spawner"] = true
vanillaEntityLookups["spitter-spawner"] = true
vanillaEntityLookups["small-worm-turret"] = true
vanillaEntityLookups["medium-worm-turret"] = true
vanillaEntityLookups["big-worm-turret"] = true
vanillaEntityLookups["behemoth-worm-turret"] = true
vanillaEntityLookup["biter-spawner"] = true
vanillaEntityLookup["spitter-spawner"] = true
vanillaEntityLookup["small-worm-turret"] = true
vanillaEntityLookup["medium-worm-turret"] = true
vanillaEntityLookup["big-worm-turret"] = true
vanillaEntityLookup["behemoth-worm-turret"] = true
for i=1,#FACTION_SET do
local faction = FACTION_SET[i]
@ -620,6 +631,12 @@ function baseUtils.rebuildNativeTables(universe, rg)
buildingHiveTypeLookup[proxyEntity] = building.type
end
variationSet[#variationSet+1] = entry
for _,unit in pairs(faction.units) do
if isMember(unit.attributes, "skipKillCount") then
local name = faction.type .. "-" .. unit.name .. "-v" .. v .. "-t" .. t .. "-rampant"
universe.entitySkipCountLookup[name] = true
end
end
end
local buildingAcceptRate = building.acceptRate
@ -640,7 +657,6 @@ function baseUtils.rebuildNativeTables(universe, rg)
building.type
}
end
end
end
end