Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIProcessOrder.c
Go to the documentation of this file.
1 class SCR_AIProcessOrder: AITaskScripted
2 {
3  static const string ORDER_PORT = "OrderObjectIn";
4  static const string ORDER_TYPE = "OrderTypeOut";
5  static const string SCRIPTED_ORDER = "IsScriptedOrder";
6  static const string ORDER_VALUE = "SciptedOrderValue";
7  static const string ORDER_DEBUG_TEXT = "DebugText";
8 
9 
10  [Attribute("0", UIWidgets.CheckBox, "Log Debug")]
11  bool m_bDebugMe;
12 
13  AIOrder m_Order;
14  string m_sDebugString;
15 
16  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
17  {
18  if (!GetVariableIn(ORDER_PORT, m_Order))
19  return ENodeResult.FAIL;
20  if (!m_Order)
21  return ENodeResult.FAIL;
22 
23  SetVariableOut(ORDER_DEBUG_TEXT, m_Order.GetText());
24 
25  SCR_AIOrderBase order = SCR_AIOrderBase.Cast(m_Order);
26  if (!order && m_Order)
27  {
28  SetVariableOut(ORDER_TYPE, m_Order.GetOrderType());
29  SetVariableOut(SCRIPTED_ORDER, false);
30  ClearVariable(ORDER_VALUE);
31  }
32  else
33  {
34  order.GetOrderParameters(this);
35  #ifdef WORKBENCH
36  if (m_bDebugMe)
37  PrintFormat("%1 : %2",owner,m_sDebugString);
38  #endif
39  }
40 
41  #ifdef WORKBENCH
42  SCR_AIOrderBase scriptOrder = SCR_AIOrderBase.Cast(m_Order);
43  string dbgString;
44  if (scriptOrder)
45  dbgString = typename.EnumToString(EOrderType_Character,scriptOrder.m_eOrderType);
46  else
47  dbgString = m_Order.GetOrderTypeString();
48  SCR_AIDebugVisualization.VisualizeMessage(owner.GetControlledEntity(), dbgString, EAIDebugCategory.ORDER, 3);
49  #endif
50 
51  #ifdef AI_DEBUG
52  AddDebugMessage(owner, string.Format("Process order: %1, from BT: %2", order, order.m_sSentFromBt));
53  #endif
54 
55  return ENodeResult.SUCCESS;
56  }
57 
58  protected static ref TStringArray s_aVarsOut = {
59  SCRIPTED_ORDER,
60  ORDER_TYPE,
61  ORDER_VALUE,
62  ORDER_DEBUG_TEXT
63  };
64  override TStringArray GetVariablesOut()
65  {
66  return s_aVarsOut;
67  }
68 
69  protected static ref TStringArray s_aVarsIn = {
70  ORDER_PORT
71  };
72  override TStringArray GetVariablesIn()
73  {
74  return s_aVarsIn;
75  }
76 
77  override bool VisibleInPalette()
78  {
79  return true;
80  }
81 
82  override string GetOnHoverDescription()
83  {
84  return "Process order: reads order and gets type and data of order from it";
85  };
86 
87  #ifdef AI_DEBUG
88  protected void AddDebugMessage(AIAgent agent, string str)
89  {
90  SCR_AIInfoBaseComponent infoComp = SCR_AIInfoBaseComponent.Cast(agent.FindComponent(SCR_AIInfoBaseComponent));
91  infoComp.AddDebugMessage(str, msgType: EAIDebugMsgType.MAILBOX);
92  }
93  #endif
94 };
SCR_AIOrderBase
Definition: SCR_AIOrder.c:14
SCR_AIDebugVisualization
Definition: SCR_AIDebugVisualization.c:9
SCR_AIProcessOrder
Definition: SCR_AIProcessOrder.c:1
EAIDebugMsgType
EAIDebugMsgType
Definition: SCR_AIDebugMessage.c:1
EOrderType_Character
EOrderType_Character
Definition: SCR_AIOrder.c:1
s_aVarsOut
SCR_AIPickupInventoryItemsBehavior s_aVarsOut
Definition: SCR_AIGetCombatMoveRequestParameters.c:149
EAIDebugCategory
EAIDebugCategory
Definition: SCR_AIWorld.c:11
Attribute
typedef Attribute
Post-process effect of scripted camera.