Make spectator markers a constant
This commit is contained in:
@@ -70,6 +70,16 @@ end
|
|||||||
---@type FactionStruct[]
|
---@type FactionStruct[]
|
||||||
Factions = DefineFactions()
|
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
|
-- Define UI Constants
|
||||||
-- ==================================================
|
-- ==================================================
|
||||||
@@ -77,12 +87,16 @@ Factions = DefineFactions()
|
|||||||
---GUI Component to display game time.
|
---GUI Component to display game time.
|
||||||
UI_GameTime = "s_select_41"
|
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"
|
UI_IconT1 = "s_health_42"
|
||||||
|
|
||||||
|
--- GUI Component to display Team 1 credits text.
|
||||||
UI_CreditsT1 = "s_health_41"
|
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"
|
UI_IconT2 = "s_shield_42"
|
||||||
|
|
||||||
|
---GUI Component to display Team 2 credits text.
|
||||||
UI_CreditsT2 = "s_shield_41"
|
UI_CreditsT2 = "s_shield_41"
|
||||||
|
|
||||||
---GUI Component to enable/disable population.
|
---GUI Component to enable/disable population.
|
||||||
@@ -90,16 +104,3 @@ UI_PlanetaryPop = "text_planetary_pop"
|
|||||||
|
|
||||||
---GUI Component to enable/disable tactical credits.
|
---GUI Component to enable/disable tactical credits.
|
||||||
UI_CreditsTactical = "text_credits_tactical"
|
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
|
|
||||||
|
|||||||
@@ -24,9 +24,15 @@ function SkirmishGameClass:New(gameMode)
|
|||||||
local function FindSpectators()
|
local function FindSpectators()
|
||||||
---@type SpectatorStruct[]
|
---@type SpectatorStruct[]
|
||||||
local spectators = {}
|
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
|
for k, marker in pairs(Find_All_Objects_Of_Type(spectatorMarker)) do
|
||||||
local playerWrapper = marker.Get_Owner()
|
local playerWrapper = marker.Get_Owner()
|
||||||
local playerId = playerWrapper.Get_ID()
|
local playerId = playerWrapper.Get_ID()
|
||||||
|
|||||||
Reference in New Issue
Block a user