4 protected static const string PORT_TARGET_POS =
"TargetPos";
5 protected static const string PORT_COVER_QUERY_PROPERTIES =
"CoverQueryProps";
8 protected static const string PORT_COVER_LOCK =
"CoverLock";
11 protected SCR_AICombatMoveState m_State;
16 protected ref Shape m_CoverShape;
18 protected static const ShapeFlags m_SphereFlags = ShapeFlags.NOOUTLINE|ShapeFlags.NOZBUFFER|ShapeFlags.TRANSP;
19 protected static const ShapeFlags m_LineFlags = ShapeFlags.NOOUTLINE|ShapeFlags.TRANSP;
20 protected static const float DEBUGSPHERE_RADIUS = 0.1;
24 override void OnInit(AIAgent owner)
26 SCR_AIUtilityComponent utilityComp = SCR_AIUtilityComponent.Cast(owner.FindComponent(SCR_AIUtilityComponent));
28 m_State = utilityComp.m_CombatMoveState;
32 override ENodeResult EOnTaskSimulate(AIAgent owner,
float dt)
34 IEntity ownerEntity = owner.GetControlledEntity();
36 return ENodeResult.FAIL;
41 CoverQueryProperties queryProps;
42 GetVariableIn(PORT_COVER_QUERY_PROPERTIES, queryProps);
44 return ENodeResult.FAIL;
49 CoverQueryComponent coverComp = GetCoverQueryComponent(owner);
51 return ENodeResult.FAIL;
57 vector coverPos, coverTallestPos;
58 int tilex, tiley, coverId;
60 ECoverSearchState coverSearchState = coverComp.GetBestCover(
"Soldiers", queryProps, coverPos, coverTallestPos, tilex, tiley, coverId);
62 return ENodeResult.RUNNING;
69 m_aDebugShapes.Insert(Shape.CreateSphere(Color.GREEN, m_SphereFlags, ownerEntity.GetOrigin(), 0.2));
77 ClearVariable(PORT_COVER_LOCK);
78 return ENodeResult.FAIL;
84 SetVariableOut(PORT_COVER_LOCK,
m_State.GetAssignedCover());
89 m_CoverShape = Shape.CreateSphere(Color.PINK, m_SphereFlags, coverPos, 0.5);
93 return ENodeResult.SUCCESS;
97 CoverQueryComponent GetCoverQueryComponent(AIAgent owner)
99 AIGroup myGroup = owner.GetParentGroup();
102 CoverQueryComponent coverComp = CoverQueryComponent.Cast(myGroup.FindComponent(CoverQueryComponent));
106 protected static ref TStringArray s_aVarsIn = {
107 PORT_COVER_QUERY_PROPERTIES
109 override TStringArray GetVariablesIn()
114 protected static ref TStringArray s_aVarsOut = {
117 override TStringArray GetVariablesOut()
122 override static protected bool VisibleInPalette() {
return true; }
124 override string GetOnHoverDescription()
126 return "Finds and locks cover through cover manager. Keep in mind that cover is also assigned to CombatMoveState!";
129 override bool CanReturnRunning() {
return true; }
132 private void ClearDebug()