Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VotingFactionCommanderWithdraw.c
Go to the documentation of this file.
3{
4 //------------------------------------------------------------------------------------------------
5 override bool IsAvailable(int value, bool isOngoing)
6 {
7 SCR_Faction playerFactionLocal = SCR_Faction.Cast(SCR_FactionManager.SGetLocalPlayerFaction());
8
9 if (!playerFactionLocal)
10 return false;
11
12 int playerIdLocal = GetGame().GetPlayerController().GetPlayerId();
13
14 return (value == playerIdLocal && playerFactionLocal.GetCommanderId() == playerIdLocal);
15 }
16
17 //------------------------------------------------------------------------------------------------
18 override bool CanSendNotification(int value)
19 {
20 SCR_FactionManager fManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
21
22 if (!fManager)
23 return false;
24
25 return (fManager.GetPlayerFaction(value) == fManager.GetLocalPlayerFaction());
26 }
27
28 //------------------------------------------------------------------------------------------------
29 override void OnVotingEnd(int value = DEFAULT_VALUE, int winner = DEFAULT_VALUE)
30 {
31 if (winner == DEFAULT_VALUE)
32 return;
33
34 if (Replication.IsClient())
35 return;
36
37 SCR_Faction faction = SCR_Faction.Cast(SCR_FactionManager.SGetPlayerFaction(winner));
38
39 if (!faction)
40 return;
41
42 if (faction.GetCommanderId() != winner)
43 return;
44
45 SCR_FactionCommanderHandlerComponent component = SCR_FactionCommanderHandlerComponent.GetInstance();
46
47 if (!component)
48 return;
49
50 component.SetFactionCommander(SCR_Faction.Cast(SCR_FactionManager.SGetPlayerFaction(winner)), 0);
51 }
52}
EVotingType
Definition EVotingType.c:2
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
void SCR_FactionManager(IEntitySource src, IEntity parent)
Main replication API.
Definition Replication.c:14
int GetCommanderId()
static const int DEFAULT_VALUE