14 static SCR_VoterComponent GetInstance()
25 static void InstantVote()
31 SCR_VoterComponent voterComponent = GetInstance();
35 array<EVotingType> votingTypes = {};
36 array<int> votingValues = {};
38 int count = manager.GetAllVotingsWithValue(votingTypes, votingValues,
false,
true);
40 for (
int i = count - 1; i >= 0; i--)
42 if (manager.HasAbstainedLocally(votingTypes[i], votingValues[i]))
44 votingTypes.Remove(i);
45 votingValues.Remove(i);
49 if (manager.IsLocalVote(votingTypes[i], votingValues[i]))
51 votingTypes.Remove(i);
52 votingValues.Remove(i);
57 if (votingTypes.Count() == 1)
58 voterComponent.Vote(votingTypes[0], votingValues[0]);
65 static void InstantRemoveAndAbstainVote()
71 SCR_VoterComponent voterComponent = GetInstance();
75 array<EVotingType> votingTypes = {};
76 array<int> votingValues = {};
78 int count = manager.GetAllVotingsWithValue(votingTypes, votingValues,
false,
true);
80 for (
int i = count - 1; i >= 0; i--)
82 if (manager.HasAbstainedLocally(votingTypes[i], votingValues[i]))
84 votingTypes.Remove(i);
85 votingValues.Remove(i);
89 if (manager.IsLocalVote(votingTypes[i], votingValues[i]))
91 votingTypes.Remove(i);
92 votingValues.Remove(i);
97 if (votingTypes.Count() == 1)
98 voterComponent.RemoveVote(votingTypes[0], votingValues[0]);
113 if (!manager.IsVoting(
type, value) && manager.GetCurrentVoteCooldownForLocalPlayer(
type) > 0)
116 manager.PreVoteLocal(
type, value);
119 manager.VoteLocal(
type, value);
136 manager.RemoveVoteLocal(
type, value);
150 if (manager.IsLocalVote(
type, value))
153 manager.RemoveVoteLocal(
type, value);
156 manager.AbstainVoteLocally(
type, value);
168 return manager.IsLocalVote(
type, value);
182 return manager.HasAbstainedLocally(
type, value);
213 Debug.Error2(
"SCR_VoterComponent",
"SCR_VoterComponent must be attached to PlayerController!");
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_FastTravelComponentClass m_PlayerController
void VoteServer(EVotingType type, int value)
void RemoveVote(EVotingType type, int value=SCR_VotingBase.DEFAULT_VALUE)
bool DidVote(EVotingType type, int value=SCR_VotingBase.DEFAULT_VALUE)
bool HasAbstained(EVotingType type, int value=SCR_VotingBase.DEFAULT_VALUE)
void Vote(EVotingType type, int value)
void RemoveVoteServer(EVotingType type, int value)
void AbstainVote(EVotingType type, int value=SCR_VotingBase.DEFAULT_VALUE)
void SCR_VotingManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
proto external GenericComponent FindComponent(typename typeName)
static const int DEFAULT_VALUE
proto external PlayerController GetPlayerController()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.