Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_CampaignFaction.c
Go to the documentation of this file.
2{
3 [Attribute("", UIWidgets.ResourceNamePicker, "Defenders group prefab", "et")]
4 private ResourceName m_DefendersGroupPrefab;
5
6 [Attribute("", params: "et")]
7 protected ref array<ResourceName> m_aStartingVehicles;
8
9 [Attribute("", UIWidgets.ResourceNamePicker, "", "et")]
10 private ResourceName m_MobileHQPrefab;
11
12 [Attribute("", UIWidgets.ResourceNamePicker, "For radio operators", "et")]
13 private ResourceName m_RadioPrefab;
14
15 [Attribute("", UIWidgets.ResourceNamePicker, "HQ composition in small bases", "et")]
16 private ResourceName m_BaseBuildingHQ;
17
18 [Attribute("", UIWidgets.ResourceNamePicker, "Supply stash composition", "et")]
19 private ResourceName m_BaseBuildingSupplyDepot;
20
21 [Attribute("", UIWidgets.ResourceNamePicker, "Source Base Composition", "et")]
22 private ResourceName m_sBaseBuildingSourceBase;
23
24 [Attribute(desc: "Whitelist of allowed radio messages")]
26
27 [Attribute("1", UIWidgets.CheckBox, desc: "Faction can spawn on Main Bases")]
28 protected bool m_bCanSpawnOnMainBases;
29
30 [Attribute("0", UIWidgets.CheckBox, desc: "Faction can spawn on Source Bases")]
32
33 [Attribute(defvalue: "1", desc: "Can Build Bases")]
34 protected bool m_bCanBuildBases;
35
37
38 protected SCR_CampaignMobileAssemblyStandaloneComponent m_MobileAssembly;
39
42
43 protected int m_iControlPointsHeld;
44
45 protected const bool USE_GROUP_FREQUENCY = true;
46
47 //------------------------------------------------------------------------------------------------
48 void GetStartingVehiclePrefabs(out notnull array<ResourceName> prefabs)
49 {
50 prefabs.Copy(m_aStartingVehicles);
51 }
52
53 //------------------------------------------------------------------------------------------------
54 void SendHQMessage(SCR_ERadioMsg msgType, int baseCallsign = SCR_MilitaryBaseComponent.INVALID_BASE_CALLSIGN, int calledID = SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX, bool public = true, int param = SCR_CampaignRadioMsg.INVALID_RADIO_MSG_PARAM)
55 {
56 if (msgType == SCR_ERadioMsg.NONE)
57 return;
58
59 if (m_RadioMsgWhitelistConfig && !m_RadioMsgWhitelistConfig.CanSendRadioMessage(msgType))
60 return;
61
63
64 if (!HQ)
65 return;
66
67 BaseRadioComponent radio = BaseRadioComponent.Cast(HQ.GetOwner().FindComponent(BaseRadioComponent));
68
69 if (!radio || !radio.IsPowered())
70 return;
71
72 BaseTransceiver transmitter = radio.GetTransceiver(0);
73
74 if (!transmitter)
75 return;
76
77 SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
78
79 if (!campaign)
80 return;
81
83
84 if (!callsignManager)
85 return;
86
87 IEntity called = GetGame().GetPlayerManager().GetPlayerControlledEntity(calledID);
88 int companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex;
89
90 if (called && !callsignManager.GetEntityCallsignIndexes(called, companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex))
91 return;
92
94 {
95 // send a message from HQ trasmintter individually to each group
96 SCR_GroupsManagerComponent groupsManager = SCR_GroupsManagerComponent.GetInstance();
97 if (!groupsManager)
98 return;
99
100 array<SCR_AIGroup> playableGroups = groupsManager.GetPlayableGroupsByFaction(this);
101 if (!playableGroups)
102 return;
103
105
106 foreach (SCR_AIGroup group : playableGroups)
107 {
108 if (!group)
109 continue;
110
111 msg = new SCR_CampaignRadioMsg();
112 msg.SetRadioMsg(msgType);
113 msg.SetFactionId(GetGame().GetFactionManager().GetFactionIndex(this));
114 msg.SetBaseCallsign(baseCallsign);
115 msg.SetCalledCallsign(companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex);
116 msg.SetIsPublic(public);
117 msg.SetParam(param);
118 msg.SetPlayerID(calledID);
119 msg.SetEncryptionKey(radio.GetEncryptionKey());
120
121 if (group.GetGroupRole() == SCR_EGroupRole.COMMANDER)
122 msg.SetMessageForCommander(true, this);
123
124 transmitter.BeginTransmissionFreq(msg, group.GetRadioFrequency());
125 }
126 }
127 else
128 {
129 // send a message only to HQ platoon frequency
131 msg.SetRadioMsg(msgType);
132 msg.SetFactionId(GetGame().GetFactionManager().GetFactionIndex(this));
133 msg.SetBaseCallsign(baseCallsign);
134 msg.SetCalledCallsign(companyCallsignIndex, platoonCallsignIndex, squadCallsignIndex, characterCallsignIndex);
135 msg.SetIsPublic(public);
136 msg.SetParam(param);
137 msg.SetPlayerID(calledID);
138 msg.SetEncryptionKey(radio.GetEncryptionKey());
139 transmitter.BeginTransmission(msg);
140 }
141 }
142
143 //------------------------------------------------------------------------------------------------
144 void SetControlPointsHeld(int count)
145 {
146 m_iControlPointsHeld = count;
147 }
148
149 //------------------------------------------------------------------------------------------------
151 {
153 }
154
155 //------------------------------------------------------------------------------------------------
157 {
158 m_MainBase = mainBase;
159 }
160
161 //------------------------------------------------------------------------------------------------
162 void SetMobileAssembly(SCR_CampaignMobileAssemblyStandaloneComponent mobileAssembly)
163 {
164 m_MobileAssembly = mobileAssembly;
165 }
166
167 //------------------------------------------------------------------------------------------------
169 {
170 return m_RadioPrefab;
171 }
172
173 //------------------------------------------------------------------------------------------------
175 {
176 return m_DefendersGroupPrefab;
177 }
178
179 //------------------------------------------------------------------------------------------------
181 {
182 return m_MobileHQPrefab;
183 }
184
185 //------------------------------------------------------------------------------------------------
187 {
188 switch (type)
189 {
190 case EEditableEntityLabel.SERVICE_HQ:
191 return m_BaseBuildingHQ;
192
193 case EEditableEntityLabel.SERVICE_SUPPLY_STORAGE:
194 return m_BaseBuildingSupplyDepot;
195
196 case EEditableEntityLabel.SERVICE_SOURCE_BASE:
197 return m_sBaseBuildingSourceBase;
198 }
199
200 return ResourceName.Empty;
201 }
202
203 //------------------------------------------------------------------------------------------------
205 {
207
208 if (UI)
209 return UI.GetFactionNameUpperCase();
210 else
211 return "";
212 }
213
214 //------------------------------------------------------------------------------------------------
219
220 //------------------------------------------------------------------------------------------------
221 SCR_CampaignMobileAssemblyStandaloneComponent GetMobileAssembly()
222 {
223 return m_MobileAssembly;
224 }
225
226 //------------------------------------------------------------------------------------------------
228 {
229 m_fVictoryTimestamp = timestamp;
230 }
231
232 //------------------------------------------------------------------------------------------------
237
238 //------------------------------------------------------------------------------------------------
240 {
241 m_fPauseByBlockTimestamp = timestamp;
242 }
243
244 //------------------------------------------------------------------------------------------------
249
250 //------------------------------------------------------------------------------------------------
252 {
254 }
255
256 //------------------------------------------------------------------------------------------------
258 {
259 return m_bCanBuildBases;
260 }
261};
EEditableEntityLabel
ArmaReforgerScripted GetGame()
Definition game.c:1398
int GetFactionIndex()
EDamageType type
SCR_EGroupRole
Group roles.
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
void SCR_GroupsManagerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
bool GetEntityCallsignIndexes(IEntity entity, out int companyCallsignIndex, out int platoonCallsignIndex, out int squadCallsignIndex, out int characterCallsignIndex)
WorldTimestamp m_fVictoryTimestamp
SCR_CampaignMobileAssemblyStandaloneComponent GetMobileAssembly()
ref SCR_CampaignRadioMsgWhitelistConfig m_RadioMsgWhitelistConfig
void GetStartingVehiclePrefabs(out notnull array< ResourceName > prefabs)
ResourceName GetBuildingPrefab(EEditableEntityLabel type)
SCR_CampaignMobileAssemblyStandaloneComponent m_MobileAssembly
void SetMobileAssembly(SCR_CampaignMobileAssemblyStandaloneComponent mobileAssembly)
void SetVictoryTimestamp(WorldTimestamp timestamp)
ResourceName GetRadioPrefab()
void SendHQMessage(SCR_ERadioMsg msgType, int baseCallsign=SCR_MilitaryBaseComponent.INVALID_BASE_CALLSIGN, int calledID=SCR_CampaignMilitaryBaseComponent.INVALID_PLAYER_INDEX, bool public=true, int param=SCR_CampaignRadioMsg.INVALID_RADIO_MSG_PARAM)
void SetMainBase(SCR_CampaignMilitaryBaseComponent mainBase)
SCR_CampaignMilitaryBaseComponent m_MainBase
SCR_CampaignMilitaryBaseComponent GetMainBase()
WorldTimestamp m_fPauseByBlockTimestamp
ref array< ResourceName > m_aStartingVehicles
ResourceName GetDefendersGroupPrefab()
ResourceName GetMobileHQPrefab()
WorldTimestamp GetPauseByBlockTimestamp()
void SetPauseByBlockTimestamp(WorldTimestamp timestamp)
void SetControlPointsHeld(int count)
WorldTimestamp GetVictoryTimestamp()
void SetRadioMsg(SCR_ERadioMsg msg)
void SetMessageForCommander(bool isMessageForCommander, notnull SCR_Faction faction)
void SetFactionId(int factionId)
void SetCalledCallsign(int companyID, int platoonID, int squadID, int characterID)
void SetIsPublic(bool public)
void SetPlayerID(int playerID)
void SetBaseCallsign(int callsign)
SCR_FieldOfViewSettings Attribute