Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIGetSmartActionSentinelParams.c
Go to the documentation of this file.
1 class SCR_AIGetSmartActionSentinelParams : AITaskScripted
2 {
3  static const string SMART_ACTION_GUARD_PORT = "SmartActionGuard";
4  static const string POSITION_PORT = "OutPos";
5  static const string LOOK_DIRECTION_PORT = "LookPosition";
6  static const string LOOK_DIRECTION_RANGE_PORT = "LookDirectionRange";
7  static const string STANCE_PORT = "Stance";
8  static const string USE_BINOCULARS_PORT = "UseBinoculars";
9  static const string LEANING_PORT = "LeaningType";
10 
11  protected override bool VisibleInPalette()
12  {
13  return true;
14  }
15 
16  //-----------------------------------------------------------------------------------------------------------------------------------------
17  protected static ref TStringArray s_aVarsIn = {
18  SMART_ACTION_GUARD_PORT
19  };
20  override TStringArray GetVariablesIn()
21  {
22  return s_aVarsIn;
23  }
24 
25  //-----------------------------------------------------------------------------------------------------------------------------------------
26  protected static ref TStringArray s_aVarsOut = {
27  POSITION_PORT,
28  LOOK_DIRECTION_PORT,
29  LOOK_DIRECTION_RANGE_PORT,
30  STANCE_PORT,
31  USE_BINOCULARS_PORT,
32  LEANING_PORT
33  };
34  override TStringArray GetVariablesOut()
35  {
36  return s_aVarsOut;
37  }
38 
39  //-----------------------------------------------------------------------------------------------------------------------------------------
40  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
41  {
42  SCR_AISmartActionSentinelComponent smartAction;
43  if(!GetVariableIn(SMART_ACTION_GUARD_PORT, smartAction) || !smartAction)
44  {
45  NodeError(this, owner, "Invalid SCR_AISmartActionSentinelComponent provided!");
46  return ENodeResult.FAIL;
47  }
48 
49  vector worldPosition = smartAction.GetActionOffset(), worldPositionToLook = smartAction.GetLookPosition(), smartObjectPos = smartAction.m_Owner.GetOrigin();
50  vector mat[4];
51  smartAction.m_Owner.GetWorldTransform(mat);
52  worldPosition = smartObjectPos + worldPosition.Multiply3(mat);
53  if (worldPositionToLook == vector.Zero)
54  worldPositionToLook = smartObjectPos + (10 * vector.Forward).Multiply3(mat);
55  else
56  worldPositionToLook = smartObjectPos + worldPositionToLook.Multiply3(mat);
57 
58  SetVariableOut(POSITION_PORT, worldPosition);
59  SetVariableOut(LOOK_DIRECTION_PORT, worldPositionToLook);
60  SetVariableOut(LOOK_DIRECTION_RANGE_PORT, smartAction.GetLookDirectionRange());
61  SetVariableOut(STANCE_PORT, smartAction.GetDesiredStance());
62  SetVariableOut(USE_BINOCULARS_PORT, smartAction.GetUseBinoculars());
63  switch (smartAction.GetLeaningType())
64  {
65  case ELeaningType.LEFT :
66  {
67  SetVariableOut(LEANING_PORT, "CharacterLeanToggleLeft");
68  break;
69  };
70  case ELeaningType.RIGHT :
71  {
72  SetVariableOut(LEANING_PORT, "CharacterLeanToggleRight");
73  break;
74  };
75  default:
76  {
77  ClearVariable(LEANING_PORT);
78  };
79  };
80  return ENodeResult.SUCCESS;
81  }
82 };
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
NodeError
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition: NodeError.c:3
SCR_AIGetSmartActionSentinelParams
Definition: SCR_AIGetSmartActionSentinelParams.c:1