Arma Reforger Script API
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SCR_VotingElection Interface Reference

Election of specific type. More...

Inheritance diagram for SCR_VotingElection:
[legend]

Public Member Functions

override void SetVote (int playerID, int value=DEFAULT_VALUE)
 Set vote of given player.
 
override bool RemoveVote (int playerID)
 Remove vote of given player.
 
override bool RemoveValue (int value)
 Remove all votes for given value.
 
override bool IsMatching (EVotingType type, int value=DEFAULT_VALUE)
 Check if the voting is matching given params.
 
override bool Evaluate (out EVotingOutcome outcome)
 Evaluate if the voting can end.
 
override int GetWinner ()
 Get winner of the vote.
 
override int GetPlayerVote (int playerID)
 
override void Log ()
 
- Public Member Functions inherited from SCR_VotingBase
bool AddPlayerVotedServer (int playerID)
 A player has voted to approve (server only)
 
bool RemovePlayerVotedServer (int playerID)
 A player has voted to remove or abstain (server only)
 
void SetCurrentVoteCount (int currentVoteCount)
 Set the current amount of votes this vote has.
 
int GetCurrentVoteCount ()
 
int GetJoinServerVoteCooldown ()
 
int GetServerRuntimeIgnoreJoinServerCooldown ()
 
int GetVoteCooldownTime ()
 
bool HasCooldown ()
 
float GetLocalCooldownTimeStamp ()
 
void SetLocalCooldownTimeStamp (float newTimeStamp)
 Set the time stamp for cooldowns for this voting param[in] New Time stamp to set.
 
bool HasInitiatedVotingLocallyOnce ()
 
void SetHasInitiatedVotingLocallyOnce ()
 Set Has initiated voting locally at least once to true.
 
void SetVote (int playerID, int value=DEFAULT_VALUE)
 Set vote of given player.
 
bool RemoveVote (int playerID)
 Remove vote of given player.
 
bool RemoveValue (int value)
 Remove all votes for given value.
 
bool CanSendNotification (int value)
 Check if notification can be shown for this voting.
 
bool Evaluate (out EVotingOutcome outcome)
 Evaluate if the voting can end.
 
int GetWinner ()
 Get winner of the vote.
 
void OnVotingEnd (int value=DEFAULT_VALUE, int winner=DEFAULT_VALUE)
 Event called when the voting ends.
 
int GetPlayerVote (int playerID)
 
bool IsAvailable (int value, bool isOngoing)
 Check if the voting is available in the current world.
 
bool IsMatching (EVotingType type, int value=DEFAULT_VALUE)
 Check if the voting is matching given params.
 
void Log ()
 
string GetValueName (int value)
 Get name of the value.
 
EVotingType GetType ()
 Get voting type.
 
EVotingType GetValue ()
 Get voting value.
 
SCR_VotingUIInfo GetInfo ()
 Get voting UI representation.
 
float GetRemainingDuration ()
 
bool IsValuePlayerID ()
 Check if the voting is about player IDs.
 
void SetVoteLocal (int value)
 Save local vote.
 
void RemoveVoteLocal ()
 Remove local vote.
 
int GetLocalVote ()
 Get local vote.
 
void Update (float timeSlice)
 Periodically update the voting.
 
void InitFromTemplate (SCR_VotingBase template, int value, float remainingDuration)
 Initialise voting from given template.
 
int GetPlayerCount ()
 Get total player count of players that are valid to vote for the issue.
 
int GetVoteCountRequired ()
 Get total players needed to make sure the vote is successfull.
 

Protected Member Functions

void UpdateHighestValue ()
 
- Protected Member Functions inherited from SCR_VotingBase
bool EvaluateParticipation (int voteCount)
 

Protected Attributes

ref map< int, int > m_Votes = new map<int, int>()
 
int m_iHighestValue = DEFAULT_VALUE
 
int m_iHighestCount
 
- Protected Attributes inherited from SCR_VotingBase
EVotingType m_Type
 
bool m_bIsValuePlayerID
 
float m_fDuration
 
float m_fThreshold
 
float m_iMinParticipation
 
int m_iMinVotes
 
ref SCR_VotingUIInfo m_Info
 
int m_iJoinServerVoteCooldown
 
int m_iServerRuntimeIgnoreJoinServerCooldown
 
int m_iVoteCooldownTime
 
float m_fVoteCooldownTimeStamp = -1
 
bool m_bHasInitiatedVotingLocallyOnce
 
int m_iLocalValue = DEFAULT_VALUE
 
int m_iCurrentVoteCount
 
ref array< int > m_aPlayersVoted_Server = {}
 

Additional Inherited Members

- Static Public Attributes inherited from SCR_VotingBase
static const int DEFAULT_VALUE = -1
 

Detailed Description

Election of specific type.

Once it starts, players can vote for multiple values. The voting ends when proportion of votes for single value is larger than threshold, or if time expires. If the vote had enough participation, the value with the most votes wins, otherwise the vote fails.

Member Function Documentation

◆ Evaluate()

override bool SCR_VotingElection.Evaluate ( out EVotingOutcome  outcome)

Evaluate if the voting can end.

Parameters
[out]outcomeOutcome of the vote (used only when returned value is true)
Returns
True if it can end

Implements SCR_VotingBase.

◆ GetPlayerVote()

override int SCR_VotingElection.GetPlayerVote ( int  playerID)
Parameters
[in]playerID
Returns

Implements SCR_VotingBase.

◆ GetWinner()

override int SCR_VotingElection.GetWinner ( )

Get winner of the vote.

Returns
Winning value

Implements SCR_VotingBase.

◆ IsMatching()

override bool SCR_VotingElection.IsMatching ( EVotingType  type,
int  value = DEFAULT_VALUE 
)

Check if the voting is matching given params.

Parameters
[in]typeVoting type
[in]valueVoting value
Returns

Implements SCR_VotingBase.

◆ Log()

override void SCR_VotingElection.Log ( )

Implements SCR_VotingBase.

◆ RemoveValue()

override bool SCR_VotingElection.RemoveValue ( int  value)

Remove all votes for given value.

Parameters
[in]valueValue
Returns

Implements SCR_VotingBase.

◆ RemoveVote()

override bool SCR_VotingElection.RemoveVote ( int  playerID)

Remove vote of given player.

Parameters
[in]playerIDPlayer ID
Returns
True if the voting should be cancelled

Implements SCR_VotingBase.

◆ SetVote()

override void SCR_VotingElection.SetVote ( int  playerID,
int  value = DEFAULT_VALUE 
)

Set vote of given player.

Parameters
[in]playerIDPlayer ID
[in]valueCast vote

Implements SCR_VotingBase.

◆ UpdateHighestValue()

void SCR_VotingElection.UpdateHighestValue ( )
protected

Member Data Documentation

◆ m_iHighestCount

int SCR_VotingElection.m_iHighestCount
protected

◆ m_iHighestValue

int SCR_VotingElection.m_iHighestValue = DEFAULT_VALUE
protected

◆ m_Votes

ref map<int, int> SCR_VotingElection.m_Votes = new map<int, int>()
protected

The documentation for this interface was generated from the following file: