Skip to content

Commit

Permalink
Example setup for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Garanas committed Apr 27, 2024
1 parent 9db1b49 commit 2badd41
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lua/sim/score.lua
Expand Up @@ -325,15 +325,24 @@ local function GameOverScore()
Score.units[categoryName]['built'] = brain:GetBlueprintStat("Units_History", category)
Score.units[categoryName]['lost'] = brain:GetBlueprintStat("Units_Killed", category)
end

Score.blueprints = {}
local allStats = brain:GetUnitStats()
for _, unitId in unitIdsForAchievements do



local unitStats = allStats[unitId]
if unitStats then
if not unitStats['kills'] then unitStats['kills'] = 0 end
if not unitStats['built'] then unitStats['built'] = 0 end
if not unitStats['lost'] then unitStats['lost'] = 0 end
LOG(index, unitId, brain:GetBlueprintStat("Enemies_Killed", categories[unitId]), '->', unitStats['kills'])
LOG(index, unitId, brain:GetBlueprintStat("Units_History", categories[unitId]), '->', unitStats['built'])
LOG(index, unitId, brain:GetBlueprintStat("Units_History", categories[unitId]) - brain:GetBlueprintStat("Units_Active", categories[unitId]), '->', unitStats['lost'])

-- track the statistics for these specific units
unitStats['kills'] = brain:GetBlueprintStat("Enemies_Killed", categories[unitId])
unitStats['built'] = brain:GetBlueprintStat("Units_History", categories[unitId])
unitStats['lost'] = brain:GetBlueprintStat("Units_History", categories[unitId]) - brain:GetBlueprintStat("Units_Active", categories[unitId])

Score.blueprints[unitId] = unitStats
end
end
Expand Down

0 comments on commit 2badd41

Please sign in to comment.