Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignRadioMsg.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
3 {
4  static const int INVALID_RADIO_MSG_PARAM = -1;
5 
6  protected SCR_ERadioMsg m_iRadioMsg;
7  protected int m_iFactionId;
8  protected int m_iBaseCallsign = SCR_MilitaryBaseComponent.INVALID_BASE_CALLSIGN;
9  protected int m_iCallerCompanyID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
10  protected int m_iCallerPlatoonID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
11  protected int m_iCallerSquadID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
12  protected int m_iCalledCompanyID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
13  protected int m_iCalledPlatoonID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
14  protected int m_iCalledSquadID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
15  protected float m_fSeed = Math.RandomFloat01();
16  protected bool m_bIsPublic = true;
17  protected int m_iParam = INVALID_RADIO_MSG_PARAM;
18  protected int m_iPlayerID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX;
19 
20  //------------------------------------------------------------------------------------------------
21  void SetRadioMsg(SCR_ERadioMsg msg)
22  {
23  m_iRadioMsg = msg;
24  }
25 
26  //------------------------------------------------------------------------------------------------
27  void SetFactionId(int factionId)
28  {
29  m_iFactionId = factionId;
30  }
31 
32  //------------------------------------------------------------------------------------------------
33  void SetBaseCallsign(int callsign)
34  {
35  m_iBaseCallsign = callsign;
36  }
37 
38  //------------------------------------------------------------------------------------------------
39  void SetCallerCallsign(int companyID, int platoonID, int squadID)
40  {
41  m_iCallerCompanyID = companyID;
42  m_iCallerPlatoonID = platoonID;
43  m_iCallerSquadID = squadID;
44  }
45 
46  //------------------------------------------------------------------------------------------------
47  void SetCalledCallsign(int companyID, int platoonID, int squadID)
48  {
49  m_iCalledCompanyID = companyID;
50  m_iCalledPlatoonID = platoonID;
51  m_iCalledSquadID = squadID;
52  }
53 
54  //------------------------------------------------------------------------------------------------
55  void SetIsPublic(bool public)
56  {
57  m_bIsPublic = public;
58  }
59 
60  //------------------------------------------------------------------------------------------------
61  void SetParam(int param)
62  {
63  m_iParam = param;
64  }
65 
66  //------------------------------------------------------------------------------------------------
67  void SetPlayerID(int playerID)
68  {
69  m_iPlayerID = playerID;
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  float GetSeed()
74  {
75  return m_fSeed;
76  }
77 
78  //------------------------------------------------------------------------------------------------
79  override void OnDelivery(BaseTransceiver receiver, int freq, float quality)
80  {
81  IEntity owner = receiver.GetRadio().GetOwner();
82 
83  ChimeraCharacter player;
85 
86  while (!player && !base)
87  {
88  player = ChimeraCharacter.Cast(owner);
90 
91  if (player || base)
92  break;
93 
94  owner = owner.GetParent();
95 
96  if (!owner)
97  return;
98  }
99 
100  if (player)
101  {
102  int playerID = GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(owner);
103  PlayerController controller = GetGame().GetPlayerManager().GetPlayerController(playerID);
104 
105  if (!controller)
106  return;
107 
108  SCR_CampaignNetworkComponent comp = SCR_CampaignNetworkComponent.Cast(controller.FindComponent(SCR_CampaignNetworkComponent));
109 
110  if (comp)
111  comp.PlayRadioMsg(m_iRadioMsg, m_iFactionId, m_iBaseCallsign, m_iCallerCompanyID, m_iCallerPlatoonID, m_iCallerSquadID, m_iCalledCompanyID, m_iCalledPlatoonID, m_iCalledSquadID, m_bIsPublic, m_iParam, m_fSeed, quality, m_iPlayerID);
112  }
113  else
114  {
115  // Received by HQ, ping player that the message has been received
116  if (!base.IsHQ())
117  return;
118 
119  if (freq != receiver.GetRadio().GetTransceiver(0).GetFrequency())
120  return;
121 
122  PlayerController controller = GetGame().GetPlayerManager().GetPlayerController(m_iPlayerID);
123 
124  if (!controller)
125  return;
126 
127  SCR_CampaignNetworkComponent comp = SCR_CampaignNetworkComponent.Cast(controller.FindComponent(SCR_CampaignNetworkComponent));
128 
129  if (comp)
130  {
131  ChimeraWorld world = GetGame().GetWorld();
132  comp.SetLastHQRadioMessageTimestamp(world.GetServerTimestamp());
133  }
134  }
135  }
136 };
137 
139 {
189 };
BUILT_ANTENNA
@ BUILT_ANTENNA
Definition: SCR_CampaignRadioMsg.c:177
LOSING
@ LOSING
Definition: SCR_CampaignRadioMsg.c:156
ChimeraWorld
Definition: ChimeraWorld.c:12
BUILT_FIELD_HOSPITAL
@ BUILT_FIELD_HOSPITAL
Definition: SCR_CampaignRadioMsg.c:178
DESTROYED_FUEL
@ DESTROYED_FUEL
Definition: SCR_CampaignRadioMsg.c:184
REINFORCEMENTS
@ REINFORCEMENTS
Definition: SCR_CampaignRadioMsg.c:152
DEMOTION
@ DEMOTION
Definition: SCR_CampaignRadioMsg.c:145
TASK_ASSIGN_SEIZE
@ TASK_ASSIGN_SEIZE
Definition: SCR_CampaignRadioMsg.c:164
DESTROYED_REPAIR
@ DESTROYED_REPAIR
Definition: SCR_CampaignRadioMsg.c:185
DESTROYED_ARMORY
@ DESTROYED_ARMORY
Definition: SCR_CampaignRadioMsg.c:183
REQUEST_EVAC
@ REQUEST_EVAC
Definition: SCR_CampaignRadioMsg.c:158
REQUEST_REINFORCEMENTS
@ REQUEST_REINFORCEMENTS
Definition: SCR_CampaignRadioMsg.c:161
BUILT_VEHICLES_LIGHT
@ BUILT_VEHICLES_LIGHT
Definition: SCR_CampaignRadioMsg.c:174
BASE_LOST
@ BASE_LOST
Definition: SCR_CampaignRadioMsg.c:170
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
PROMOTION_CAPTAIN
@ PROMOTION_CAPTAIN
Definition: SCR_CampaignRadioMsg.c:150
TASK_ASSIST
@ TASK_ASSIST
Definition: SCR_CampaignRadioMsg.c:169
SUPPLIES
@ SUPPLIES
Definition: SCR_CampaignRadioMsg.c:160
SCR_ERadioMsg
SCR_ERadioMsg
Definition: SCR_CampaignRadioMsg.c:138
BUILT_HELIPAD
@ BUILT_HELIPAD
Definition: SCR_CampaignRadioMsg.c:179
ScriptedRadioMessage
Definition: ScriptedRadioMessage.c:12
DEMOTION_RENEGADE
@ DEMOTION_RENEGADE
Definition: SCR_CampaignRadioMsg.c:144
CONFIRM
@ CONFIRM
Definition: SCR_CampaignRadioMsg.c:163
PROMOTION_SERGEANT
@ PROMOTION_SERGEANT
Definition: SCR_CampaignRadioMsg.c:148
RELAY_LOST
@ RELAY_LOST
Definition: SCR_CampaignRadioMsg.c:171
BUILT_SUPPLY
@ BUILT_SUPPLY
Definition: SCR_CampaignRadioMsg.c:180
BUILT_REPAIR
@ BUILT_REPAIR
Definition: SCR_CampaignRadioMsg.c:181
SEIZED_MAIN
@ SEIZED_MAIN
Definition: SCR_CampaignRadioMsg.c:141
BASE_UNDER_ATTACK
@ BASE_UNDER_ATTACK
Definition: SCR_CampaignRadioMsg.c:172
TASK_UNASSIGN_TRANSPORT
@ TASK_UNASSIGN_TRANSPORT
Definition: SCR_CampaignRadioMsg.c:166
BUILT_FUEL
@ BUILT_FUEL
Definition: SCR_CampaignRadioMsg.c:182
REQUEST_TRANSPORT
@ REQUEST_TRANSPORT
Definition: SCR_CampaignRadioMsg.c:162
PROMOTION_PRIVATE
@ PROMOTION_PRIVATE
Definition: SCR_CampaignRadioMsg.c:146
REPAIRED_ARMORY
@ REPAIRED_ARMORY
Definition: SCR_CampaignRadioMsg.c:186
RELAY
@ RELAY
Definition: SCR_CampaignRadioMsg.c:157
TASK_UNASSIGN_EVAC
@ TASK_UNASSIGN_EVAC
Definition: SCR_CampaignRadioMsg.c:167
BUILT_ARMORY
@ BUILT_ARMORY
Definition: SCR_CampaignRadioMsg.c:173
BaseTransceiver
Definition: BaseTransceiver.c:12
DEFEAT
@ DEFEAT
Definition: SCR_CampaignRadioMsg.c:155
BUILT_BARRACKS
@ BUILT_BARRACKS
Definition: SCR_CampaignRadioMsg.c:176
PROMOTION_MAJOR
@ PROMOTION_MAJOR
Definition: SCR_CampaignRadioMsg.c:151
PROMOTION_LIEUTENANT
@ PROMOTION_LIEUTENANT
Definition: SCR_CampaignRadioMsg.c:149
TASK_UNASSIGN_REFUEL
@ TASK_UNASSIGN_REFUEL
Definition: SCR_CampaignRadioMsg.c:165
REPAIRED_REPAIR
@ REPAIRED_REPAIR
Definition: SCR_CampaignRadioMsg.c:188
TASK_CANCEL_REQUEST
@ TASK_CANCEL_REQUEST
Definition: SCR_CampaignRadioMsg.c:168
SEIZED_SMALL
@ SEIZED_SMALL
Definition: SCR_CampaignRadioMsg.c:143
NONE
@ NONE
Definition: SCR_CampaignRadioMsg.c:140
REPAIRED_FUEL
@ REPAIRED_FUEL
Definition: SCR_CampaignRadioMsg.c:187
m_iPlayerID
SCR_EditorManagerCore m_iPlayerID
SEIZED_MAJOR
@ SEIZED_MAJOR
Definition: SCR_CampaignRadioMsg.c:142
SCR_CampaignRadioMsg
Definition: SCR_CampaignRadioMsg.c:2
PROMOTION_CORPORAL
@ PROMOTION_CORPORAL
Definition: SCR_CampaignRadioMsg.c:147
REQUEST_FUEL
@ REQUEST_FUEL
Definition: SCR_CampaignRadioMsg.c:159
VICTORY
@ VICTORY
Definition: SCR_CampaignRadioMsg.c:153
WINNING
@ WINNING
Definition: SCR_CampaignRadioMsg.c:154
BUILT_VEHICLES_HEAVY
@ BUILT_VEHICLES_HEAVY
Definition: SCR_CampaignRadioMsg.c:175
SCR_CampaignMilitaryBaseComponent
Definition: SCR_CampaignMilitaryBaseComponent.c:38