Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/maps/scripts/CaptureTheRelic.js
Show All 32 Lines | Trigger.prototype.CheckCaptureTheRelicVictory = function(data) | ||||
let cmpIdentity = Engine.QueryInterface(data.entity, IID_Identity); | let cmpIdentity = Engine.QueryInterface(data.entity, IID_Identity); | ||||
if (!cmpIdentity || !cmpIdentity.HasClass("Relic") || data.from == INVALID_PLAYER) | if (!cmpIdentity || !cmpIdentity.HasClass("Relic") || data.from == INVALID_PLAYER) | ||||
return; | return; | ||||
--this.playerRelicsCount[data.from]; | --this.playerRelicsCount[data.from]; | ||||
if (data.to == -1) | if (data.to == -1) | ||||
{ | { | ||||
warn("Relic entity " + data.entity + " has been destroyed"); | warn("Relic entity " + data.entity + " has been destroyed."); | ||||
this.relics.splice(this.relics.indexOf(data.entity), 1); | this.relics.splice(this.relics.indexOf(data.entity), 1); | ||||
} | } | ||||
else | else | ||||
++this.playerRelicsCount[data.to]; | ++this.playerRelicsCount[data.to]; | ||||
this.DeleteCaptureTheRelicVictoryMessages(); | this.DeleteCaptureTheRelicVictoryMessages(); | ||||
this.CheckCaptureTheRelicCountdown(); | this.CheckCaptureTheRelicCountdown(); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | for (let playerID = 1; playerID < TriggerHelper.GetNumberOfPlayers(); ++playerID) | ||||
if (cmpPlayer.GetState() == "won") | if (cmpPlayer.GetState() == "won") | ||||
return; | return; | ||||
if (winningPlayers.indexOf(playerID) == -1) | if (winningPlayers.indexOf(playerID) == -1) | ||||
others.push(playerID); | others.push(playerID); | ||||
} | } | ||||
let cmpPlayer = QueryOwnerInterface(this.relics[0], IID_Player); | let cmpPlayer = QueryOwnerInterface(this.relics[0], IID_Player); | ||||
if (!cmpPlayer) | |||||
{ | |||||
warn("Relic entity " + this.relics[0] + " has no owner."); | |||||
this.relics.splice(0, 1); | |||||
this.CheckCaptureTheRelicCountdown(); | |||||
return; | |||||
} | |||||
let cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager); | let cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager); | ||||
let captureTheRelicDuration = cmpEndGameManager.GetGameSettings().relicDuration; | let captureTheRelicDuration = cmpEndGameManager.GetGameSettings().relicDuration; | ||||
let isTeam = winningPlayers.length > 1; | let isTeam = winningPlayers.length > 1; | ||||
this.ownRelicsVictoryMessage = cmpGuiInterface.AddTimeNotification({ | this.ownRelicsVictoryMessage = cmpGuiInterface.AddTimeNotification({ | ||||
"message": isTeam ? | "message": isTeam ? | ||||
markForTranslation("%(_player_)s and their allies have captured all relics and will win in %(time)s.") : | markForTranslation("%(_player_)s and their allies have captured all relics and will win in %(time)s.") : | ||||
markForTranslation("%(_player_)s has captured all relics and will win in %(time)s."), | markForTranslation("%(_player_)s has captured all relics and will win in %(time)s."), | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator