Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_AISemaphoreIn.c
Go to the documentation of this file.
1 class SCR_AISemaphoreIn: AITaskScripted
2 {
3  [Attribute("", UIWidgets.EditBox, "Lock name")]
4  protected string m_lockName;
5 
6  /*[Attribute("", UIWidgets.EditBox, "Debug node name")]
7  protected string m_lockName2;*/
8 
9  [Attribute("1", UIWidgets.EditBox, "Max Allowed Holders")]
10  protected int m_maxAllowedHolders;
11 
12  // Make scripted node visible or hidden in nodes palette
13  override bool VisibleInPalette()
14  {
15  return true;
16  }
17 
18  // Sets up input variables, as array of strings
19  protected static ref TStringArray s_aVarsIn = {
20  "LockNameIn"
21  };
22  override TStringArray GetVariablesIn()
23  {
24  return s_aVarsIn;
25  }
26 
27  protected SCR_LockContextComponent m_lockComponent;
28 
29  override protected string GetNodeMiddleText()
30  {
31  return "Lock name : " + m_lockName;
32  }
33 
34  override void OnEnter(AIAgent owner)
35  {
36  string lockName;
37  GetVariableIn("LockNameIn",lockName);
38  if ( lockName )
39  m_lockName = lockName;
40  GenericEntity ent;
41  if (AIGroup.Cast(owner))
42  ent = owner;
43  else
44  ent = GenericEntity.Cast(owner.GetControlledEntity());
45  m_lockComponent = SCR_LockContextComponent.Cast(ent.FindComponent(SCR_LockContextComponent));
46  }
47 
48  override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
49  {
50  if (m_lockComponent)
51  {
52  //Print("Jsem :" + m_lockName2);
53  bool tryOpenLock = m_lockComponent.JoinKey(m_lockName,m_maxAllowedHolders);
54  if (!tryOpenLock)
55  return ENodeResult.RUNNING;
56  else
57  {
58  return ENodeResult.SUCCESS;
59  }
60  }
61  return ENodeResult.FAIL;
62  }
63 };
64 
65 
66 
67 
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_LockContextComponent
Definition: SCR_LockContextComponent.c:13
m_maxAllowedHolders
int m_maxAllowedHolders
Definition: SCR_LockContextComponent.c:10
SCR_AISemaphoreIn
Definition: SCR_AISemaphoreIn.c:1