diff --git a/Data/Scripts/Miscellaneous/GameManager/Constants.lua b/Data/Scripts/Miscellaneous/GameManager/Constants.lua index dfc01ca..a5b7f94 100644 --- a/Data/Scripts/Miscellaneous/GameManager/Constants.lua +++ b/Data/Scripts/Miscellaneous/GameManager/Constants.lua @@ -70,6 +70,16 @@ end ---@type FactionStruct[] Factions = DefineFactions() +-- ================================================== +-- Define Spectator Constants +-- ================================================== + +---Space marker used to identify the spectator player. +Spectator_Marker_Space = "Spectator_Reveal_Marker" + +---Land marker used to identify the spectator player. +Spectator_Marker_Land = "Spectator_Reveal_Marker_Land" + -- ================================================== -- Define UI Constants -- ================================================== @@ -77,12 +87,16 @@ Factions = DefineFactions() ---GUI Component to display game time. UI_GameTime = "s_select_41" ----GUI Components to display Team 1 credits. +---GUI Component to display Team 1 faction icon. UI_IconT1 = "s_health_42" + +--- GUI Component to display Team 1 credits text. UI_CreditsT1 = "s_health_41" ----GUI Component to display Team 2 credits. +---GUI Component to display Team 2 faction icon. UI_IconT2 = "s_shield_42" + +---GUI Component to display Team 2 credits text. UI_CreditsT2 = "s_shield_41" ---GUI Component to enable/disable population. @@ -90,16 +104,3 @@ UI_PlanetaryPop = "text_planetary_pop" ---GUI Component to enable/disable tactical credits. UI_CreditsTactical = "text_credits_tactical" - ----Gets the specator marker for the game mode. ----@param gameMode string Game mode. ----@return string|nil -function GetSpectatorMarkerName(gameMode) - if StringCompare(gameMode, "Space") then - return "Spectator_Reveal_Marker" - elseif StringCompare(gameMode, "Land") then - return "Spectator_Reveal_Marker_Land" - end - - return nil -end diff --git a/Data/Scripts/Miscellaneous/GameManager/SkirmishGameClass.lua b/Data/Scripts/Miscellaneous/GameManager/SkirmishGameClass.lua index 76d5f34..35ed712 100644 --- a/Data/Scripts/Miscellaneous/GameManager/SkirmishGameClass.lua +++ b/Data/Scripts/Miscellaneous/GameManager/SkirmishGameClass.lua @@ -24,9 +24,15 @@ function SkirmishGameClass:New(gameMode) local function FindSpectators() ---@type SpectatorStruct[] local spectators = {} - local spectatorMarker = GetSpectatorMarkerName(gameMode) + local spectatorMarker = nil - if spectatorMarker ~= nil then + if StringCompare(gameMode, "Space") then + spectatorMarker = Spectator_Marker_Space + elseif StringCompare(gameMode, "Land") then + spectatorMarker = Spectator_Marker_Land + end + + if spectatorMarker then for k, marker in pairs(Find_All_Objects_Of_Type(spectatorMarker)) do local playerWrapper = marker.Get_Owner() local playerId = playerWrapper.Get_ID()