Add TacticalKillStatsTable back and make it work for all players on your team / Spectator player shows T1/2 losses separately

This commit is contained in:
2026-03-15 17:04:33 -05:00
parent 770a42b841
commit d2f3974c96
6 changed files with 252 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ require("GameManager/SkirmishGameClass")
local DebugCounter = 0
---Debugging service rate.
local ServiceDebugRate = 5
local ServiceDebugRate = 10
---The Galactic Game manager.
---@type GalacticGameClass|nil
@@ -38,6 +38,13 @@ GameSpy_Game_Stats = {}
---@deprecated
GameSpy_Player_Stats = {}
---Tactical Frag/Death Stat Table for post-game.
---[frag|death][playerid][object_type][build_count, credits_spent, combat_power]
TacticalKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
-- ==================================================
-- Script State Functions
-- ==================================================
@@ -84,7 +91,31 @@ end
---Script debug servicing.
function ServiceDebug()
DebugMessage("%s -- TacticalKillStatsTable dump:", tostring(Script))
local fragEntry = TacticalKillStatsTable[FragIndex]
if fragEntry then
for playerId, unitTypes in pairs(fragEntry) do
for objType, data in pairs(unitTypes) do
DebugMessage(" FRAG player=%d type=%s kills=%d cp=%d cost=%d score=%d",
playerId, tostring(objType), data.kills, data.combat_power, data.build_cost, data.score_value)
end
end
else
DebugMessage(" FRAG (empty)")
end
local deathEntry = TacticalKillStatsTable[DeathIndex]
if deathEntry then
for playerId, unitTypes in pairs(deathEntry) do
for objType, data in pairs(unitTypes) do
DebugMessage(" DEATH player=%d type=%s kills=%d cp=%d cost=%d score=%d",
playerId, tostring(objType), data.kills, data.combat_power, data.build_cost, data.score_value)
end
end
else
DebugMessage(" DEATH (empty)")
end
end
-- ==================================================
@@ -95,6 +126,15 @@ end
function Reset_Tactical_Stats()
DebugMessage("%s -- In Reset_Tactical_Stats", tostring(Script))
TacticalKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
TacticalTeamKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
ResetTacticalRegistry()
end
@@ -394,6 +434,7 @@ function Init_Tactical(gameMode)
DebugMessage("%s -- Initializing Tactical %s rules.", tostring(Script), gameMode)
Reset_Tactical_Stats()
TacticalGame = TacticalGameClass:New(gameMode)
TacticalGame.KillStatsTable = TacticalKillStatsTable
GUIManager:InitTactical()
TextManager:RegisterView(TacticalGame.CombatFeed)
TextManager:SetCurrentView("combat_feed")
@@ -418,6 +459,7 @@ function Init_Skirmish(gameMode)
DebugMessage("%s -- Initializing Skirmish Tactical %s rules.", tostring(Script), gameMode)
Reset_Stats()
TacticalGame = SkirmishGameClass:New(gameMode)
TacticalGame.KillStatsTable = TacticalKillStatsTable
GUIManager:InitSkirmish(TacticalGame.IsLocalSpectator)
TextManager:RegisterView(TacticalGame.CombatFeed)
TextManager:SetCurrentView("combat_feed")