Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_VoNComponent.c
Go to the documentation of this file.
1//------------------------------------------------------------------------------------------------
4
5//------------------------------------------------------------------------------------------------
6class SCR_VoNComponent : VoNComponent
7{
8 private const float TRANSMISSION_TIMEOUT_MS = 500;
9 private float m_fTransmitingTimeout;
10 private float m_fTransmitRadioTimeout;
11 private SCR_VonDisplay m_VONDisplay;
12
13 ref ScriptInvoker m_OnReceivedVON = new ScriptInvoker();
14 ref ScriptInvoker m_OnCaptureVON = new ScriptInvoker();
15 protected static ref ScriptInvokerInt m_OnVoNUsed;
16
17 //------------------------------------------------------------------------------------------------
18 static ScriptInvokerInt GetOnVoNUsed()
19 {
20 if (!m_OnVoNUsed)
21 m_OnVoNUsed = new ScriptInvokerInt();
22
23 return m_OnVoNUsed;
24 }
25
26 //------------------------------------------------------------------------------------------------
29 SCR_VonDisplay GetDisplay()
30 {
31 if (m_VONDisplay)
32 return m_VONDisplay;
33
34 SCR_VONController vonContr = SCR_VONController.Cast(GetGame().GetPlayerController().FindComponent(SCR_VONController));
35 if (vonContr)
36 {
37 m_VONDisplay = vonContr.GetDisplay();
38 return m_VONDisplay;
39 }
40
41 return null;
42 }
43
44 //------------------------------------------------------------------------------------------------
49 {
50 return m_fTransmitingTimeout > GetGame().GetWorld().GetWorldTime();
51 }
52
53 //------------------------------------------------------------------------------------------------
57 {
58 return m_fTransmitRadioTimeout > GetGame().GetWorld().GetWorldTime();
59 }
60
61 //------------------------------------------------------------------------------------------------
62 override protected event void OnCapture(BaseTransceiver transmitter)
63 {
64 SCR_VonDisplay display = GetDisplay();
65
66 if (display)
67 display.OnCapture(transmitter);
68
69 m_OnCaptureVON.Invoke(transmitter);
70
71 m_fTransmitingTimeout = GetGame().GetWorld().GetWorldTime() + TRANSMISSION_TIMEOUT_MS;
72
73 if (transmitter)
74 m_fTransmitRadioTimeout = GetGame().GetWorld().GetWorldTime() + TRANSMISSION_TIMEOUT_MS;
75 }
76
77 //------------------------------------------------------------------------------------------------
78 override protected event void OnReceive(int playerId, bool isSenderEditor, BaseTransceiver receiver, int frequency, float quality)
79 {
80 SCR_VonDisplay display = GetDisplay();
81
82 if (display)
83 display.OnReceive(playerId, isSenderEditor, receiver, frequency, quality);
84
85 m_OnReceivedVON.Invoke(playerId, receiver, frequency, quality);
86 }
87
88 //------------------------------------------------------------------------------------------------
89 override protected event void OnVoNUsed(int senderId)
90 {
91 if (m_OnVoNUsed)
92 m_OnVoNUsed.Invoke(senderId);
93 }
94
95 //------------------------------------------------------------------------------------------------
96 override protected event IEntity GetEditorEntity(int playerId)
97 {
99 if (!core)
100 return null;
101
102 return core.GetEditorManager(playerId);
103 }
104
105 //------------------------------------------------------------------------------------------------
106 override protected event vector GetEditorWorldLocation(int playerId)
107 {
109 if (!core)
110 return vector.Zero;
111
112 SCR_EditorManagerEntity editorManager = core.GetEditorManager(playerId);
113 if (!editorManager)
114 return vector.Zero;
115
116 vector mat[4];
117 editorManager.GetWorldTransform(mat);
118 return mat[3];
119 }
120
121 //------------------------------------------------------------------------------------------------
122 override bool IsEntityActiveEditor(IEntity entity)
123 {
124 if (!entity)
125 return false;
126
127 SCR_EditorManagerEntity editorManager = SCR_EditorManagerEntity.Cast(entity);
128 if (!editorManager)
129 return false;
130
131 return editorManager.IsOpened();
132 }
133
134 //------------------------------------------------------------------------------------------------
136 {
138 if (!core)
139 return false;
140
141 SCR_EditorManagerEntity editorManager = core.GetEditorManager();
142 if (!editorManager)
143 return false;
144
145 return editorManager.IsOpened();
146 }
147};
ArmaReforgerScripted GetGame()
Definition game.c:1398
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
ScriptInvokerBase< ScriptInvokerIntMethod > ScriptInvokerInt
SCR_VonDisplay m_VONDisplay
SCR_VonDisplay GetDisplay()
SCR_VoNComponentClass TRANSMISSION_TIMEOUT_MS
bool IsLocalActiveEditor()
bool IsTransmitingRadio()
bool IsTransmiting()
Core component to manage SCR_EditorManagerEntity.
SCR_EditorManagerEntity GetEditorManager()
void OnReceive(int playerId, bool isSenderEditor, BaseTransceiver receiver, int frequency, float quality)
VONComponent event.
vector GetEditorWorldLocation(int playerId)
void OnCapture(BaseTransceiver transmitter)
VONComponent event.
void OnVoNUsed(int senderId)
IEntity GetEditorEntity(int playerId)
bool IsEntityActiveEditor(IEntity entity)
proto external PlayerController GetPlayerController()
ScriptInvokerBase< func > ScriptInvoker
Definition tools.c:134