Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkActionQRFDispacher.c
Go to the documentation of this file.
7
9class SCR_ScenarioFrameworkActionQRFDispacher : SCR_ScenarioFrameworkActionBase
10{
11 [Attribute("X_QRF", UIWidgets.Auto, "Name of the QRF layer that contains pool of spawn points")]
12 protected string m_sQRFLayerName;
13
14 [Attribute(SCR_EQRFThresholdType.DEAD_UNITS.ToString(), UIWidgets.ComboBox, desc: "Type of the threshold threshold that will be used to determine if it should spawn QRF", "", ParamEnumArray.FromEnum(SCR_EQRFThresholdType))]
15 protected SCR_EQRFThresholdType m_eThresholdType;// <= REMAINING_UNITS, DEAD_UNITS, PROC_LOST_UNITS
16
17 [Attribute("5", UIWidgets.Auto, "Numeric value which interpretation depends on the m_eThresholdType f.e. if Threshold Type == REMAINING_UNITS then if Threshold >= (number of units alive) then send QRF")]
18 protected int m_iThreshold;
19
20 [Attribute("5", UIWidgets.Auto, "How many times this Area can send QRF where -1 == unlimited")]
21 protected int m_iNumberOfAvailableQRFWaves;// - even if we have more QRF groups but we are out of waves then there wont be new QRF sent
22
23 [Attribute("1", UIWidgets.Auto, "How much threat level has to be increased each time that threshold is reached")]
24 protected float m_fThreatLevelEscalation;
25
26 [Attribute("0", UIWidgets.Auto, "How long (in seconds) game should wait when threshold is reached before spawning QRF where 0 == imminently", "0 inf 1")]
27 protected float m_fQRFSpawnDelay;
28
29 [Attribute("300", UIWidgets.Auto, "How long (in seconds) game should wait until next QRF will be possible to be requested where 0 == no delay", "0 inf 1")]
30 protected float m_fQRFNextWaveDelay;
31
32 [Attribute(desc: "List of possible QRF groups to spawn")]
33 protected ref array<ref SCR_QRFGroupConfig> m_aGroupList;
34
35 [Attribute(desc: "List defining maximal distance for QRF unit of given type")]
36 protected ref array<ref SCR_QRFTypeMaxDistance> m_aQRFMaxDistanceConfig;
37
38 [Attribute(desc: "List of waypoints for QRF that will be applied in order (to aplicable group type)")]
39 protected ref array<ref SCR_QRFWaypointConfig> m_aWPConfig;
40
41 [Attribute(desc: "Sound event name that will be played on dead soldier entity when QRF is requested")]
42 protected string m_sQRFRequestedSoundEventName;
43
44 [Attribute(desc: "Sound event name that will be played on dead soldier entity when QRF is spawned")]
45 protected string m_sQRFSentSoundEventName;
46
47 [Attribute(desc: "'*.acp' file which contains desired sound events", params: "acp")]
48 protected ResourceName m_sSoundProjectFile;
49
50 [Attribute(desc: "Actions that will be triggered once QRF are dispatched.")]
51 ref array<ref SCR_ScenarioFrameworkActionBase> m_aActions;
52
53 protected ref array<SCR_ScenarioFrameworkQRFSlotAI> m_aQRFSpawnPoints = {};
54 protected SCR_ScenarioFrameworkArea m_AreaFramework;
55 protected SCR_ScenarioFrameworkLayerBase m_QRFLayer;
56 protected int m_iNumberOfSoldiersInTheArea;
57 protected int m_iRemovedSoldier;
58 protected float m_fNextWaveDelayClock;
59 protected float m_fThreatLevel = 1;
60 protected int m_iSpawnTickets;
61 protected bool m_bWaitingForDelayedSpawn;
62 protected bool m_bWaitingForNextWave;
63 protected vector m_vTargetPosition;
64 protected ref array<ref SCR_QRFVehicleSpawnConfig> m_aVehicleSpawnQueueConfig = {};
65
66 //------------------------------------------------------------------------------------------------
69 protected bool WatchAIGroup(IEntity entities)
70 {
71 return WatchAIGroup({entities});
72 }
73
74 //------------------------------------------------------------------------------------------------
77 protected bool WatchAIGroup(array<IEntity> entities)
78 {
79 if (!entities)
80 return false;
81
82 bool result;
83 SCR_AIGroup aiGroup;
84 foreach (IEntity entity : entities)
85 {
86 aiGroup = GetAIGroup(entity);
87 if (!aiGroup)
88 continue;
89
90 aiGroup.GetOnAgentRemoved().Remove(OnGroupCompositionChanged);
91 aiGroup.GetOnAgentRemoved().Insert(OnGroupCompositionChanged);
92 aiGroup.GetOnAllDelayedEntitySpawned().Remove(OnDelayedGroupMembersSpawned);
93 aiGroup.GetOnAllDelayedEntitySpawned().Insert(OnDelayedGroupMembersSpawned);
94 if (aiGroup.GetAgentsCount() == 0)
95 m_iNumberOfSoldiersInTheArea++;
96 else
97 m_iNumberOfSoldiersInTheArea += aiGroup.GetAgentsCount();
98
99 result = true;
100 }
101
102 return result;
103 }
104
105 //------------------------------------------------------------------------------------------------
108 {
109 if (!entity)
110 return null;
111
112 SCR_AIGroup aiGroup = SCR_AIGroup.Cast(entity);
113 if (aiGroup)
114 return aiGroup;
115
116 AIAgent agent = AIAgent.Cast(entity);
117 if (agent)
118 return SCR_AIGroup.Cast(agent.GetParentGroup());
119
120 if (!SCR_ChimeraCharacter.Cast(entity))
121 return null;
122
123 AIControlComponent control = AIControlComponent.Cast(entity.FindComponent(AIControlComponent));
124 if (!control)
125 return null;
126
127 agent = control.GetControlAIAgent();
128 if (!agent)
129 return null;
130
131 return SCR_AIGroup.Cast(agent.GetParentGroup());
132 }
133
134 //------------------------------------------------------------------------------------------------
135 protected void OnDelayedGroupMembersSpawned(SCR_AIGroup group)
136 {
137 m_iNumberOfSoldiersInTheArea++;
138 }
139
140 //------------------------------------------------------------------------------------------------
141 protected void OnGroupCompositionChanged(SCR_AIGroup group, AIAgent agent)
142 {
143 if (!agent)
144 return;
145
146 if (!agent.GetControlledEntity())
147 return;
148
149 SCR_ChimeraCharacter char = SCR_ChimeraCharacter.Cast(agent.GetControlledEntity());
150 if (!char)
151 return;
152
153 SCR_CharacterControllerComponent controller = SCR_CharacterControllerComponent.Cast(char.GetCharacterController());
154 if (!controller || controller.GetLifeState() != ECharacterLifeState.DEAD)
155 return;
156
157 vector tmpVec = agent.GetControlledEntity().GetOrigin();
158 if (m_vTargetPosition == vector.Zero)
159 m_vTargetPosition = tmpVec;
160 else
161 m_vTargetPosition = vector.Lerp(m_vTargetPosition, tmpVec, 0.95);
162
163 m_iRemovedSoldier++;
164 ThresholdValidation(char)
165 }
166
167 //------------------------------------------------------------------------------------------------
168 protected void ThresholdValidation(IEntity killedEntity = null)
169 {
170 bool startQRFProcedure;
171 switch (m_eThresholdType)
172 {
173 case SCR_EQRFThresholdType.DEAD_UNITS :
174 {
175 if (m_iRemovedSoldier >= m_iThreshold)
176 startQRFProcedure = true;
177
178 } break;
179
180 case SCR_EQRFThresholdType.REMAINING_UNITS :
181 {
182 if (m_iNumberOfSoldiersInTheArea - m_iRemovedSoldier <= m_iThreshold)
183 startQRFProcedure = true;
184
185 } break;
186
187 case SCR_EQRFThresholdType.PROC_LOST_UNITS :
188 {
189 if (m_iNumberOfSoldiersInTheArea > 0 && (m_iNumberOfSoldiersInTheArea - m_iRemovedSoldier) * 100 / m_iNumberOfSoldiersInTheArea <= m_iThreshold)
190 startQRFProcedure = true;
191
192 } break;
193 }
194
195 if (!startQRFProcedure)
196 return;
197
198 if (m_bWaitingForDelayedSpawn)
199 {
200 if (!m_bWaitingForNextWave && m_iNumberOfAvailableQRFWaves - 1 > 0 && m_fQRFSpawnDelay > 0)
201 {
202 float callTime = m_fNextWaveDelayClock - GetGame().GetWorld().GetWorldTime();
203 if (callTime < 0)
204 callTime = 0;
205
206 m_bWaitingForNextWave = true;
207 SCR_ScenarioFrameworkSystem.GetCallQueuePausable().CallLater(StartQRFProcedure, callTime, param1: killedEntity);
208 }
209 return;
210 }
211
212 if (m_bWaitingForNextWave)
213 return;
214
215 StartQRFProcedure(killedEntity);
216 }
217
218 //------------------------------------------------------------------------------------------------
219 protected void ThresholdHandling()
220 {
221 switch (m_eThresholdType)
222 {
223 case SCR_EQRFThresholdType.DEAD_UNITS :
224 {
225 m_iRemovedSoldier = 0;
226 } break;
227
228 case SCR_EQRFThresholdType.REMAINING_UNITS :
229 {
230 m_iNumberOfSoldiersInTheArea -= m_iRemovedSoldier;
231 } break;
232 }
233 }
234
235 //------------------------------------------------------------------------------------------------
236 protected void StartQRFProcedure(IEntity killedEntity)
237 {
238 if (m_iNumberOfAvailableQRFWaves == 0)
239 return;
240
241 float time = GetGame().GetWorld().GetWorldTime();
242 if (m_fNextWaveDelayClock > time && !m_bWaitingForDelayedSpawn && !m_bWaitingForNextWave)
243 return;
244
245 if (m_fQRFSpawnDelay > 0)
246 {
247 if (!m_bWaitingForDelayedSpawn)
248 {
249 if (m_bWaitingForNextWave)
250 m_bWaitingForNextWave = false;
251
252 ThresholdHandling();
253 m_fNextWaveDelayClock = time + m_fQRFNextWaveDelay * 1000;
254 m_bWaitingForDelayedSpawn = true;
255 SCR_ScenarioFrameworkSystem.GetCallQueuePausable().CallLater(StartQRFProcedure, m_fQRFSpawnDelay * 1000, param1: killedEntity);
256 if (killedEntity)
257 DoPlaySoundOnEntityPosition(killedEntity, m_sSoundProjectFile, m_sQRFRequestedSoundEventName);
258
259 return;
260 }
261 else
262 {
263 m_bWaitingForDelayedSpawn = false;
264 }
265 }
266 else
267 {
268 ThresholdHandling();
269 m_fNextWaveDelayClock = time + m_fQRFNextWaveDelay * 1000;
270 }
271
272 if (killedEntity)
273 DoPlaySoundOnEntityPosition(killedEntity, m_sSoundProjectFile, m_sQRFSentSoundEventName);
274
275 m_iNumberOfSoldiersInTheArea -= m_iRemovedSoldier;
276 m_iSpawnTickets += m_fThreatLevel;
277 m_fThreatLevel += m_fThreatLevelEscalation;
278 if (m_aQRFSpawnPoints.IsEmpty())
279 return;
280
281 while (m_iSpawnTickets > 0)
282 {
283 SCR_QRFGroupConfig selectedGroup = SelectRandomGroup(m_iSpawnTickets);
284 if (!selectedGroup)
285 {
286 m_iSpawnTickets--;
287 continue;
288 }
289
290 m_iSpawnTickets -= selectedGroup.GetSpawnCost();
291 SCR_ScenarioFrameworkQRFSlotAI selectedSpawnPoint = SelectRandomSpawnpoint(m_aQRFSpawnPoints, selectedGroup.GetGroupType());
292 if (!selectedSpawnPoint)
293 {
294 m_iSpawnTickets--;
295 continue;
296 }
297
298 if (selectedGroup.GetNumberOfAvailableGroups() > 0)
299 selectedGroup.SetNumberOfAvailableGroups(selectedGroup.GetNumberOfAvailableGroups() - 1);
300
301 selectedSpawnPoint.SetObjectToSpawn(selectedGroup.GetGroupPrefabName());
302 selectedSpawnPoint.SetEnableRepeatedSpawn(true);
303 selectedSpawnPoint.SetIsTerminated(false);
304 if (selectedSpawnPoint.GetNumberOfExistingWaypoints())
305 selectedSpawnPoint.ClearWaypoints();
306
307 selectedSpawnPoint.Init(m_AreaFramework, SCR_ScenarioFrameworkEActivationType.SAME_AS_PARENT);
308 IEntity spawnedEntity = selectedSpawnPoint.GetSpawnedEntity();
309 SCR_AIGroup aiGroup = GetAIGroup(spawnedEntity);
310 if (aiGroup)
311 {
312 if (WatchAIGroup(aiGroup))
313 {
314 vector wpPosition;
315 foreach (SCR_QRFWaypointConfig wp : m_aWPConfig)
316 {
317 if (wp.GetOrderType() != SCR_EQRFGroupOrderType.ANY && wp.GetOrderType() != selectedGroup.GetGroupType())
318 continue;
319
320 if (wp.GetDistanceOffsetToTargetLocation())
321 wpPosition = SCR_Math3D.MoveTowards(m_vTargetPosition, selectedSpawnPoint.GetOwner().GetOrigin(), wp.GetDistanceOffsetToTargetLocation());
322 else
323 wpPosition = m_vTargetPosition;
324
325 if (float.AlmostEqual(vector.DistanceXZ(wpPosition, selectedSpawnPoint.GetOwner().GetOrigin()), 0, 1))
326 continue;
327
328 wpPosition[1] = GetGame().GetWorld().GetSurfaceY(wpPosition[0], wpPosition[2]);
329 AIWaypoint aiWP = selectedSpawnPoint.CreateWaypoint(wpPosition, wp.GetWaypointPrefabName());
330 if (aiWP)
331 aiGroup.AddWaypoint(aiWP);
332 }
333 }
334 }
335 else
336 {
337 if (Vehicle.Cast(spawnedEntity))
338 {
339 SCR_BaseCompartmentManagerComponent compartmentManager = SCR_BaseCompartmentManagerComponent.Cast(spawnedEntity.FindComponent(SCR_BaseCompartmentManagerComponent));
340 if (compartmentManager)
341 {
342 compartmentManager.GetOnDoneSpawningDefaultOccupants().Insert(OnFinishedSpawningVehicleOccupants);
343 array<ECompartmentType> compartmentTypes = {ECompartmentType.PILOT, ECompartmentType.TURRET};
344 if (selectedGroup.GetGroupType() == SCR_EQRFGroupType.MOUNTED_INFANTRY)
345 compartmentTypes.Insert(ECompartmentType.CARGO);
346
347 m_aVehicleSpawnQueueConfig.Insert(new SCR_QRFVehicleSpawnConfig(compartmentManager, selectedGroup.GetGroupType(), m_vTargetPosition, selectedSpawnPoint));
348 compartmentManager.SpawnDefaultOccupants(compartmentTypes);
349 }
350 }
351 }
352 }
353 if (m_iNumberOfAvailableQRFWaves > 0)
354 m_iNumberOfAvailableQRFWaves--;
355
356 m_vTargetPosition = vector.Zero;
357
358 foreach (SCR_ScenarioFrameworkActionBase actions : m_aActions)
359 {
360 actions.OnActivate(m_Entity);
361 }
362 }
363
364 //------------------------------------------------------------------------------------------------
365 protected SCR_QRFGroupConfig SelectRandomGroup(int maxCost)
366 {
367 //first check if there even are groups that we can afford
368 bool availableGroupAtFullPrice;
369 array<SCR_QRFGroupConfig> verifiedList = {};
370 foreach (SCR_QRFGroupConfig group : m_aGroupList)
371 {
372 if (!group)
373 continue;
374
375 if (group.GetNumberOfAvailableGroups() == -1 || group.GetNumberOfAvailableGroups() > 0)
376 {
377 if (group.GetSpawnCost() == maxCost)
378 {
379 if (!availableGroupAtFullPrice)
380 {
381 availableGroupAtFullPrice = true;
382 verifiedList.Clear();
383 }
384 verifiedList.Insert(group);
385 }
386 else if (group.GetSpawnCost() < maxCost && !availableGroupAtFullPrice)
387 {
388 verifiedList.Insert(group);
389 }
390 }
391 }
392
393 if (availableGroupAtFullPrice)
394 return verifiedList.GetRandomElement();
395
396 SCR_QRFGroupConfig returnedGroup;
397 if (!verifiedList.IsEmpty())
398 {
399 int i, numOfTries, count = verifiedList.Count();
400 while (numOfTries < 10)
401 {
402 i = Math.RandomInt(0, count);
403 if (!returnedGroup || returnedGroup && returnedGroup.GetSpawnCost() < verifiedList[i].GetSpawnCost())
404 returnedGroup = verifiedList[i];
405
406 numOfTries++;
407 }
408 }
409
410 return returnedGroup;
411 }
412
413 //------------------------------------------------------------------------------------------------
414 protected SCR_ScenarioFrameworkQRFSlotAI SelectRandomSpawnpoint(array<SCR_ScenarioFrameworkQRFSlotAI> aListOfSpawnPoints, SCR_EQRFGroupType searchedType)
415 {
416 float maxSpawnDistance = GetMaxDistanceForUnitType(searchedType);
417 array<SCR_ScenarioFrameworkQRFSlotAI> verifiedList = {};
418 foreach (SCR_ScenarioFrameworkQRFSlotAI spawn : aListOfSpawnPoints)
419 {
420 if (!(spawn.GetGroupType() & searchedType))
421 continue;
422
423 if (!CheckSpawnPointSafeZones(spawn.GetOwner().GetOrigin(), spawn.GetSpawnSafeZones(), searchedType))
424 continue;
425
426 if (maxSpawnDistance > -1 && vector.Distance(m_vTargetPosition, spawn.GetOwner().GetOrigin()) > maxSpawnDistance)
427 continue;
428
429 verifiedList.Insert(spawn);
430 }
431
432 int index = -1;
433 if (verifiedList.Count() > 0)
434 return verifiedList.GetRandomElement();
435
436 float distanceToTarget, cloasestPosDistance = float.MAX;
437 foreach (int i, SCR_ScenarioFrameworkQRFSlotAI spawn : aListOfSpawnPoints) //int i = aListOfSpawnPoints.Count() - 1; i >= 0; i--)
438 {
439 if ( !(spawn.GetGroupType() & searchedType) )
440 continue;
441
442 if (!CheckSpawnPointSafeZones(spawn.GetOwner().GetOrigin(), spawn.GetSpawnSafeZones(), searchedType))
443 continue;
444
445 distanceToTarget = vector.Distance(m_vTargetPosition, spawn.GetOwner().GetOrigin());
446 if (distanceToTarget < cloasestPosDistance)
447 {
448 cloasestPosDistance = distanceToTarget;
449 index = i;
450 }
451 }
452
453 if (index == -1)
454 return null;
455
456 return aListOfSpawnPoints[index];
457 }
458
459 //------------------------------------------------------------------------------------------------
461 protected bool CheckSpawnPointSafeZones(vector spawnPointPosition, array<ref SCR_QRFSpawnSafeZone> spawnSafeZones, SCR_EQRFGroupType searchedType)
462 {
463 if (spawnSafeZones.IsEmpty())
464 return true;
465
466 array<vector> aObserversPositions = {};
467 array<int> playerIds = {};
468 PlayerManager playerManager = GetGame().GetPlayerManager();
469 IEntity player;
470 SCR_DamageManagerComponent damageManager;
471 playerManager.GetPlayers(playerIds);
472
473 foreach (int playerId : playerIds)
474 {
475 player = playerManager.GetPlayerControlledEntity(playerId);
476 if (!player)
477 continue;
478
479 damageManager = SCR_DamageManagerComponent.GetDamageManager(player);
480 if (damageManager && damageManager.GetState() != EDamageState.DESTROYED)
481 aObserversPositions.Insert(player.GetOrigin());
482 }
483
484 foreach (SCR_QRFSpawnSafeZone safeZone : spawnSafeZones)
485 {
486 if (safeZone.GetGroupType() != searchedType)
487 continue;
488
489 foreach (vector observerPos : aObserversPositions)
490 {
491 if (vector.Distance(observerPos, spawnPointPosition) < safeZone.GetMinDistanceToClosestObserver())
492 return false;
493 }
494 }
495
496 return true;
497 }
498
499 //------------------------------------------------------------------------------------------------
500 protected float GetMaxDistanceForUnitType(SCR_EQRFGroupType unitType)
501 {
502 foreach (SCR_QRFTypeMaxDistance conf : m_aQRFMaxDistanceConfig)
503 {
504 if (conf.GetGroupType() == unitType)
505 return conf.GetMaxSpawnDistance();
506 }
507 return -1;
508 }
509
510 //------------------------------------------------------------------------------------------------
512 protected void OnFinishedSpawningVehicleOccupants(SCR_BaseCompartmentManagerComponent compartmentManager, array<IEntity> occupants, bool wasCanceled)
513 {
514 compartmentManager.GetOnDoneSpawningDefaultOccupants().Remove(OnFinishedSpawningVehicleOccupants);
515 if (wasCanceled)
516 return;
517
518 if (occupants.IsEmpty())
519 return;
520
521 SCR_ChimeraCharacter occupant = SCR_ChimeraCharacter.Cast(occupants[0]);
522 if (!occupant)
523 return;
524
525 AIControlComponent control = AIControlComponent.Cast(occupant.FindComponent(AIControlComponent));
526 if (!control)
527 return;
528
529 AIAgent agent = control.GetControlAIAgent();
530 if (!agent)
531 return;
532
533 SCR_AIGroup aiGroup = SCR_AIGroup.Cast(agent.GetParentGroup());
534 if (!aiGroup)
535 return;
536
537 if (!WatchAIGroup(aiGroup))
538 return;
539
540 vector wpPosition;
541 for (int i, count = m_aVehicleSpawnQueueConfig.Count(); i < count; i++)
542 {
543 if (m_aVehicleSpawnQueueConfig[i].m_VehicleCompartmentMGR != compartmentManager)
544 continue;
545
546 foreach (SCR_QRFWaypointConfig wp : m_aWPConfig)
547 {
548 if (wp.GetOrderType() != SCR_EQRFGroupOrderType.ANY && wp.GetOrderType() != m_aVehicleSpawnQueueConfig[i].m_eGroupType)
549 continue;
550
551 if (wp.GetDistanceOffsetToTargetLocation())
552 wpPosition = SCR_Math3D.MoveTowards(m_aVehicleSpawnQueueConfig[i].m_vTargetPosition, occupant.GetOrigin(), wp.GetDistanceOffsetToTargetLocation());
553 else
554 wpPosition = m_aVehicleSpawnQueueConfig[i].m_vTargetPosition;
555
556 if (float.AlmostEqual(vector.DistanceXZ(wpPosition, occupant.GetOrigin()), 0, 1))
557 continue;
558
559 AIWaypoint aiWP = m_aVehicleSpawnQueueConfig[i].m_Slot.CreateWaypoint(wpPosition, wp.GetWaypointPrefabName());
560 if (aiWP)
561 aiGroup.AddWaypoint(aiWP);
562 }
563 m_aVehicleSpawnQueueConfig.Remove(i);
564 break;
565 }
566 }
567
568 //------------------------------------------------------------------------------------------------
570 protected void DoPlaySoundOnEntityPosition(IEntity entity, string soundFileName, string soundEventName)
571 {
572 if (!entity)
573 return;
574
575 if (SCR_StringHelper.IsEmptyOrWhiteSpace(soundFileName))
576 return;
577
578 if (SCR_StringHelper.IsEmptyOrWhiteSpace(soundEventName))
579 return;
580
581 SCR_ScenarioFrameworkSystem scenarioFrameworkSystem = SCR_ScenarioFrameworkSystem.GetInstance();
582 if (!scenarioFrameworkSystem)
583 return;
584
585 SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.Cast(entity.FindComponent(SCR_GadgetManagerComponent));
586 if (!gadgetManager)
587 return;
588
589 if (!gadgetManager.GetGadgetByType(EGadgetType.RADIO))
590 return;
591
592 scenarioFrameworkSystem.PlaySoundOnEntityPosition(entity, soundFileName, soundEventName);
593 }
594
595 //------------------------------------------------------------------------------------------------
596 override void Init(IEntity entity)
597 {
599 if (!thisLayer)
600 return;
601
602 m_AreaFramework = thisLayer.GetParentArea();
603 if (!m_AreaFramework)
604 return;
605
606 super.Init(entity);
607 }
608
609 //------------------------------------------------------------------------------------------------
610 override void OnActivate(IEntity object)
611 {
612 if (!CanActivate())
613 return;
614
615 array<SCR_ScenarioFrameworkLayerBase> childLayers = m_AreaFramework.GetChildrenEntities();
616 if (childLayers.IsEmpty())
617 {
618 IEntity child = m_AreaFramework.GetOwner().GetChildren();
620 while (child)
621 {
623 if (layer)
624 childLayers.Insert(layer);
625
626 child = child.GetSibling();
627 }
628 if (childLayers.IsEmpty())
629 return;
630 }
631
632 m_iNumberOfSoldiersInTheArea = 0;
633 foreach (SCR_ScenarioFrameworkLayerBase layer : childLayers)
634 {
635 if (!layer)
636 continue;
637
638 if (layer.GetName() == m_sQRFLayerName)
639 {
640 m_QRFLayer = layer;
641 IEntity child = layer.GetOwner().GetChildren();
642 SCR_ScenarioFrameworkQRFSlotAI qrfSlot;
643 while (child)
644 {
645 qrfSlot = SCR_ScenarioFrameworkQRFSlotAI.Cast(child.FindComponent(SCR_ScenarioFrameworkQRFSlotAI));
646 if (qrfSlot && !m_aQRFSpawnPoints.Contains(qrfSlot))
647 m_aQRFSpawnPoints.Insert(qrfSlot);
648
649 child = child.GetSibling();
650 }
651 continue;
652 }
653 }
654
655 if (m_aQRFSpawnPoints && m_aQRFSpawnPoints.IsEmpty())
656 Print("SCR_ScenarioFrameworkActionQRFDispacher.OnActivate: Layer " + m_AreaFramework.GetName() + " doesn't have any spawn points for its QRF dispatcher!", LogLevel.ERROR);
657
658 CheckForAIToWatch(m_AreaFramework.GetOwner());
659 }
660
661 //------------------------------------------------------------------------------------------------
663 protected void CheckForAIToWatch(IEntity entity)
664 {
665 IEntity child = entity.GetChildren();
667 while (child)
668 {
670 if (SCR_ScenarioFrameworkSlotAI.Cast(layer) || SCR_ScenarioFrameworkSlotTaskAI.Cast(layer))
671 WatchAIGroup(layer.GetSpawnedEntities());
672 else if (layer && layer.GetName() != m_sQRFLayerName)
673 CheckForAIToWatch(child);
674
675 child = child.GetSibling();
676 }
677 }
678
679 //------------------------------------------------------------------------------------------------
680 override array<ref SCR_ScenarioFrameworkActionBase> GetSubActions()
681 {
682 return m_aActions;
683 }
684}
override void Init()
ECompartmentType
ArmaReforgerScripted GetGame()
Definition game.c:1398
LayerPresets layer
void SCR_AIGroup(IEntitySource src, IEntity parent)
enum EAITargetInfoCategory m_Entity
SCR_CharacterControllerComponent GetCharacterController()
ref SCR_SortedArray< SCR_BaseEditorAction > m_aActions
override void OnActivate()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
override SCR_EditableEntityComponent GetAIGroup()
Configs ServerBrowser KickDialogs conf
SCR_EQRFGroupType
void SCR_QRFWaypointConfig(ResourceName wpPrefab, SCR_EQRFGroupOrderType groupType=SCR_EQRFGroupOrderType.ANY, int distanceOffset=0, vector wpPosition=vector.Zero)
SCR_EQRFGroupOrderType
Extension to allow for comparing orders with type of a group to which it should apply with option to ...
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum SCR_EQRFThresholdType BaseContainerProps()
void SCR_ScenarioFrameworkLayerBase(IEntityComponentSource src, IEntity ent, IEntity parent)
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
proto external vector GetOrigin()
proto external IEntity GetChildren()
proto external IEntity GetSibling()
ScriptInvoker GetOnAgentRemoved()
ScriptInvokerBase< ScriptInvokerAIGroup > GetOnAllDelayedEntitySpawned()
IEntity GetGadgetByType(EGadgetType type)
void PlaySoundOnEntityPosition(IEntity object, string soundFile, string soundEventName)
enum EPhysicsLayerPresets Vehicle
Definition gameLib.c:24
ECharacterLifeState
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
SCR_FieldOfViewSettings Attribute
EDamageState
Tuple param1