DayZ 1.24
Loading...
Searching...
No Matches
ActionStartEngine.c
Go to the documentation of this file.
8
10{
11 private const float ROUGH_SPECIALTY_WEIGHT = 0.5;
12 static const float MINIMUM_BATTERY_ENERGY = 5.0;
13
14 bool m_BatteryCon = false;
15 bool m_SparkCon = false;
16 bool m_BeltCon = false;
17 bool m_FuelCon = false;
18
20 {
21 m_CallbackClass = ActionStartCarCB;
22 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STARTENGINE;
23 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
25 m_LockTargetOnUse = false;
26 m_Text = "#start_the_car";
27 }
28
30 {
33 }
34
35 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
36 {
37 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
38 if (vehCommand)
39 {
40 Transport trans = vehCommand.GetTransport();
41 if (trans)
42 {
43 Car car;
44 if (Class.CastTo(car, trans) && !car.EngineIsOn())
45 {
46 if (car.GetHealthLevel("Engine") >= GameConstants.STATE_RUINED)
47 return false;
48
49 return car.CrewMemberIndex(player) == DayZPlayerConstants.VEHICLESEAT_DRIVER);
50 }
51 }
52 }
53
54 return false;
55 }
56
58 {
59 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
60 if (vehCommand)
61 {
62 Transport trans = vehCommand.GetTransport();
63 if (trans)
64 {
66 if (Class.CastTo(car, trans))
67 car.EngineStart();
68 }
69 }
70 }
71
73 {
74 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
75 if (vehCommand)
76 {
77 Transport trans = vehCommand.GetTransport();
78 if (trans)
79 {
81 if (Class.CastTo(car, trans))
82 car.OnBeforeEngineStart();
83 }
84 }
85 }
86
87 override bool CanBeUsedInVehicle()
88 {
89 return true;
90 }
91}
string m_Text
Definition ActionBase.c:49
void CreateConditionComponents()
Definition ActionBase.c:196
bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
float m_SpecialtyWeight
Definition ActionBase.c:68
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
bool CanBeUsedInVehicle()
Definition ActionBase.c:289
static const float MINIMUM_BATTERY_ENERGY
bool m_SparkCon
DEPRECATED.
bool m_BatteryCon
DEPRECATED.
void ActionStartEngine()
DEPRECATED.
bool m_FuelCon
DEPRECATED.
bool m_BeltCon
DEPRECATED.
ActionStartCarCB ROUGH_SPECIALTY_WEIGHT
ActionData m_ActionData
void OnFinishProgressServer(ActionData action_data)
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void OnExecuteServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
const float START_ENGINE
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Definition constants.c:757