34 class EndGameAction : IScoringAction
36 [
Attribute(
"100", UIWidgets.EditBox,
"Scoring limit",
"")]
37 protected int m_iScoreLimit;
50 if (!gameMode.IsRunning())
53 gameMode.EndGameMode(endData);
62 int score = scoring.GetPlayerScore(playerId);
63 if (score < m_iScoreLimit)
76 int score = scoring.GetFactionScore(faction);
77 if (score < m_iScoreLimit)
80 int factionIndex =
GetGame().GetFactionManager().GetFactionIndex(faction);
90 [
Attribute(
"1", UIWidgets.EditBox,
"Kill score multiplier",
category:
"Scoring: Multipliers")]
91 protected int m_iKillScoreMultiplier;
93 [
Attribute(
"-1", UIWidgets.EditBox,
"Teamkill score multiplier",
category:
"Scoring: Multipliers")]
94 protected int m_iTeamKillScoreMultiplier;
96 [
Attribute(
"0", UIWidgets.EditBox,
"Death score multiplier",
category:
"Scoring: Multipliers")]
97 protected int m_iDeathScoreMultiplier;
99 [
Attribute(
"-1", UIWidgets.EditBox,
"Suicide score multiplier",
category:
"Scoring: Multipliers")]
100 protected int m_iSuicideScoreMultiplier;
102 [
Attribute(
"1", UIWidgets.EditBox,
"Objective score multiplier",
category:
"Scoring: Multipliers")]
103 protected int m_iObjectiveScoreMultiplier;
105 [
Attribute(
"", UIWidgets.Object,
"List of actions executed when score changes.",
category:
"Scoring: Actions")]
106 protected ref array<ref IScoringAction>
m_aActions;
110 override int GetScoreLimit()
112 foreach (IScoringAction scoringAction :
m_aActions)
114 EndGameAction possibleAction = EndGameAction.Cast(scoringAction);
116 return possibleAction.GetScoreLimit();
119 return super.GetScoreLimit();
125 int score = info.m_iKills * m_iKillScoreMultiplier +
126 info.m_iTeamKills * m_iTeamKillScoreMultiplier +
127 info.m_iDeaths * m_iDeathScoreMultiplier +
128 info.m_iSuicides * m_iSuicideScoreMultiplier +
129 info.m_iObjectives * m_iObjectiveScoreMultiplier;
139 protected override void OnPlayerKilled(
int playerId, IEntity playerEntity, IEntity killerEntity, notnull
Instigator killer)
141 super.OnPlayerKilled(playerId, playerEntity, killerEntity, killer);
146 if (killer.GetInstigatorType() !=
InstigatorType.INSTIGATOR_PLAYER)
149 int killerId = killer.GetInstigatorPlayerID();
152 if (playerId == killerId)
154 AddSuicide(playerId);
158 SCR_ChimeraCharacter playerEntityChar = SCR_ChimeraCharacter.Cast(playerEntity);
159 if (!playerEntityChar)
167 Faction factionKiller =
Faction.Cast(factionManager.GetPlayerFaction(killerId));
171 if (factionKiller.IsFactionFriendly(playerEntityChar.GetFaction()))
172 AddTeamKill(killerId);
180 super.OnGameModeEnd(
data);
185 protected override void OnPlayerScoreChanged(
int playerId,
SCR_ScoreInfo scoreInfo)
187 super.OnPlayerScoreChanged(playerId, scoreInfo);
191 action.OnPlayerScoreChanged(playerId,
this);
199 super.OnFactionScoreChanged(faction, scoreInfo);
203 action.OnFactionScoreChanged(faction,
this);