Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableWaypointComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor (Editables)", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3 {
4 }
5 
7 
9 class SCR_EditableWaypointComponent : SCR_EditableEntityComponent
10 {
11  [RplProp(onRplName: "OnPreWaypointIdRpl")]
12  protected RplId m_PrevWaypointId;
13 
14  [RplProp()]
15  protected bool m_bIsCurrent;
16 
17  [RplProp()]
18  protected int m_iIndex;
19 
21  protected SCR_EditableEntityComponent m_PrevWaypoint;
22 
23  //------------------------------------------------------------------------------------------------
28  void SetWaypointIndex(int index, bool isCurrent, SCR_EditableEntityComponent prevWaypoint)
29  {
30  m_iIndex = index;
31  m_bIsCurrent = isCurrent;
32  m_PrevWaypoint = prevWaypoint;
33  m_PrevWaypointId = Replication.FindId(prevWaypoint);
34  Replication.BumpMe();
35  }
36 
37  //------------------------------------------------------------------------------------------------
41  {
42  return m_iIndex;
43  }
44 
45  //------------------------------------------------------------------------------------------------
48  bool IsCurrent()
49  {
50  return m_bIsCurrent;
51  }
52 
53  //------------------------------------------------------------------------------------------------
57  {
58  if (m_PrevWaypoint)
59  return m_PrevWaypoint;
60  else
61  return m_Group;
62  }
63 
64  //------------------------------------------------------------------------------------------------
65  protected void OnPreWaypointIdRpl()
66  {
67  m_PrevWaypoint = SCR_EditableEntityComponent.Cast(Replication.FindItem(m_PrevWaypointId));
68  }
69 
70  //------------------------------------------------------------------------------------------------
71  override bool CanDuplicate(out notnull set<SCR_EditableEntityComponent> outRecipients)
72  {
73  SCR_EditableEntityComponent groupComponent = GetAIGroup();
74  if (groupComponent)
75  outRecipients.Insert(groupComponent);
76 
77  return true;
78  }
79 
80  //------------------------------------------------------------------------------------------------
81  override Faction GetFaction()
82  {
83  if (!m_Group)
84  return null;
85 
86  Faction faction = m_Group.GetFaction();
87  return faction;
88  }
89 
90  //------------------------------------------------------------------------------------------------
92  {
93  return m_Group;
94  }
95 
96  //------------------------------------------------------------------------------------------------
97  override void OnParentEntityChanged(SCR_EditableEntityComponent parentEntity, SCR_EditableEntityComponent parentEntityPrev, bool changedByUser)
98  {
99  if (!parentEntity)
100  return;
101 
102  EEditableEntityType parentType = parentEntity.GetEntityType();
103  switch (parentType)
104  {
105  case EEditableEntityType.GROUP:
106  case EEditableEntityType.CHARACTER:
107  {
108  SCR_EditableEntityComponent group = parentEntity.GetAIGroup();
109  if (!group) break;
110 
111  m_Group = group;
112  super.OnParentEntityChanged(group, parentEntityPrev, changedByUser);
113  break;
114  }
115  }
116  }
117 
118  //------------------------------------------------------------------------------------------------
119  override bool GetPos(out vector pos)
120  {
121  if (m_Group)
122  return super.GetPos(pos);
123  else
124  return false;
125  }
126 
127  //------------------------------------------------------------------------------------------------
129  {
130  if (recipient)
131  {
132  AIGroup group = AIGroup.Cast(recipient.GetOwner());
133  if (group)
134  {
135  if (!isQueue)
136  {
137  SCR_EditableGroupComponent editableGroup = SCR_EditableGroupComponent.Cast(recipient);
138  if (editableGroup)
139  editableGroup.ClearWaypoints();
140  }
141 
142  group.AddWaypoint(AIWaypoint.Cast(GetOwner()));
143  }
144  }
145  return this;
146  }
147 
148  //------------------------------------------------------------------------------------------------
149  override void OnDelete(IEntity owner)
150  {
151  super.OnDelete(owner);
152 
153  //--- Manually remove the waypoint entity from group's list of waypoints - it doesn't happen automatically
154  if (m_Group && IsServer())
155  {
156  AIGroup aiGroup = AIGroup.Cast(m_Group.GetOwner());
157  if (aiGroup)
158  aiGroup.RemoveWaypoint(AIWaypoint.Cast(owner));
159  }
160  }
161 }
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
IsCurrent
bool IsCurrent()
Definition: SCR_EditableWaypointComponent.c:48
OnDelete
override void OnDelete(IEntity owner)
Definition: SCR_EditableWaypointComponent.c:149
m_Group
protected SCR_AIGroup m_Group
Definition: SCR_CallsignGroupComponent.c:10
SCR_EditableGroupComponent
void SCR_EditableGroupComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_EditableGroupComponent.c:703
GetWaypointIndex
int GetWaypointIndex()
Definition: SCR_EditableWaypointComponent.c:40
CanDuplicate
override bool CanDuplicate(out notnull set< SCR_EditableEntityComponent > outRecipients)
Definition: SCR_EditableWaypointComponent.c:71
GetPos
override bool GetPos(out vector pos)
Definition: SCR_EditableWaypointComponent.c:119
GetFaction
override Faction GetFaction()
Definition: SCR_EditableWaypointComponent.c:81
RplProp
SCR_EditableWaypointComponentClass SCR_EditableEntityComponentClass RplProp(onRplName:"OnPreWaypointIdRpl")
Special configuration for editable waypoint.
Definition: SCR_EditableWaypointComponent.c:11
OnPreWaypointIdRpl
protected void OnPreWaypointIdRpl()
Definition: SCR_EditableWaypointComponent.c:65
EEditableEntityType
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
Definition: EEditableEntityType.c:5
EOnEditorPlace
override SCR_EditableEntityComponent EOnEditorPlace(out SCR_EditableEntityComponent parent, SCR_EditableEntityComponent recipient, EEditorPlacingFlags flags, bool isQueue, int playerID=0)
Definition: SCR_EditableWaypointComponent.c:128
EEditorPlacingFlags
EEditorPlacingFlags
Definition: EEditorPlacingFlags.c:1
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
Faction
Definition: Faction.c:12
m_iIndex
private int m_iIndex
Definition: SCR_StressTestGroupActivation.c:11
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_EditableWaypointComponentClass
Definition: SCR_EditableWaypointComponent.c:2
GetPrevWaypoint
SCR_EditableEntityComponent GetPrevWaypoint()
Definition: SCR_EditableWaypointComponent.c:56
SCR_EditableEntityComponentClass
Definition: SCR_EditableEntityComponentClass.c:2
OnParentEntityChanged
override void OnParentEntityChanged(SCR_EditableEntityComponent parentEntity, SCR_EditableEntityComponent parentEntityPrev, bool changedByUser)
Definition: SCR_EditableWaypointComponent.c:97
GetAIGroup
override SCR_EditableEntityComponent GetAIGroup()
Definition: SCR_EditableWaypointComponent.c:91
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180