Restoring stat tables WIP

This commit is contained in:
2026-03-20 09:49:44 -05:00
parent 68449e1a78
commit a5fb7e950a
6 changed files with 437 additions and 30 deletions

View File

@@ -38,6 +38,10 @@ GameSpy_Game_Stats = {}
---@deprecated
GameSpy_Player_Stats = {}
---Tactical Build Stat Table for post-game.
---[playerid][planetname][object_type][build_count, credits_spent, combat_power]
TacticalBuildStatsTable = {}
---Tactical Frag/Death Stat Table for post-game.
---[frag|death][playerid][object_type][build_count, credits_spent, combat_power]
TacticalKillStatsTable = {
@@ -45,6 +49,32 @@ TacticalKillStatsTable = {
[DeathIndex] = {}
}
---Tactical Team Frag/Death Stat Table for post-game.
---[frag|death][playerid][object_type][build_count, credits_spent, combat_power]
TacticalTeamKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
---Galactic Build Stat Table for post-game.
---[playerid][planetname][object_type][build_count, credits_spent, combat_power]
GalacticBuildStatsTable = {}
---Galactic Frag/Death Stat Table for post-game.
---[frag|death][playerid][object_type][build_count, credits_spent, combat_power]
GalacticKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
---Galactic Neutralized Hero Table for post-game.
---[playerid][object_type][neutralized_count]
GalacticNeutralizedTable = {}
---Galactic Planet Conquest Table for post-game.
---[playerid][planet_type][sacked_count, lost_count]
GalacticConquestTable = {}
-- ==================================================
-- Script State Functions
-- ==================================================
@@ -126,6 +156,7 @@ end
function Reset_Tactical_Stats()
DebugMessage("%s -- In Reset_Tactical_Stats", tostring(Script))
TacticalBuildStatsTable = {}
TacticalKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
@@ -143,6 +174,14 @@ function Reset_Stats()
DebugMessage("%s -- In Reset_Stats", tostring(Script))
Reset_Tactical_Stats()
GalacticBuildStatsTable {}
GalacticKillStatsTable = {
[FragIndex] = {},
[DeathIndex] = {}
}
GalacticNeutralizedTable = {}
GalacticConquestTable = {}
end
---A dirty hack to reset tactical script registry values
@@ -257,18 +296,25 @@ end
---@param object GameObject|GameObjectType FoC GameObjectWrapper or GameObjectTypeWrapper of the object that was just created.
function Galactic_Production_End_Event(planet, object)
local typeName = ""
local type = nil
if object.Get_Type == nil then
-- object must be a GameObjectTypeWrapper not a GameObjectWrapper if it doesn't
-- have a Get_Type function.
-- object must be a GameObjectTypeWrapper if it doesn't have a Get_Type function.
---@cast object GameObjectType
type = object
typeName = object.Get_Name()
else
-- object points to the GameObjectWrapper that was just created.
type = object.Get_Type()
typeName = object.Get_Type().Get_Name()
end
DebugMessage("%s -- Galactic production of %s ended at %s.", tostring(Script), typeName,
planet.Get_Type().Get_Name())
if GalacticGame then
GalacticGame:UnitBuilt(type, planet.Get_Owner(), planet)
end
end
---This event is triggered when a unit is destroyed in galactic mode.
@@ -276,6 +322,14 @@ end
---@param killer PlayerObject FoC PlayerWrapper object that killed the object.
function Galactic_Unit_Destroyed_Event(object, killer)
DebugMessage("%s -- Object %s killed by %s.", tostring(Script), object.Get_Type().Get_Name(), killer.Get_Name())
if GalacticGame then
GalacticGame:UnitKilled(object, killer)
end
if TacticalGame then
TacticalGame:UnitKilled(object, killer)
end
end
---This event is triggered when the level of a starbase changes.
@@ -434,10 +488,10 @@ function Init_Tactical(gameMode)
DebugMessage("%s -- Initializing Tactical %s rules.", tostring(Script), gameMode)
Reset_Tactical_Stats()
TacticalGame = TacticalGameClass:New(gameMode)
TacticalGame.KillStatsTable = TacticalKillStatsTable
TacticalGame.KillStatsTable = TacticalTeamKillStatsTable
GUIManager:InitTactical()
TextManager:RegisterView(TacticalGame.CombatFeed)
TextManager:SetCurrentView("combat_feed")
--TextManager:RegisterView(TacticalGame.CombatFeed)
--TextManager:SetCurrentView("combat_feed")
end
---Resets Tactical mode.