Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AntennaServicePointComponent.c
Go to the documentation of this file.
4
5class SCR_AntennaServicePointComponent : SCR_ServicePointComponent
6{
7 protected BaseRadioComponent m_RadioControl;
8
9 //------------------------------------------------------------------------------------------------
10 override void OnFactionChanged(FactionAffiliationComponent owner, Faction previousFaction, Faction faction)
11 {
12 super.OnFactionChanged(faction);
13
14 SCR_Faction newFaction = SCR_Faction.Cast(faction);
15
16 if (!newFaction)
17 return;
18
19 ChangeRadioSettings(newFaction);
20 }
21
22 //------------------------------------------------------------------------------------------------
25 void ChangeRadioSettings(notnull SCR_Faction faction)
26 {
27 if (!m_RadioControl || m_RadioControl.TransceiversCount() == 0)
28 return;
29
30 BaseTransceiver tsv = m_RadioControl.GetTransceiver(0);
31 if (!tsv)
32 return;
33
34 m_RadioControl.SetEncryptionKey(faction.GetFactionRadioEncryptionKey());
35
36 int factionFrequency = faction.GetFactionRadioFrequency();
37
38 // Setting frequency outside of limits causes a VME
39 if (factionFrequency < tsv.GetMinFrequency() || factionFrequency > tsv.GetMaxFrequency())
40 return;
41
42 tsv.SetFrequency(factionFrequency);
43 }
44
45 //------------------------------------------------------------------------------------------------
46 override void OnPostInit(IEntity owner)
47 {
48 super.OnPostInit(owner);
49
50 m_RadioControl = BaseRadioComponent.Cast(owner.FindComponent(BaseRadioComponent));
51 m_RadioControl.SetPower(true);
52
53 if (!m_RadioControl)
54 Print("SCR_AntennaServicePointComponent: Owner is missing BaseRadioComponent!", LogLevel.ERROR);
55 }
56}
SCR_AntennaServicePointComponentClass m_RadioControl
void ChangeRadioSettings(notnull SCR_Faction faction)
proto external Managed FindComponent(typename typeName)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14