DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
ActionStartEngine.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
6 }
7}
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 {
48 return false;
49 }
50
51 return car.CrewMemberIndex(player) == DayZPlayerConstants.VEHICLESEAT_DRIVER);
52 }
53 }
54 }
55
56 return false;
57 }
58
59 override void OnFinishProgressServer(ActionData action_data)
60 {
61 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
62 if (vehCommand)
63 {
64 Transport trans = vehCommand.GetTransport();
65 if (trans)
66 {
67 CarScript car;
68 if (Class.CastTo(car, trans))
69 {
70 car.EngineStart();
71 }
72 }
73 }
74 }
75
76 override void OnExecuteServer(ActionData action_data)
77 {
78 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
79 if (vehCommand)
80 {
81 Transport trans = vehCommand.GetTransport();
82 if (trans)
83 {
84 CarScript car;
85 if (Class.CastTo(car, trans))
86 {
87 car.OnBeforeEngineStart();
88 }
89 }
90 }
91 }
92
93 override bool CanBeUsedInVehicle()
94 {
95 return true;
96 }
97}
void CreateConditionComponents()
Definition ActionBase.c:218
protected float m_SpecialtyWeight
Definition ActionBase.c:68
protected bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
protected string m_Text
Definition ActionBase.c:49
bool CanBeUsedInVehicle()
Definition ActionBase.c:311
protected int m_StanceMask
Definition ActionBase.c:53
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
class ActionTargets ActionTarget
protected ActionData m_ActionData
protected void OnFinishProgressServer(ActionData action_data)
PlayerBase m_Player
Definition ActionBase.c:33
ref CABase m_ActionComponent
Definition ActionBase.c:30
override void CreateActionComponent()
protected void OnExecuteServer(ActionData action_data)
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Super root of all classes in Enforce script.
Definition EnScript.c:11
proto native Transport GetTransport()
Base native class for all motorized wheeled vehicles.
Definition Car.c:80
const float START_ENGINE
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602
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:742