4 [
Attribute(
desc:
"When true, only players on the same faction as target of the vote can vote.")]
5 protected bool m_bFactionSpecific;
8 protected static const int PLAYER_VOTE_KICK_DURATION = 300;
11 override void InitFromTemplate(
SCR_VotingBase template,
int value,
float remainingDuration)
13 super.InitFromTemplate(
template, value, remainingDuration);
16 m_bFactionSpecific = votingKickTemplate.isFactionSpecific();
23 bool isFactionSpecific()
25 return m_bFactionSpecific;
29 override bool IsAvailable(
int value,
bool isOngoing)
40 if (m_bFactionSpecific)
46 Faction targetFaction = factionManager.GetPlayerFaction(value);
48 if (targetFaction != playerFaction || !targetFaction)
61 return votingManager && votingManager.GetHostPlayerID() != value;
65 override int GetPlayerCount()
73 targetFaction = factionManager.GetPlayerFaction(
m_iValue);
75 if (m_bFactionSpecific && targetFaction)
81 array<int> players = {};
83 for (
int i = 0, count =
GetGame().GetPlayerManager().
GetPlayers(players); i < count; i++)
89 playerFaction = factionManager.GetPlayerFaction(players[i]);
90 if (targetFaction == playerFaction)
98 playerCount = super.GetPlayerCount() - 1;
101 return Math.Max(playerCount, m_iMinVotes);
105 override void OnVotingEnd(
int value = DEFAULT_VALUE,
int winner = DEFAULT_VALUE)
108 if (winner == DEFAULT_VALUE)