Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIChangeUnitState.c
Go to the documentation of this file.
1 class SCR_AIChangeUnitState : AITaskScripted
2 {
3  static const string PORT_STATE = "UnitState";
4 
5  [Attribute("0", UIWidgets.ComboBox, "State of unit", "", ParamEnumArray.FromEnum(EUnitState) )]
6  protected EUnitState m_stateToChange;
7 
8  [Attribute("1", UIWidgets.CheckBox, "Add true, remove false")]
9  protected bool m_stateAdd;
10 
11  protected override bool VisibleInPalette()
12  {
13  return true;
14  }
15 
16  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
17  {
18  int unitState;
19  if(GetVariableIn(PORT_STATE,unitState))
20  {
21  m_stateToChange = Math.AbsInt(unitState);
22  m_stateAdd = unitState > 0;
23  }
24 
25  SCR_ChimeraAIAgent chimeraAgent = SCR_ChimeraAIAgent.Cast(owner);
26  if (!chimeraAgent)
27  return SCR_AgentMustChimera(this, owner);
28 
29  SCR_AIInfoComponent infoComp = chimeraAgent.m_InfoComponent;
30  if (!infoComp)
31  ENodeResult.FAIL;
32 
33  if (m_stateAdd)
34  infoComp.AddUnitState(m_stateToChange);
35  else
36  infoComp.RemoveUnitState(m_stateToChange);
37  return ENodeResult.SUCCESS;
38  }
39 
40  override string GetNodeMiddleText()
41  {
42  string result = "Removing";
43  if (m_stateAdd)
44  result = "Adding";
45  return result + " " + typename.EnumToString(EUnitState,m_stateToChange);
46  };
47 
48  protected static ref TStringArray s_aVarsIn = {
49  PORT_STATE
50  };
51  override TStringArray GetVariablesIn()
52  {
53  return s_aVarsIn;
54  }
55 
56  override string GetOnHoverDescription()
57  {
58  return "Changes Unit State either adding flag or removing depending of sign of variable in in-port";
59  };
60 };
SCR_AgentMustChimera
ENodeResult SCR_AgentMustChimera(Node node, AIAgent owner)
Definition: NodeError.c:21
SCR_AIChangeUnitState
Definition: SCR_AIChangeUnitState.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ChimeraAIAgent
Definition: SCR_ChimeraAIAgent.c:5