Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_RadioBaseUserAction.c
Go to the documentation of this file.
2{
3 [Attribute(desc: "Frequency that should be tuned at the radio to allow communication. For an exampel with HQ. If wrong one is tuned at the radio, the user action will not be visible.")]
4 int m_iTargetFrequency;
5
6 protected BaseRadioComponent m_BaseRadioComponent;
7 protected ref array<BaseTransceiver> m_aTsvList = {};
8
9 //------------------------------------------------------------------------------------------------
10 protected override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
11 {
12 m_BaseRadioComponent = BaseRadioComponent.Cast(pOwnerEntity.FindComponent(BaseRadioComponent));
14 return;
15
16 int count = m_BaseRadioComponent.TransceiversCount();
17
18 for (int i = 0; i < count; i++)
19 {
20 m_aTsvList.Insert(m_BaseRadioComponent.GetTransceiver(i));
21 }
22 }
23
24 //------------------------------------------------------------------------------------------------
25 // The user action is shown when radio is turned on, the correct frequency is set and custom condition is true.
26 override bool CanBeShownScript(IEntity user)
27 {
28 if (!m_BaseRadioComponent || m_aTsvList.IsEmpty())
29 return false;
30
31 if (!m_BaseRadioComponent.IsPowered())
32 return false;
33
34 bool frequencyMatch;
35 foreach (BaseTransceiver tsv : m_aTsvList)
36 {
37 if (tsv.GetFrequency() == m_iTargetFrequency)
38 {
39 frequencyMatch = true;
40 break;
41 }
42 }
43
44 if (!frequencyMatch)
45 return false;
46
47 return CustomRadioCondition();
48 }
49
50 //------------------------------------------------------------------------------------------------
51 // To be overridden in inherited classes. Allow set a custom condition when the action could be shown.
52 protected bool CustomRadioCondition()
53 {
54 return true;
55 }
56}
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
BaseRadioComponent m_BaseRadioComponent
ref array< BaseTransceiver > m_aTsvList
override bool CanBeShownScript(IEntity user)
A scripted action class having optional logic to check if vehicle is valid.
SCR_FieldOfViewSettings Attribute