Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AIInspectWeapon.c
Go to the documentation of this file.
1 class SCR_AIInspectWeapon: AITaskScripted
2 {
3  [Attribute("0", UIWidgets.EditBox, desc: "State of inspecting the weapon", "")]
4  protected float m_fInspectionState;
5 
6  [Attribute("0", UIWidgets.CheckBox, desc: "Stop inspecting the weapon", "")]
7  protected bool m_bStopInspecting;
8 
9  protected SCR_CharacterControllerComponent m_Controller;
10  protected bool m_bAborted;
11 
12  //------------------------------------------------------------------------------------------------
13  override void OnInit(AIAgent owner)
14  {
15  m_Controller = SCR_CharacterControllerComponent.Cast(owner.GetControlledEntity().FindComponent(SCR_CharacterControllerComponent));
16  }
17 
18  //------------------------------------------------------------------------------------------------
19  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
20  {
21  if (!m_Controller)
22  return ENodeResult.FAIL;
23 
24  BaseWeaponManagerComponent pWpnManager = m_Controller.GetWeaponManagerComponent();
25  if (!pWpnManager)
26  return ENodeResult.FAIL;
27 
28  BaseWeaponComponent pWpn = pWpnManager.GetCurrent();
29  if (!pWpn)
30  return ENodeResult.FAIL;
31 
32  IEntity pWpnEnt = pWpn.GetOwner();
33  if (!m_Controller.CanInspect(pWpnEnt))
34  return ENodeResult.FAIL;
35 
36  if (!m_bStopInspecting)
37  {
38  m_Controller.SetInspect(pWpnEnt);
39  m_Controller.SetInspectState(m_fInspectionState);
40  }
41  else
42  {
43  m_Controller.SetInspect(null);
44  }
45 
46  return ENodeResult.SUCCESS;
47  }
48 
49  //------------------------------------------------------------------------------------------------
50  override bool VisibleInPalette()
51  {
52  return true;
53  }
54 
55  // -----------------------------------------------------------------------------------------------
56  protected override string GetNodeMiddleText()
57  {
58  if (!m_bStopInspecting)
59  return "Weapon inspect type: " + m_fInspectionState;
60  else
61  return "Stop inspecting weapon";
62  }
63 
64  // -----------------------------------------------------------------------------------------------
65  override void OnAbort(AIAgent owner, Node nodeCausingAbort)
66  {
67  // WARNING: m_bAborted is never set to true, thus the node cannot be restarted in a parralel and expected to abort properly.
68  if (m_bAborted)
69  return;
70 
71  m_bAborted = true;
72 
73  if (!m_Controller || !m_Controller.GetInspect())
74  return;
75 
76  m_Controller.SetInspect(null);
77  }
78 };
m_Controller
protected CompartmentControllerComponent m_Controller
Definition: SCR_VehicleDamageManagerComponent.c:197
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
Attribute
typedef Attribute
Post-process effect of scripted camera.
BaseWeaponComponent
Definition: BaseWeaponComponent.c:12
SCR_AIInspectWeapon
Definition: SCR_AIInspectWeapon.c:1