Compare commits
5 Commits
1be066c6ed
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 2412e451ca | |||
| 68449e1a78 | |||
| d2f3974c96 | |||
| 770a42b841 | |||
| 5d3867c3fd |
@@ -241,6 +241,7 @@ function GameObject.Is_Transport() end
|
||||
function GameObject.Can_Land_On_Planet(planet) end
|
||||
|
||||
---@public
|
||||
---@return GameObjectType
|
||||
function GameObject.Get_Game_Scoring_Type() end
|
||||
|
||||
---@public
|
||||
|
||||
@@ -39,3 +39,15 @@ function Add_Tutorial_Text(key, text, duration, r, g, b, a) end
|
||||
---Removes the specified text key from the tutorial text box.
|
||||
---@param key string The key to remove.
|
||||
function Remove_Tutorial_Text(key) end
|
||||
|
||||
-- ==================================================
|
||||
-- GameObjectType extensions
|
||||
-- ==================================================
|
||||
|
||||
---@class GameObjectType
|
||||
---A generic GameObjectType that represents a C++ GameObjectTypeClass
|
||||
local GameObjectType = {}
|
||||
---@public
|
||||
---Returns the display name for the object type.
|
||||
---@return string
|
||||
function GameObjectType.Get_Display_Name() end
|
||||
|
||||
@@ -18,6 +18,12 @@ TextManager = TutorialTextManager:New()
|
||||
---@type PlayerObject|nil
|
||||
LocalPlayer = nil
|
||||
|
||||
---Frag Index of Kill Stat Tables
|
||||
FragIndex = 1
|
||||
|
||||
---Death Index of Kill Stat Tables
|
||||
DeathIndex = 2
|
||||
|
||||
-- ==================================================
|
||||
-- Define Faction constants
|
||||
-- ==================================================
|
||||
@@ -35,7 +41,7 @@ function DefineFactions()
|
||||
RebelFaction.DisplayName = "Rebellion"
|
||||
RebelFaction.Color = ColorStruct:New(1, 0, 0, 1)
|
||||
RebelFaction.Icon = "I_ICON_SPECTATOR_REBEL.TGA"
|
||||
RebelFaction.LandStartUnitName = "Rebel_Infantry_Squad"
|
||||
RebelFaction.LandStartUnitName = "Rebel_Trooper_Team"
|
||||
RebelFaction.SpaceStartUnitName = "Rebel_X-Wing_Squadron"
|
||||
factions[RebelFaction.Name] = RebelFaction
|
||||
|
||||
@@ -46,7 +52,7 @@ function DefineFactions()
|
||||
EmpireFaction.DisplayName = "Empire"
|
||||
EmpireFaction.Color = ColorStruct:New(0, 1, 1, 1)
|
||||
EmpireFaction.Icon = "I_ICON_SPECTATOR_EMPIRE.TGA"
|
||||
EmpireFaction.LandStartUnitName = "Imperial_Stormtrooper_Squad"
|
||||
EmpireFaction.LandStartUnitName = "Stormtrooper_Team"
|
||||
EmpireFaction.SpaceStartUnitName = "TIE_Interceptor_Squadron_Container"
|
||||
factions[EmpireFaction.Name] = EmpireFaction
|
||||
|
||||
@@ -57,7 +63,7 @@ function DefineFactions()
|
||||
UnderworldFaction.DisplayName = "Zann Consortium"
|
||||
UnderworldFaction.Color = ColorStruct:New(1, 1, 0, 1)
|
||||
UnderworldFaction.Icon = "I_ICON_SPECTATOR_UNDERWORLD.TGA"
|
||||
UnderworldFaction.LandStartUnitName = "Underworld_Merc_Squad"
|
||||
UnderworldFaction.LandStartUnitName = "Underworld_Merc_Team"
|
||||
UnderworldFaction.SpaceStartUnitName = "StarViper_Team"
|
||||
factions[UnderworldFaction.Name] = UnderworldFaction
|
||||
|
||||
@@ -67,7 +73,7 @@ function DefineFactions()
|
||||
HuttFaction.DisplayName = "Hutt Cartel"
|
||||
HuttFaction.Color = ColorStruct:New(1, 0, 1, 1)
|
||||
HuttFaction.Icon = "I_ICON_SPECTATOR_HUTTS.TGA"
|
||||
HuttFaction.LandStartUnitName = "Hutt_Soldier_Squad"
|
||||
HuttFaction.LandStartUnitName = "Hutt_Soldier_Team"
|
||||
HuttFaction.SpaceStartUnitName = "V_Wing_Squadron_Container"
|
||||
factions[HuttFaction.Name] = HuttFaction
|
||||
|
||||
@@ -77,7 +83,7 @@ function DefineFactions()
|
||||
PirateFaction.DisplayName = "Pirates"
|
||||
PirateFaction.Color = ColorStruct:New(0, 1, 0, 1)
|
||||
PirateFaction.Icon = "I_ICON_SPECTATOR_PIRATES.TGA"
|
||||
PirateFaction.LandStartUnitName = "Pirate_Soldier_Squad"
|
||||
PirateFaction.LandStartUnitName = "Pirate_Trooper_Team"
|
||||
PirateFaction.SpaceStartUnitName = "Pirate_Fighter_Squadron"
|
||||
factions[PirateFaction.Name] = PirateFaction
|
||||
|
||||
@@ -122,3 +128,6 @@ UI_PlanetaryPop = "text_planetary_pop"
|
||||
|
||||
---GUI Component to enable/disable tactical credits.
|
||||
UI_CreditsTactical = "text_credits_tactical"
|
||||
|
||||
---GUI Component to enable/disable tactical tech.
|
||||
UI_TechTactical = "text_tactical_tech"
|
||||
|
||||
@@ -27,6 +27,7 @@ function GUIManager:InitSkirmish(isSpectator)
|
||||
|
||||
GUI_Component_Visibility(UI_PlanetaryPop, false)
|
||||
GUI_Component_Visibility(UI_CreditsTactical, false)
|
||||
GUI_Component_Visibility(UI_TechTactical, false)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,6 +58,7 @@ function GUIManager:Reset()
|
||||
|
||||
GUI_Component_Visibility(UI_PlanetaryPop, true)
|
||||
GUI_Component_Visibility(UI_CreditsTactical, true)
|
||||
GUI_Component_Visibility(UI_TechTactical, true)
|
||||
end
|
||||
|
||||
---Services Game Time display.
|
||||
@@ -91,7 +93,7 @@ function GUIManager:DisplayTeamCredits(team, credits, income)
|
||||
positiveText = ""
|
||||
end
|
||||
|
||||
local text = string.format("Team %d: $%d (%s%d)", team.Number, credits, positiveText, income)
|
||||
local text = string.format("Team %d: $ %d (%s%d)", team.Number, credits, positiveText, income)
|
||||
local icon = team.Faction.Icon
|
||||
local color = team.Faction.Color
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@ end
|
||||
---Displays unit built combat text.
|
||||
---@param unit UnitClass The built unit.
|
||||
function SkirmishGameClass:CombatTextUnitBuilt(unit)
|
||||
if not self.IsLocalSpectator then
|
||||
-- No Text feed for combatants
|
||||
return
|
||||
end
|
||||
|
||||
local owner = self.Players[unit.OwnerId]
|
||||
|
||||
if not owner then
|
||||
@@ -60,8 +65,8 @@ function SkirmishGameClass:CombatTextUnitBuilt(unit)
|
||||
end
|
||||
|
||||
local timeText = FormatTime(unit.BuildTime)
|
||||
local text = string.format("%s\t<T%d> [%s]: BUILT %s ($%d)", timeText, team.Number, owner.Name, unit.Name,
|
||||
unit.BuildCost)
|
||||
local text = string.format("%s [T%d %s]: BUILT %s ($ %d)", timeText, team.Number, team.Faction.DisplayName,
|
||||
unit.DisplayName, unit.BuildCost)
|
||||
local faction = Factions[owner.Faction]
|
||||
---@type ColorStruct
|
||||
local color
|
||||
@@ -79,47 +84,57 @@ end
|
||||
---Displays killed unit combat text.
|
||||
---@param unit UnitClass The killed unit.
|
||||
function SkirmishGameClass:CombatTextUnitKilled(unit)
|
||||
local owner = self.Players[unit.OwnerId]
|
||||
-- Right now, we don't really care about seeing killed units in the combat feed
|
||||
-- If we want it in the future, uncomment the lines below.
|
||||
return
|
||||
-- if not self.IsLocalSpectator then
|
||||
-- -- No Text feed for combatants
|
||||
-- return
|
||||
-- end
|
||||
|
||||
if not owner then
|
||||
return
|
||||
end
|
||||
-- local owner = self.Players[unit.OwnerId]
|
||||
|
||||
local killer = self.Players[unit.KillerId]
|
||||
local timeText = FormatTime(unit.DeathTime)
|
||||
-- if not owner then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
if not killer then
|
||||
local team = self.Teams[owner.TeamId]
|
||||
-- local killer = self.Players[unit.KillerId]
|
||||
-- local timeText = FormatTime(unit.DeathTime)
|
||||
|
||||
if not team then
|
||||
return
|
||||
end
|
||||
-- if not killer then
|
||||
-- local team = self.Teams[owner.TeamId]
|
||||
|
||||
local text = string.format("%s\t<T%d> [%s]: MISTAKES WERE MADE %s", timeText, team.Number, owner.Name, unit.Name)
|
||||
local color = ColorStruct:New(0.8, 0.8, 0.8, 1)
|
||||
-- if not team then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
self.CombatFeed:Append(text, -1, color)
|
||||
else
|
||||
local team = self.Teams[killer.TeamId]
|
||||
-- local text = string.format("%s\t<T%d> [%s]: MISTAKES WERE MADE %s", timeText, team.Number, owner.Name,
|
||||
-- unit.DisplayName)
|
||||
-- local color = ColorStruct:New(0.8, 0.8, 0.8, 1)
|
||||
|
||||
if not team then
|
||||
return
|
||||
end
|
||||
-- self.CombatFeed:Append(text, -1, color)
|
||||
-- else
|
||||
-- local team = self.Teams[killer.TeamId]
|
||||
|
||||
local text = string.format("%s\t<T%d> [%s]: KILLED %s (%s)", timeText, team.Number, killer.Name, unit.Name,
|
||||
owner.Name)
|
||||
local faction = Factions[killer.Faction]
|
||||
---@type ColorStruct
|
||||
local color = nil
|
||||
-- if not team then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
if faction then
|
||||
color = faction.Color
|
||||
else
|
||||
color = ColorStruct:New(1, 1, 1, 1)
|
||||
end
|
||||
-- local text = string.format("%s\t<T%d> [%s]: KILLED %s (%s)", timeText, team.Number, killer.Name, unit
|
||||
-- .DisplayName,
|
||||
-- owner.Name)
|
||||
-- local faction = Factions[killer.Faction]
|
||||
-- ---@type ColorStruct
|
||||
-- local color = nil
|
||||
|
||||
self.CombatFeed:Append(text, -1, color)
|
||||
end
|
||||
-- if faction then
|
||||
-- color = faction.Color
|
||||
-- else
|
||||
-- color = ColorStruct:New(1, 1, 1, 1)
|
||||
-- end
|
||||
|
||||
-- self.CombatFeed:Append(text, -1, color)
|
||||
-- end
|
||||
end
|
||||
|
||||
-- ==================================================
|
||||
@@ -140,6 +155,19 @@ function SkirmishGameClass:GetTeam(id)
|
||||
return self.Teams[id]
|
||||
end
|
||||
|
||||
---Gets the Team of the Player ID.
|
||||
---@param id integer Player ID.
|
||||
---@return TeamStruct|nil
|
||||
function SkirmishGameClass:GetTeamForPlayer(id)
|
||||
local player = self.Players[id]
|
||||
|
||||
if not player then
|
||||
return nil
|
||||
end
|
||||
|
||||
return self.Teams[player.TeamId]
|
||||
end
|
||||
|
||||
---Gets the Players for the Team ID.
|
||||
---@param id integer Team ID
|
||||
---@return PlayerClass[]
|
||||
@@ -188,6 +216,113 @@ function SkirmishGameClass:CalculateTeamTotalIncome(id)
|
||||
return totalIncome
|
||||
end
|
||||
|
||||
--- ==================================================
|
||||
--- Stat tables
|
||||
--- ==================================================
|
||||
|
||||
---Updates the Tactical Kill Stats Table with the killed object.
|
||||
---@param unit UnitClass The object that was killed.
|
||||
---@param killer PlayerObject The player that killed the object.
|
||||
function SkirmishGameClass:UpdateTacticalKillStatsTable(unit, killer)
|
||||
if not TestValid(killer) then
|
||||
return
|
||||
end
|
||||
|
||||
-- Update Frags
|
||||
local fragEntry = self.KillStatsTable[FragIndex]
|
||||
|
||||
if not fragEntry then
|
||||
fragEntry = {}
|
||||
self.KillStatsTable[FragIndex] = fragEntry
|
||||
end
|
||||
|
||||
local killerId = killer.Get_ID()
|
||||
|
||||
if self.IsLocalSpectator then
|
||||
local killerTeam = self:GetTeamForPlayer(killerId)
|
||||
|
||||
if killerTeam and killerTeam.Number == 1 then
|
||||
-- For the spectator, let's show Team 1's kills on the left side
|
||||
killerId = LocalPlayer.Get_ID()
|
||||
end
|
||||
end
|
||||
|
||||
local killerEntry = fragEntry[killerId]
|
||||
|
||||
if not killerEntry then
|
||||
killerEntry = {}
|
||||
fragEntry[killerId] = killerEntry
|
||||
end
|
||||
|
||||
local killerObjEntry = killerEntry[unit.GameObjectType]
|
||||
|
||||
if not killerObjEntry then
|
||||
killerObjEntry = {
|
||||
kills = 1,
|
||||
combat_power = unit.CombatRating,
|
||||
build_cost = unit.BuildCost,
|
||||
score_value = unit.ScoreValue
|
||||
}
|
||||
killerEntry[unit.GameObjectType] = killerObjEntry
|
||||
else
|
||||
killerObjEntry.kills = killerObjEntry.kills + 1
|
||||
killerObjEntry.combat_power = killerObjEntry.combat_power + unit.CombatRating
|
||||
killerObjEntry.build_cost = killerObjEntry.build_cost + unit.BuildCost
|
||||
killerObjEntry.score_value = killerObjEntry.score_value + unit.ScoreValue
|
||||
end
|
||||
|
||||
-- Update Deaths
|
||||
local deathEntry = self.KillStatsTable[DeathIndex]
|
||||
|
||||
if not deathEntry then
|
||||
deathEntry = {}
|
||||
self.KillStatsTable[DeathIndex] = deathEntry
|
||||
end
|
||||
|
||||
local ownerId = unit.OwnerId
|
||||
|
||||
if self.IsLocalSpectator then
|
||||
local ownerTeam = self:GetTeamForPlayer(ownerId)
|
||||
|
||||
if ownerTeam and ownerTeam.Number == 1 then
|
||||
-- For the spectator, let's show Team 1's lost units on the left side
|
||||
ownerId = LocalPlayer.Get_ID()
|
||||
end
|
||||
else
|
||||
-- Non-spectator: show all teammate deaths as local player's losses
|
||||
local ownerTeam = self:GetTeamForPlayer(ownerId)
|
||||
local localTeam = self:GetTeamForPlayer(LocalPlayer.Get_ID())
|
||||
|
||||
if ownerTeam and localTeam and ownerTeam.Id == localTeam.Id then
|
||||
ownerId = LocalPlayer.Get_ID()
|
||||
end
|
||||
end
|
||||
|
||||
local ownerEntry = deathEntry[ownerId]
|
||||
|
||||
if not ownerEntry then
|
||||
ownerEntry = {}
|
||||
deathEntry[ownerId] = ownerEntry
|
||||
end
|
||||
|
||||
local ownerObjEntry = ownerEntry[unit.GameObjectType]
|
||||
|
||||
if not ownerObjEntry then
|
||||
ownerObjEntry = {
|
||||
kills = 1,
|
||||
combat_power = unit.CombatRating,
|
||||
build_cost = unit.BuildCost,
|
||||
score_value = unit.ScoreValue
|
||||
}
|
||||
ownerEntry[unit.GameObjectType] = ownerObjEntry
|
||||
else
|
||||
ownerObjEntry.kills = ownerObjEntry.kills + 1
|
||||
ownerObjEntry.combat_power = ownerObjEntry.combat_power + unit.CombatRating
|
||||
ownerObjEntry.build_cost = ownerObjEntry.build_cost + unit.BuildCost
|
||||
ownerObjEntry.score_value = ownerObjEntry.score_value + unit.ScoreValue
|
||||
end
|
||||
end
|
||||
|
||||
-- ==================================================
|
||||
-- Private functions
|
||||
-- ==================================================
|
||||
|
||||
@@ -8,6 +8,7 @@ require("GameManager/TutorialTextFeed")
|
||||
---@field StartTime integer The start time.
|
||||
---@field Players PlayerClass[] The combatant players in this game.
|
||||
---@field CombatFeed TutorialTextFeed Text feed for unit builds and kills.
|
||||
---@field KillStatsTable table The engine-owned TacticalKillStatsTable reference, set from GameScoring.lua.
|
||||
TacticalGameClass = {}
|
||||
TacticalGameClass.__index = TacticalGameClass
|
||||
|
||||
@@ -104,6 +105,11 @@ function TacticalGameClass:CombatTextUnitBuilt(unit)
|
||||
return
|
||||
end
|
||||
|
||||
if not StringCompare(LocalPlayer.Get_Faction_Name(), owner.Faction) then
|
||||
-- Do not display combat feed for players on opposite factions
|
||||
return
|
||||
end
|
||||
|
||||
local timeText = FormatTime(unit.BuildTime)
|
||||
local text = string.format("%s\t[%s]: BUILT %s ($%d)", timeText, owner.Name, unit.Name, unit.BuildCost)
|
||||
local faction = Factions[owner.Faction]
|
||||
@@ -142,6 +148,7 @@ function TacticalGameClass:UnitKilled(gameObject, killer)
|
||||
|
||||
if killedUnit then
|
||||
killedUnit:SetDead(killer.Get_ID())
|
||||
self:UpdateTacticalKillStatsTable(killedUnit, killer)
|
||||
self:CombatTextUnitKilled(killedUnit)
|
||||
end
|
||||
end
|
||||
@@ -155,6 +162,11 @@ function TacticalGameClass:CombatTextUnitKilled(unit)
|
||||
return
|
||||
end
|
||||
|
||||
if not StringCompare(LocalPlayer.Get_Faction_Name(), owner.Faction) then
|
||||
-- Do not display combat feed for players on opposite factions
|
||||
return
|
||||
end
|
||||
|
||||
local killer = self.Players[unit.KillerId]
|
||||
local timeText = FormatTime(unit.DeathTime)
|
||||
|
||||
@@ -179,6 +191,84 @@ function TacticalGameClass:CombatTextUnitKilled(unit)
|
||||
end
|
||||
end
|
||||
|
||||
--- ==================================================
|
||||
--- Stat tables
|
||||
--- ==================================================
|
||||
|
||||
---Updates the Tactical Kill Stats Table with the killed object.
|
||||
---@param unit UnitClass The object that was killed.
|
||||
---@param killer PlayerObject The player that killed the object.
|
||||
function TacticalGameClass:UpdateTacticalKillStatsTable(unit, killer)
|
||||
if not TestValid(killer) then
|
||||
return
|
||||
end
|
||||
|
||||
-- Update Frags
|
||||
local fragEntry = self.KillStatsTable[FragIndex]
|
||||
|
||||
if not fragEntry then
|
||||
fragEntry = {}
|
||||
self.KillStatsTable[FragIndex] = fragEntry
|
||||
end
|
||||
|
||||
local killerId = killer.Get_ID()
|
||||
local killerEntry = fragEntry[killerId]
|
||||
|
||||
if not killerEntry then
|
||||
killerEntry = {}
|
||||
fragEntry[killerId] = killerEntry
|
||||
end
|
||||
|
||||
local killerObjEntry = killerEntry[unit.GameObjectType]
|
||||
|
||||
if not killerObjEntry then
|
||||
killerObjEntry = {
|
||||
kills = 1,
|
||||
combat_power = unit.CombatRating,
|
||||
build_cost = unit.BuildCost,
|
||||
score_value = unit.ScoreValue
|
||||
}
|
||||
killerEntry[unit.GameObjectType] = killerObjEntry
|
||||
else
|
||||
killerObjEntry.kills = killerObjEntry.kills + 1
|
||||
killerObjEntry.combat_power = killerObjEntry.combat_power + unit.CombatRating
|
||||
killerObjEntry.build_cost = killerObjEntry.build_cost + unit.BuildCost
|
||||
killerObjEntry.score_value = killerObjEntry.score_value + unit.ScoreValue
|
||||
end
|
||||
|
||||
-- Update Deaths
|
||||
local deathEntry = self.KillStatsTable[DeathIndex]
|
||||
|
||||
if not deathEntry then
|
||||
deathEntry = {}
|
||||
self.KillStatsTable[DeathIndex] = deathEntry
|
||||
end
|
||||
|
||||
local ownerEntry = deathEntry[unit.OwnerId]
|
||||
|
||||
if not ownerEntry then
|
||||
ownerEntry = {}
|
||||
deathEntry[unit.OwnerId] = ownerEntry
|
||||
end
|
||||
|
||||
local ownerObjEntry = ownerEntry[unit.GameObjectType]
|
||||
|
||||
if not ownerObjEntry then
|
||||
ownerObjEntry = {
|
||||
kills = 1,
|
||||
combat_power = unit.CombatRating,
|
||||
build_cost = unit.BuildCost,
|
||||
score_value = unit.ScoreValue
|
||||
}
|
||||
ownerEntry[unit.GameObjectType] = ownerObjEntry
|
||||
else
|
||||
ownerObjEntry.kills = ownerObjEntry.kills + 1
|
||||
ownerObjEntry.combat_power = ownerObjEntry.combat_power + unit.CombatRating
|
||||
ownerObjEntry.build_cost = ownerObjEntry.build_cost + unit.BuildCost
|
||||
ownerObjEntry.score_value = ownerObjEntry.score_value + unit.ScoreValue
|
||||
end
|
||||
end
|
||||
|
||||
-- ==================================================
|
||||
-- Private functions
|
||||
-- ==================================================
|
||||
|
||||
@@ -2,9 +2,11 @@ require("PGBase")
|
||||
|
||||
---@class UnitClass
|
||||
---@field Name string Unit name.
|
||||
---@field DisplayName string The localized display name.
|
||||
---@field OwnerId integer Owner Player ID.
|
||||
---@field BuildCost integer Tactical build cost.
|
||||
---@field CombatRating integer AI combat power rating.
|
||||
---@field ScoreValue integer Score cost credits.
|
||||
---@field BuildTime number Game time that this unit was built.
|
||||
---@field AliveTime number Game time that this unit became "alive".
|
||||
---@field DeathTime number Game time that this unit was killed.
|
||||
@@ -15,15 +17,17 @@ UnitClass = {}
|
||||
UnitClass.__index = UnitClass
|
||||
|
||||
---Constructs a new Unit object.
|
||||
---@param objectType table FoC GameObjectTypeWrapper object
|
||||
---@param objectType GameObjectType FoC GameObjectTypeWrapper object
|
||||
---@param playerId integer The Owner Player ID
|
||||
function UnitClass:New(objectType, playerId)
|
||||
local self = setmetatable({}, UnitClass)
|
||||
|
||||
self.Name = objectType.Get_Name()
|
||||
self.DisplayName = objectType.Get_Display_Name()
|
||||
self.OwnerId = playerId
|
||||
self.BuildCost = objectType.Get_Tactical_Build_Cost()
|
||||
self.CombatRating = objectType.Get_Combat_Rating()
|
||||
self.ScoreValue = objectType.Get_Score_Cost_Credits()
|
||||
self.BuildTime = GetCurrentTime()
|
||||
self.AliveTime = -1
|
||||
self.DeathTime = -1
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -123,6 +163,8 @@ function Game_Mode_Starting_Event(mode, map)
|
||||
|
||||
LocalPlayer = Find_Player("local")
|
||||
|
||||
DebugMessage("Local Player: %s (%d)", LocalPlayer.Get_Name(), LocalPlayer.Get_ID())
|
||||
|
||||
if StringCompare(mode, "Galactic") then
|
||||
-- Galactic Campaign
|
||||
Init_Galactic()
|
||||
@@ -394,6 +436,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 +461,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")
|
||||
|
||||
Reference in New Issue
Block a user