Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_DefendWaypoint.c
Go to the documentation of this file.
2 {
3 };
4 
7 {
8  [Attribute("", UIWidgets.EditBox, "Preset name, only informative. Switch using index.")];
9  private string m_sName;
10 
11  [Attribute("true", UIWidgets.CheckBox, "Use turrets?")];
12  bool m_bUseTurrets;
13 
14  [Attribute("", UIWidgets.Auto, "List tags to search in the preset")];
15  ref array<string> m_aTagsForSearch;
16 };
17 
19 {
20  [Attribute("0", UIWidgets.Object, "Fast init - units will be spawned on their defensive locations")];
21  private bool m_bFastInit;
22 
23  [Attribute("", UIWidgets.Object, "Defend presets")];
24  private ref array<ref SCR_DefendWaypointPreset> m_DefendPresets;
25 
26  private int m_iCurrentDefendPreset;
27 
28  //----------------------------------------------------------------------------------------
29  array<string> GetTagsForSearch()
30  {
31  return m_DefendPresets[m_iCurrentDefendPreset].m_aTagsForSearch;
32  }
33 
34  //----------------------------------------------------------------------------------------
35  bool GetUseTurrets()
36  {
37  return m_DefendPresets[m_iCurrentDefendPreset].m_bUseTurrets;
38  }
39 
40  //----------------------------------------------------------------------------------------
41  int GetCurrentDefendPreset()
42  {
43  return m_iCurrentDefendPreset;
44  }
45 
46  //----------------------------------------------------------------------------------------
47  bool SetCurrentDefendPreset(int newDefendPresetIndex)
48  {
49  if ((newDefendPresetIndex >= 0) && (newDefendPresetIndex < m_DefendPresets.Count()))
50  {
51  m_iCurrentDefendPreset = newDefendPresetIndex;
52  return true;
53  }
54  return false;
55  }
56 
57  //----------------------------------------------------------------------------------------
58  bool GetFastInit()
59  {
60  return m_bFastInit;
61  }
62 
63  //----------------------------------------------------------------------------------------
64  void SetFastInit(bool isFastInit)
65  {
66  m_bFastInit = isFastInit;
67  }
68 
69  //----------------------------------------------------------------------------------------
70  override SCR_AIWaypointState CreateWaypointState(SCR_AIGroupUtilityComponent groupUtilityComp)
71  {
72  return new SCR_AIDefendWaypointState(groupUtilityComp, this);
73  }
74 };
75 
77 {
78  override void OnDeselected()
79  {
80  super.OnDeselected();
81 
82  SCR_AIGroup myGroup = m_Utility.m_Owner;
83 
84  if (!myGroup)
85  return;
86 
87  array<AIAgent> groupMembers = {};
88  myGroup.GetAgents(groupMembers);
89 
90  AICommunicationComponent mailbox = myGroup.GetCommunicationComponent();
91  if (!mailbox)
92  return;
93 
94  foreach (AIAgent receiver: groupMembers)
95  {
96  if (receiver)
97  {
98  SCR_ChimeraAIAgent chimeraAgent = SCR_ChimeraAIAgent.Cast(receiver);
99  if (!chimeraAgent)
100  continue;
101 
102  SCR_AIInfoComponent aiInfo = chimeraAgent.m_InfoComponent;
103  if (!aiInfo || !aiInfo.HasUnitState(EUnitState.IN_TURRET))
104  continue;
105 
106  ChimeraCharacter character = ChimeraCharacter.Cast(receiver.GetControlledEntity());
107  if (character && character.IsInVehicle())
108  {
110 
111  msg2.SetText("Waypoint was deselected, leave vehicle");
112  msg2.SetReceiver(receiver);
113  mailbox.RequestBroadcast(msg2, receiver);
114  }
115  }
116  }
117  myGroup.ReleaseCompartments();
118  }
119 }
SCR_DefendWaypointClass
Definition: SCR_DefendWaypoint.c:1
SCR_AIWaypointState
Definition: SCR_AIWaypointState.c:6
SCR_DefendWaypoint
Definition: SCR_DefendWaypoint.c:18
SCR_TimedWaypoint
Definition: SCR_TimedWaypoint.c:5
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ChimeraAIAgent
Definition: SCR_ChimeraAIAgent.c:5
SCR_TimedWaypointClass
Definition: SCR_TimedWaypoint.c:1
SCR_DefendWaypointPreset
Definition: SCR_DefendWaypoint.c:6
SCR_AIDefendWaypointState
Definition: SCR_DefendWaypoint.c:76
SCR_AIMessage_GetOut
Definition: SCR_AIMessage.c:576
SCR_AIGroup
Definition: SCR_AIGroup.c:68
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468