3 static const string PORT_FIRETEAM_IN =
"FireteamIn";
4 static const string PORT_TARGET_IN =
"TargetIn";
5 static const string PORT_MOVING_MEMBER_OUT =
"MovingMemberOut";
6 static const string PORT_COVERING_MEMBER_OUT =
"CoveringMemberOut";
8 SCR_AIGroupUtilityComponent m_GroupUtilityComponent;
10 int m_selectedIndexForMovement = 0, m_selectedIndexForCovering = 0;
13 override bool VisibleInPalette() {
return true;}
16 override void OnInit(AIAgent owner)
18 AIGroup group = AIGroup.Cast(owner);
20 m_GroupUtilityComponent = SCR_AIGroupUtilityComponent.Cast(group.FindComponent(SCR_AIGroupUtilityComponent));
29 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
31 if (!m_GroupUtilityComponent || !m_GroupUtilityComponent.m_aInfoComponents)
32 return ENodeResult.FAIL;
34 ClearVariable(PORT_MOVING_MEMBER_OUT);
35 ClearVariable(PORT_COVERING_MEMBER_OUT);
37 int teamSelection,length;
38 if (!GetVariableIn(PORT_FIRETEAM_IN,teamSelection))
40 return NodeError(
this, owner,
"Missing team selection for this node.");
44 if (!GetVariableIn(PORT_TARGET_IN, targetEntity))
45 return NodeError(
this, owner,
"Missing target entity for this node");
48 return ENodeResult.FAIL;
52 bool isCoveringPresent =
false, isMovingPresent =
false, isCoveringSelected =
false, isMovingSelected =
false;
53 SCR_AIInfoComponent aIInfoComponent;
54 length = m_GroupUtilityComponent.m_aInfoComponents.Count();
56 return ENodeResult.FAIL;
60 int selectedIndexForMovement;
61 int selectedIndexForMovementPrevious = m_selectedIndexForMovement;
62 for (
int i = 0; i < length; i++)
64 aIInfoComponent = m_GroupUtilityComponent.m_aInfoComponents[i];
65 if( !aIInfoComponent )
94 return ENodeResult.FAIL;
97 if (!isMovingSelected)
99 return ENodeResult.RUNNING;
102 for (
int i = 1; i <= length; i++)
104 int indexForCover = (i + m_selectedIndexForCovering) % length;
106 if (indexForCover == m_selectedIndexForMovement)
109 aIInfoComponent = m_GroupUtilityComponent.m_aInfoComponents[indexForCover];
110 if( !aIInfoComponent )
131 if (!isCoveringPresent)
133 return ENodeResult.FAIL;
136 if (!isCoveringSelected)
139 m_selectedIndexForMovement = selectedIndexForMovementPrevious;
140 return ENodeResult.RUNNING;
143 agent = AIAgent.Cast(m_GroupUtilityComponent.m_aInfoComponents[m_selectedIndexForMovement].GetOwner());
145 SetVariableOut(PORT_MOVING_MEMBER_OUT,agent);
147 return ENodeResult.FAIL;
149 agent = AIAgent.Cast(m_GroupUtilityComponent.m_aInfoComponents[m_selectedIndexForCovering].GetOwner());
151 SetVariableOut(PORT_COVERING_MEMBER_OUT,agent);
154 ClearVariable(PORT_MOVING_MEMBER_OUT);
155 return ENodeResult.FAIL;
158 return ENodeResult.SUCCESS;
162 override protected bool CanReturnRunning()
168 protected static ref TStringArray s_aVarsOut = {
169 PORT_MOVING_MEMBER_OUT,
170 PORT_COVERING_MEMBER_OUT
172 override TStringArray GetVariablesOut()
178 protected static ref TStringArray s_aVarsIn = {
182 override TStringArray GetVariablesIn()
188 protected override string GetOnHoverDescription()
190 return "Getter returns unit available for cover and unit available for movement";