Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EngineAction.c
Go to the documentation of this file.
2 {
3  //------------------------------------------------------------------------------------------------
4  override bool HasLocalEffectOnlyScript()
5  {
6  return false;
7  }
8 
9  //------------------------------------------------------------------------------------------------
10  override bool CanBroadcastScript()
11  {
12  return false;
13  }
14 
15  //------------------------------------------------------------------------------------------------
16  override void PerformContinuousAction(IEntity pOwnerEntity, IEntity pUserEntity, float timeSlice)
17  {
19  {
20  VehicleControllerComponent controller = VehicleControllerComponent.Cast(m_VehicleController);
21  if (controller)
22  controller.TryStartEngine();
23  }
24  else
25  {
26  VehicleControllerComponent_SA controller = VehicleControllerComponent_SA.Cast(m_VehicleController);
27  if (controller)
28  controller.TryStartEngine();
29  }
30  }
31 
34  override void OnActionStart(IEntity pUserEntity)
35  {
37  {
38  VehicleControllerComponent controller = VehicleControllerComponent.Cast(m_VehicleController);
39  if (controller)
40  controller.TryStartEngine();
41  }
42  else
43  {
44  VehicleControllerComponent_SA controller = VehicleControllerComponent_SA.Cast(m_VehicleController);
45  if (controller)
46  controller.TryStartEngine();
47  }
48  }
49 
52  override void OnActionCanceled(IEntity pOwnerEntity, IEntity pUserEntity)
53  {
54  if (!m_bIsToggle && !m_bTargetState)
55  return;
56 
58  {
59  CarControllerComponent controller = CarControllerComponent.Cast(m_VehicleController);
60  if (controller && !controller.IsEngineOn())
61  controller.CancelStart();
62  }
63  else
64  {
65  VehicleControllerComponent_SA controller = VehicleControllerComponent_SA.Cast(m_VehicleController);
66  if (controller && !controller.IsEngineOn())
67  controller.CancelStart();
68  }
69  }
70 
71  //------------------------------------------------------------------------------------------------
72  override bool CanBeShownScript(IEntity user)
73  {
74  return m_VehicleController && super.CanBeShownScript(user) && CanBePerformedScript(user);
75  }
76 
77  //------------------------------------------------------------------------------------------------
78  override bool GetState()
79  {
81  {
82  VehicleControllerComponent controller = VehicleControllerComponent.Cast(m_VehicleController);
83  return controller && controller.IsEngineOn();
84  }
85  else
86  {
87  VehicleControllerComponent_SA controller = VehicleControllerComponent_SA.Cast(m_VehicleController);
88  return controller && controller.IsEngineOn();
89  }
90  }
91 
92  //------------------------------------------------------------------------------------------------
93  override void SetState(bool enable)
94  {
96  {
97  VehicleControllerComponent controller = VehicleControllerComponent.Cast(m_VehicleController);
98  if (!controller)
99  return;
100 
101  if (enable)
102  controller.StartEngine();
103  else
104  controller.StopEngine();
105  }
106  else
107  {
108  VehicleControllerComponent_SA controller = VehicleControllerComponent_SA.Cast(m_VehicleController);
109  if (!controller)
110  return;
111 
112  if (enable)
113  controller.StartEngine();
114  else
115  controller.StopEngine();
116  }
117  }
118 }
SCR_VehicleActionBase
Definition: SCR_VehicleActionBase.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_EngineAction
Definition: SCR_EngineAction.c:1
CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition: SCR_LoiterUserAction.c:70
GetIsClientAuthority
override bool GetIsClientAuthority()
Definition: game.c:268