Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_TutorialLogic_SeizingCourse.c
Go to the documentation of this file.
3{
4 protected const ResourceName COMMS_PREFAB = "{F7DC8BB193BCAF44}PrefabsEditable/Auto/Compositions/Slotted/SlotFlatSmall/E_Antenna_S_US_01.et";
5
6 //------------------------------------------------------------------------------------------------
7 protected void OnEntitySpawned(IEntity ent)
8 {
9 if (ent && ent.GetPrefabData().GetPrefabName() == COMMS_PREFAB)
10 ent.SetName("BUILDING_ANTENNA");
11 }
12
13 //------------------------------------------------------------------------------------------------
14 override void OnCourseStart()
15 {
16 ResetRadio();
17
18 SCR_EntityHelper.DeleteEntityAndChildren(GetGame().GetWorld().FindEntityByName("BUILDING_ANTENNA"));
19
20 SCR_TutorialFakeBaseComponent fakeBaseComponent;
21 IEntity fakeBase;
22
23 //Show map icons
24 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHospital");
25 if (fakeBase)
26 {
27 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
28 if (fakeBaseComponent)
29 {
30 fakeBaseComponent.m_bVisible = true;
31 fakeBaseComponent.CreateLinks();
32 }
33 }
34
35 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHQ");
36 if (fakeBase)
37 {
38 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
39 if (fakeBaseComponent)
40 {
41 fakeBaseComponent.m_bVisible = true;
42 fakeBaseComponent.CreateLinks();
43 }
44 }
45
46 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseSignalHill");
47 if (fakeBase)
48 {
49 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
50 if (fakeBaseComponent)
51 {
52 fakeBaseComponent.m_bVisible = true;
53 fakeBaseComponent.CreateLinks();
54 }
55 }
56
57 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHarbor");
58 if (fakeBase)
59 {
60 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
61 if (fakeBaseComponent)
62 {
63 fakeBaseComponent.m_bVisible = true;
64 fakeBaseComponent.CreateLinks();
65 }
66 }
67
68 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseArleville");
69 if (fakeBase)
70 {
71 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
72 if (fakeBaseComponent)
73 {
74 fakeBaseComponent.m_bVisible = true;
75 fakeBaseComponent.CreateLinks();
76 }
77 }
78
79 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseLighthouseNorth");
80 if (fakeBase)
81 {
82 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
83 if (fakeBaseComponent)
84 {
85 fakeBaseComponent.m_bVisible = true;
86 fakeBaseComponent.m_BaseColor = Color.FromRGBA(249, 210, 103, 255);
87 fakeBaseComponent.m_eMilitarySymbolIdentity = EMilitarySymbolIdentity.UNKNOWN;
88 fakeBaseComponent.m_sHighlight = "Unknown_Installation_Focus_Land";
89 }
90
92 if (factionComp)
93 factionComp.SetAffiliatedFactionByKey("USSR");
94
95 SCR_TutorialSeizingComponent seizingComp = SCR_TutorialSeizingComponent.Cast(fakeBase.FindComponent(SCR_TutorialSeizingComponent));
96 if (seizingComp)
97 {
98 seizingComp.UpdateFlagsInHierarchyPublic();
99
100 }
101
102 BaseGameTriggerEntity trigger;
103 IEntity child = fakeBase.GetChildren();
104 while (child)
105 {
106 if (child.IsInherited(BaseGameTriggerEntity))
107 {
108 trigger = BaseGameTriggerEntity.Cast(child);
109 break;
110 }
111
112 child = child.GetSibling();
113 }
114
115 if (trigger)
116 trigger.SetSphereRadius(0.1);
117 }
118
119 //Fix targets
120 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
121 if (tutorial)
122 {
123 tutorial.SetupTargets("base_target1", null, ETargetState.TARGET_DOWN, false);
124 tutorial.GetOnEntitySpawned().Insert(OnEntitySpawned);
125 }
126
127 //Reset MHQ interaction
128 IEntity mobilehq = GetGame().GetWorld().FindEntityByName("Tutorial_MobileHQ");
129 if (!mobilehq)
130 return;
131
132 SlotManagerComponent slotMan = SlotManagerComponent.Cast(mobilehq.FindComponent(SlotManagerComponent));
133 if (!slotMan)
134 return;
135
136 EntitySlotInfo slotInfo = slotMan.GetSlotByName("Radio");
137 if (!slotInfo)
138 return;
139
140 IEntity box = slotInfo.GetAttachedEntity();
141 if (!box)
142 return;
143
144 box.SetName("MHQ_TRUNK");
145
147 if (!actionMan)
148 return;
149
150 array <BaseUserAction> userActions = {};
151
152 actionMan.GetActionsList(userActions);
154 foreach (BaseUserAction userAction : userActions)
155 {
156 if (!userAction.IsInherited(SCR_TutorialDeployMobileAssembly))
157 continue;
158
159 assemblyAction = SCR_TutorialDeployMobileAssembly.Cast(userAction);
160 if (assemblyAction)
161 assemblyAction.SetActive(false);
162 }
163
164 IEntity antenna = GetGame().GetWorld().FindEntityByName("Seizing_Course_Antenna");
165 if (antenna)
166 SCR_EntityHelper.DeleteEntityAndChildren(antenna);
167
169 }
170
171 //------------------------------------------------------------------------------------------------
173 {
174 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
175 if (!tutorial)
176 return;
177
178 IEntity radio = tutorial.FindPrefabInPlayerInventory("{73950FBA2D7DB5C5}Prefabs/Items/Equipment/Radios/Radio_ANPRC68.et");
179 if (!radio)
180 return;
181
182 BaseRadioComponent radioComp = BaseRadioComponent.Cast(radio.FindComponent(BaseRadioComponent));
183 if (!radioComp)
184 return;
185
186 RadioTransceiver transceiver = RadioTransceiver.Cast(radioComp.GetTransceiver(0));
187 if (transceiver)
188 transceiver.SetFrequency(32000);
189
190 transceiver = RadioTransceiver.Cast(radioComp.GetTransceiver(1));
191 if (transceiver)
192 transceiver.SetFrequency(32000);
193
194 }
195
196 //------------------------------------------------------------------------------------------------
198 {
199 IEntity ent = GetGame().GetWorld().FindEntityByName("LIGHTHOUSE_SUPPLIES");
200 if (!ent)
201 return;
202
203 SCR_ResourceComponent resComp = SCR_ResourceComponent.FindResourceComponent(ent);
204 if (!resComp)
205 return;
206
207 SCR_ResourceContainer resourceContainer = resComp.GetContainer(EResourceType.SUPPLIES);
208 if (resourceContainer)
209 resourceContainer.DepleteResourceValue();
210 }
211
212 //------------------------------------------------------------------------------------------------
214 {
215 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
216 if (!tutorial)
217 return false;
218
219 ChimeraCharacter player = tutorial.GetPlayer();
220 if (!player)
221 return false;
222
223 BaseWeaponManagerComponent weaponManager = BaseWeaponManagerComponent.Cast(player.FindComponent(BaseWeaponManagerComponent));
224 if (!weaponManager)
225 return false;
226
227 array<IEntity> weapons = {};
228 weaponManager.GetWeaponsList(weapons);
229
230 BaseWeaponComponent weaponComp;
231 foreach (IEntity weapon : weapons)
232 {
233 weaponComp = BaseWeaponComponent.Cast(weapon.FindComponent(BaseWeaponComponent));
234 if (!weaponComp)
235 continue;
236
237 if (weaponComp.GetWeaponType() == EWeaponType.WT_FRAGGRENADE || weaponComp.GetWeaponType() == EWeaponType.WT_SMOKEGRENADE || weaponComp.GetWeaponType() == EWeaponType.WT_NONE || weaponComp.GetWeaponType() == EWeaponType.WT_ROCKETLAUNCHER)
238 continue;
239
240 return true;
241 }
242
243 return false;
244 }
245
246 //------------------------------------------------------------------------------------------------
247 override void OnCourseEnd()
248 {
249 SCR_TutorialGamemodeComponent tutorial = SCR_TutorialGamemodeComponent.GetInstance();
250 if (tutorial)
251 tutorial.GetOnEntitySpawned().Remove(OnEntitySpawned);
252
253 SCR_TutorialFakeBaseComponent fakeBaseComponent;
254 IEntity fakeBase;
255
256 //hide map icons
257 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseFarm");
258 if (fakeBase)
259 {
260 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
261 if (fakeBaseComponent)
262 {
263 fakeBaseComponent.m_bVisible = false;
264 fakeBaseComponent.ClearLinks();
265 fakeBaseComponent.RemoveLinkName("Tutorial_MobileHQ");
266 }
267 }
268
269 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHarbor");
270 if (fakeBase)
271 {
272 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
273 if (fakeBaseComponent)
274 {
275 fakeBaseComponent.m_bVisible = false;
276 fakeBaseComponent.ClearLinks();
277 }
278 }
279
280 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseSignalHill");
281 if (fakeBase)
282 {
283 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
284 if (fakeBaseComponent)
285 {
286 fakeBaseComponent.m_bVisible = false;
287 fakeBaseComponent.ClearLinks();
288 }
289 }
290
291 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHarbor");
292 if (fakeBase)
293 {
294 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
295 if (fakeBaseComponent)
296 {
297 fakeBaseComponent.m_bVisible = false;
298 fakeBaseComponent.ClearLinks();
299 }
300 }
301
302 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHospital");
303 if (fakeBase)
304 {
305 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
306 if (fakeBaseComponent)
307 {
308 fakeBaseComponent.m_bVisible = false;
309 fakeBaseComponent.ClearLinks();
310 }
311 }
312
313 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseHQ");
314 if (fakeBase)
315 {
316 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
317 if (fakeBaseComponent)
318 {
319 fakeBaseComponent.m_bVisible = false;
320 fakeBaseComponent.ClearLinks();
321 }
322 }
323
324 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseArleville");
325 if (fakeBase)
326 {
327 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
328 if (fakeBaseComponent)
329 {
330 fakeBaseComponent.m_bVisible = false;
331 fakeBaseComponent.ClearLinks();
332 }
333 }
334
335 fakeBase = GetGame().GetWorld().FindEntityByName("FakeBaseLighthouseNorth");
336 if (fakeBase)
337 {
338 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
339 if (fakeBaseComponent)
340 {
341 fakeBaseComponent.m_bVisible = false;
342 fakeBaseComponent.m_bAllowServices = false;
343 fakeBaseComponent.m_bAllowServicesSizeOverlay = false;
344 fakeBaseComponent.m_eMilitarySymbolIdentity = EMilitarySymbolIdentity.UNKNOWN;
345 fakeBaseComponent.ClearLinks();
346 }
347 }
348
349 fakeBase = GetGame().GetWorld().FindEntityByName("Tutorial_MobileHQ");
350 if (fakeBase)
351 {
352 fakeBaseComponent = SCR_TutorialFakeBaseComponent.Cast(fakeBase.FindComponent(SCR_TutorialFakeBaseComponent));
353 if (fakeBaseComponent)
354 {
355 fakeBaseComponent.m_bVisible = false;
356 fakeBaseComponent.ClearLinks();
357 }
358 }
359 }
360}
EMilitarySymbolIdentity
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition Color.c:13
Adds ability to attach an object to a slot.
proto external Managed FindComponent(typename typeName)
proto external IEntity GetChildren()
proto external BaseWorld GetWorld()
proto external void SetName(string name)
proto external EntityPrefabData GetPrefabData()
proto external IEntity GetSibling()
bool DepleteResourceValue(bool notifyChange=true)
EWeaponType
Definition EWeaponType.c:13