Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AISetWeaponRaised.c
Go to the documentation of this file.
2{
3 [Attribute("true", UIWidgets.CheckBox, "Raise weapon",)]
4 private bool m_bWeaponRaised;
5
6 static const string RAISED_PORT = "Raised";
7
8 private SCR_CharacterControllerComponent m_CharacterController;
9
10 //------------------------------------------------------------------------------------------------
11 override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
12 {
13 if (!m_AIInfo || !m_CharacterController)
14 return ENodeResult.FAIL;
15
16 int raiseWeapon;
17 if(!GetVariableIn(RAISED_PORT,raiseWeapon))
18 raiseWeapon = m_bWeaponRaised;
19
20 m_CharacterController.SetWeaponRaised(raiseWeapon);
21
22 return ENodeResult.SUCCESS;
23 }
24
25 //------------------------------------------------------------------------------------------------
26 static override bool VisibleInPalette() {return true;}
27
28 //------------------------------------------------------------------------------------------------
29 protected static ref TStringArray s_aVarsIn = {
30 RAISED_PORT
31 };
32 override array<string> GetVariablesIn()
33 {
34 return s_aVarsIn;
35 }
36
37 //------------------------------------------------------------------------------------------------
38 override string GetNodeMiddleText()
39 {
40 string s;
41 s = s + string.Format("m_bWeaponRaised: %1\n", m_bWeaponRaised);
42 return s;
43 }
44
45 //------------------------------------------------------------------------------------------------
46 override void OnInit(AIAgent owner)
47 {
48 super.OnInit(owner);
49
50 if(owner.GetControlledEntity())
51 {
52 m_CharacterController = SCR_CharacterControllerComponent.Cast(owner.GetControlledEntity().FindComponent(SCR_CharacterControllerComponent));
53 if (!m_CharacterController)
54 NodeError(this, owner, "Can't find SCR_CharacterControllerComponent.");
55 }
56 }
57};
ENodeResult NodeError(Node node, AIAgent owner, string msg)
Error call to be used in scripted BT nodes.
Definition NodeError.c:3
proto bool GetVariableIn(string name, out void val)
bool VisibleInPalette()
SCR_AIInfoComponent m_AIInfo
override void OnInit(AIAgent owner)
override array< string > GetVariablesIn()
override string GetNodeMiddleText()
static ref TStringArray s_aVarsIn
ENodeResult
Definition ENodeResult.c:13
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385