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

Base class for voting types. More...

Inheritance diagram for SCR_VotingBase:
[legend]

Public Member Functions

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.
 

Static Public Attributes

static const int DEFAULT_VALUE = -1
 

Protected Member Functions

bool EvaluateParticipation (int voteCount)
 

Protected Attributes

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 = {}
 

Detailed Description

Base class for voting types.

Do not expose objects of this class outside of SCR_VotingManagerComponent! Other systems should always go through the manager.

Member Function Documentation

◆ AddPlayerVotedServer()

bool SCR_VotingBase.AddPlayerVotedServer ( int  playerID)

A player has voted to approve (server only)

Parameters
[in]playerIDId of player who voted
Returns
True if player had not yet voted to approve

◆ CanSendNotification()

bool SCR_VotingBase.CanSendNotification ( int  value)

Check if notification can be shown for this voting.

Parameters
[in]valueVoting value
Returns
True if can send notification for this voting type

Implemented in SCR_VotingEditorIn, and SCR_VotingEditorOut.

◆ Evaluate()

bool SCR_VotingBase.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

Implemented in SCR_VotingReferendum, SCR_VotingElection, SCR_VotingEditorIn, and SCR_VotingEditorWithdraw.

◆ EvaluateParticipation()

bool SCR_VotingBase.EvaluateParticipation ( int  voteCount)
protected

◆ GetCurrentVoteCount()

int SCR_VotingBase.GetCurrentVoteCount ( )
Returns
Current total votes the vote has received

◆ GetInfo()

SCR_VotingUIInfo SCR_VotingBase.GetInfo ( )

Get voting UI representation.

Returns
UI info

◆ GetJoinServerVoteCooldown()

int SCR_VotingBase.GetJoinServerVoteCooldown ( )
Returns
The voting delay cooldown when a player joins the server. How long

◆ GetLocalCooldownTimeStamp()

float SCR_VotingBase.GetLocalCooldownTimeStamp ( )
Returns
Get the last cooldown (Either when joining server or last voted)

◆ GetLocalVote()

int SCR_VotingBase.GetLocalVote ( )

Get local vote.

It is purely informative and does not affect voting outcome!

Returns
Voted value

◆ GetPlayerCount()

int SCR_VotingBase.GetPlayerCount ( )

Get total player count of players that are valid to vote for the issue.

Returns
Total count

Implemented in SCR_VotingEditorOut, and SCR_VotingKick.

◆ GetPlayerVote()

int SCR_VotingBase.GetPlayerVote ( int  playerID)
Parameters
[in]playerID
Returns

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ GetRemainingDuration()

float SCR_VotingBase.GetRemainingDuration ( )
Returns
Remaining time of the voting in seconds

◆ GetServerRuntimeIgnoreJoinServerCooldown()

int SCR_VotingBase.GetServerRuntimeIgnoreJoinServerCooldown ( )
Returns
Get the server vote delay ignore time. It will not set a server vote delay time when the player joins if the server has started less seconds ago than this

◆ GetType()

EVotingType SCR_VotingBase.GetType ( )

Get voting type.

Returns
Type

◆ GetValue()

EVotingType SCR_VotingBase.GetValue ( )

Get voting value.

Applicable only if the voting targets specific value, e.g., is referendum about certain outcome.

Returns
Value

Implemented in SCR_VotingReferendum.

◆ GetValueName()

string SCR_VotingBase.GetValueName ( int  value)

Get name of the value.

Parameters
[in]value
Returns
Value name

◆ GetVoteCooldownTime()

int SCR_VotingBase.GetVoteCooldownTime ( )
Returns
Get the cooldown amount between voting

◆ GetVoteCountRequired()

int SCR_VotingBase.GetVoteCountRequired ( )

Get total players needed to make sure the vote is successfull.

Returns
Total votes needed

◆ GetWinner()

int SCR_VotingBase.GetWinner ( )

Get winner of the vote.

Returns
Winning value

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ HasCooldown()

bool SCR_VotingBase.HasCooldown ( )
Returns
Return if the Vote has a cooldown set. Will use the join cooldown if not yet initiated voting

◆ HasInitiatedVotingLocallyOnce()

bool SCR_VotingBase.HasInitiatedVotingLocallyOnce ( )
Returns
True if a player has initiated voted locally at least once for this vote

◆ InitFromTemplate()

void SCR_VotingBase.InitFromTemplate ( SCR_VotingBase  template,
int  value,
float  remainingDuration 
)

Initialise voting from given template.

Parameters
[in]templateSource template
[in]valueTarget value
[in]remainingDurationRemaining time until the voting ends in seconds (-1 to use default)

Implemented in SCR_VotingReferendum, SCR_VotingEditorIn, and SCR_VotingKick.

◆ IsAvailable()

bool SCR_VotingBase.IsAvailable ( int  value,
bool  isOngoing 
)

Check if the voting is available in the current world.

