Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_VehicleGearCondition.c
Go to the documentation of this file.
2 {
8 };
9 //------------------------------------------------------------------------------------------------
13 {
14  [Attribute(defvalue: SCR_Enum.GetDefault(EVehicleGearboxGear.FORWARD), uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EVehicleGearboxGear))]
15  protected EVehicleGearboxGear m_eVehicleGearboxGear;
16  //------------------------------------------------------------------------------------------------
19  override bool IsAvailable(SCR_AvailableActionsConditionData data)
20  {
21  if (!data)
22  return false;
23 
25  {
26  CarControllerComponent controller = CarControllerComponent.Cast(data.GetCurrentVehicleController());
27  if (!controller)
28  return false;
29 
30  VehicleWheeledSimulation simulation = VehicleWheeledSimulation.Cast(controller.GetSimulation());
31  if (!simulation)
32  return false;
33 
34  int currentGear = simulation.GetGear();
35  int gearsCount = simulation.GearboxGearsCount();
36  int neutralGear = gearsCount - simulation.GearboxForwardGearsCount() - 1;
37 
38  bool result;
39  if (m_eVehicleGearboxGear == EVehicleGearboxGear.REVERSE)
40  result = currentGear < neutralGear;
41  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.NEUTRAL)
42  result = currentGear == neutralGear;
43  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.FORWARD)
44  result = currentGear > neutralGear;
45  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.FIRST)
46  result = currentGear == neutralGear + 1;
47  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.LAST)
48  result = currentGear == gearsCount - 1;
49 
50  return GetReturnResult(result);
51  }
52  else
53  {
54  CarControllerComponent_SA controller = CarControllerComponent_SA.Cast(data.GetCurrentVehicleController());
55  if (!controller)
56  return false;
57 
58  VehicleWheeledSimulation_SA simulation = VehicleWheeledSimulation_SA.Cast(controller.GetSimulation());
59  if (!simulation)
60  return false;
61 
62  int currentGear = simulation.GetGear();
63  int gearsCount = simulation.GearboxGearsCount();
64  int neutralGear = gearsCount - simulation.GearboxForwardGearsCount() - 1;
65 
66  bool result;
67  if (m_eVehicleGearboxGear == EVehicleGearboxGear.REVERSE)
68  result = currentGear < neutralGear;
69  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.NEUTRAL)
70  result = currentGear == neutralGear;
71  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.FORWARD)
72  result = currentGear > neutralGear;
73  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.FIRST)
74  result = currentGear == neutralGear + 1;
75  else if (m_eVehicleGearboxGear == EVehicleGearboxGear.LAST)
76  result = currentGear == gearsCount - 1;
77 
78  return GetReturnResult(result);
79  }
80  }
81 };
EVehicleGearboxGear
EVehicleGearboxGear
Definition: SCR_VehicleGearCondition.c:1
SCR_Enum
Definition: SCR_Enum.c:1
SCR_AvailableActionsConditionData
Definition: SCR_AvailableActionsConditionData.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
FIRST
@ FIRST
Definition: SCR_VehicleGearCondition.c:6
LAST
@ LAST
Definition: SCR_VehicleGearCondition.c:7
SCR_AvailableActionCondition
A single available action condition representation.
Definition: SCR_AvailableActionsCondition.c:3
GetIsClientAuthority
override bool GetIsClientAuthority()
Definition: game.c:268
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_VehicleGearCondition
Returns true if character is in a vehicle.
Definition: SCR_VehicleGearCondition.c:12
REVERSE
@ REVERSE
Definition: SCR_VehicleGearCondition.c:3
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
NEUTRAL
@ NEUTRAL
Definition: SCR_VehicleGearCondition.c:4
FORWARD
@ FORWARD
Definition: SCR_VehicleGearCondition.c:5
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468