Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignPackMobileAssemblyUserAction.c
Go to the documentation of this file.
2{
3 //------------------------------------------------------------------------------------------------
4 override bool CanBeShownScript(IEntity user)
5 {
7 return false;
8
9 return m_AssemblyComponent.IsDeployed();
10 }
11
12 //------------------------------------------------------------------------------------------------
13 override bool CanBePerformedScript(IEntity user)
14 {
15 return true;
16 }
17
18 //------------------------------------------------------------------------------------------------
19 override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
20 {
21 int playerId = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(pUserEntity);
22 m_AssemblyComponent.Deploy(SCR_EMobileAssemblyStatus.DISMANTLED, playerId);
23 }
24
25 //------------------------------------------------------------------------------------------------
26 override bool GetActionNameScript(out string outName)
27 {
29 return false;
30
31 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
32
33 if (!campaign)
34 return false;
35
36 if (SCR_FactionManager.SGetLocalPlayerFaction() != m_AssemblyComponent.GetAffiliatedFaction())
37 return false;
38
39 SCR_SpawnPoint spawnpoint = m_AssemblyComponent.GetSpawnPoint();
40
41 if (!spawnpoint)
42 return false;
43
44 SCR_CoverageRadioComponent radio = SCR_CoverageRadioComponent.Cast(spawnpoint.FindComponent(SCR_CoverageRadioComponent));
45
46 if (!radio)
47 return false;
48
49 int basesCovered;
50 string encryption = radio.GetEncryptionKey();
51 array<SCR_CoverageRadioComponent> radiosCovered = {};
52 radio.GetRadiosInRange(radiosCovered);
53
54 foreach (SCR_CoverageRadioComponent radioCovered : radiosCovered)
55 {
56 if (!radioCovered.IsSource() && radioCovered.GetRadiosInRangeOfCount(encryption) == 1)
57 basesCovered++;
58 }
59
60 if (basesCovered == 0)
61 return false;
62
63 ActionNameParams[0] = basesCovered.ToString();
64 outName = "#AR-Campaign_Action_Dismantle_BasesInfo-UC";
65 return true;
66 }
67};
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_FactionManager(IEntitySource src, IEntity parent)
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
string ActionNameParams[9]
Can be filled in scripts to be used as params when name is being formatted when displayed in UI.
Spawn point entity defines positions on which players can possibly spawn.
@ PerformAction