Parameters
[in]valuePotential voting value
[in]isOngoingTrue if the voting was already initiated
Returns
True when available

Implemented in SCR_VotingAdmin, SCR_VotingAutoKick, SCR_VotingEditorIn, SCR_VotingEditorOut, SCR_VotingEditorWithdraw, and SCR_VotingKick.

◆ IsMatching()

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

Check if the voting is matching given params.

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

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ IsValuePlayerID()

bool SCR_VotingBase.IsValuePlayerID ( )

Check if the voting is about player IDs.

Returns
True when it's about player IDs

◆ Log()

void SCR_VotingBase.Log ( )

◆ OnVotingEnd()

void SCR_VotingBase.OnVotingEnd ( int  value = DEFAULT_VALUE,
int  winner = DEFAULT_VALUE 
)

Event called when the voting ends.

Parameters
[in]valueVoting value
[in]winnerWinning value

Implemented in SCR_VotingAdmin, SCR_VotingEditorIn, SCR_VotingEditorOut, SCR_VotingEditorWithdraw, and SCR_VotingKick.

◆ RemovePlayerVotedServer()

bool SCR_VotingBase.RemovePlayerVotedServer ( int  playerID)

A player has voted to remove or abstain (server only)

Parameters
[in]playerIDId of player who voted to remove or abstain
Returns
True if player had previously voted to approve and the vote was removed

◆ RemoveValue()

bool SCR_VotingBase.RemoveValue ( int  value)

Remove all votes for given value.

Parameters
[in]valueValue
Returns

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ RemoveVote()

bool SCR_VotingBase.RemoveVote ( int  playerID)

Remove vote of given player.

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

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ RemoveVoteLocal()

void SCR_VotingBase.RemoveVoteLocal ( )

Remove local vote.

It is purely informative and does not affect voting outcome!

◆ SetCurrentVoteCount()

void SCR_VotingBase.SetCurrentVoteCount ( int  currentVoteCount)

Set the current amount of votes this vote has.

Parameters
[in]currentVoteCountNew current vote amount

◆ SetHasInitiatedVotingLocallyOnce()

void SCR_VotingBase.SetHasInitiatedVotingLocallyOnce ( )

Set Has initiated voting locally at least once to true.

◆ SetLocalCooldownTimeStamp()

void SCR_VotingBase.SetLocalCooldownTimeStamp ( float  newTimeStamp)

Set the time stamp for cooldowns for this voting param[in] New Time stamp to set.

◆ SetVote()

void SCR_VotingBase.SetVote ( int  playerID,
int  value = DEFAULT_VALUE 
)

Set vote of given player.

Parameters
[in]playerIDPlayer ID
[in]valueCast vote

Implemented in SCR_VotingReferendum, and SCR_VotingElection.

◆ SetVoteLocal()

void SCR_VotingBase.SetVoteLocal ( int  value)

Save local vote.

It's purely informative, does not affect voting outcome!

Parameters
[in]valueVoted value

◆ Update()

void SCR_VotingBase.Update ( float  timeSlice)

Periodically update the voting.

Parameters
[in]timeSliceTime since the last update

Member Data Documentation

◆ DEFAULT_VALUE

const int SCR_VotingBase.DEFAULT_VALUE = -1
static

◆ m_aPlayersVoted_Server

ref array<int> SCR_VotingBase.m_aPlayersVoted_Server = {}
protected

◆ m_bHasInitiatedVotingLocallyOnce

bool SCR_VotingBase.m_bHasInitiatedVotingLocallyOnce
protected

◆ m_bIsValuePlayerID

bool SCR_VotingBase.m_bIsValuePlayerID
protected

◆ m_fDuration

float SCR_VotingBase.m_fDuration
protected

◆ m_fThreshold

float SCR_VotingBase.m_fThreshold
protected

◆ m_fVoteCooldownTimeStamp

float SCR_VotingBase.m_fVoteCooldownTimeStamp = -1
protected

◆ m_iCurrentVoteCount

int SCR_VotingBase.m_iCurrentVoteCount
protected

◆ m_iJoinServerVoteCooldown

int SCR_VotingBase.m_iJoinServerVoteCooldown
protected

◆ m_iLocalValue

int SCR_VotingBase.m_iLocalValue = DEFAULT_VALUE
protected

◆ m_iMinParticipation

float SCR_VotingBase.m_iMinParticipation
protected

◆ m_iMinVotes

int SCR_VotingBase.m_iMinVotes
protected

◆ m_Info

ref SCR_VotingUIInfo SCR_VotingBase.m_Info
protected

◆ m_iServerRuntimeIgnoreJoinServerCooldown

int SCR_VotingBase.m_iServerRuntimeIgnoreJoinServerCooldown
protected

◆ m_iVoteCooldownTime

int SCR_VotingBase.m_iVoteCooldownTime
protected

◆ m_Type

EVotingType SCR_VotingBase.m_Type
protected

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