Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionstartengine.c
Go to the documentation of this file.
2{
3 override void CreateActionComponent()
4 {
5 m_ActionData.m_ActionComponent = new CAContinuousTime(UATimeSpent.START_ENGINE);
6 }
7}
8
10{
12 {
13 m_CallbackClass = ActionStartCarCB;
14 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STARTENGINE;
15 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
16 m_LockTargetOnUse = false;
17 m_Text = "#start_the_car";
18 }
19
21 {
22 m_ConditionTarget = new CCTNone();
23 m_ConditionItem = new CCINone();
24 }
25
26 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
27 {
28 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
29 if (!vehCommand)
30 return false;
31
32 auto vehicle = CarScript.Cast(vehCommand.GetTransport());
33 if (!vehicle || vehicle.EngineIsOn())
34 return false;
35
36 return vehicle.CrewDriver() == player;
37 }
38
39 override void OnFinishProgress(ActionData action_data)
40 {
41 super.OnFinishProgress(action_data);
42
43 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
44 if (!vehCommand)
45 return;
46
47 auto vehicle = CarScript.Cast(vehCommand.GetTransport());
48 if (!vehicle)
49 return;
50
51 if (vehicle.GetNetworkMoveStrategy() == NetworkMoveStrategy.PHYSICS)
52 {
53 // Only perform on clients (or robos), validation is performed in C++ with respect to scripted 'Car.OnBeforeEngineStart'
54 if (action_data.m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
55 {
56 return;
57 }
58 }
59 else
60 {
61 if (g_Game.IsClient())
62 return;
63 }
64
65 vehicle.EngineStart();
66 }
67
68 override void OnExecute(ActionData action_data)
69 {
70 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
71 if (!vehCommand)
72 return;
73
74 auto vehicle = CarScript.Cast(vehCommand.GetTransport());
75 if (vehicle)
76 vehicle.OnIgnition();
77 }
78
79 override bool CanBeUsedInVehicle()
80 {
81 return true;
82 }
83
84 override bool HasTarget()
85 {
86 return false;
87 }
88
89 override bool UseMainItem()
90 {
91 return false;
92 }
93
95 private const int SOUND_IGNITION_DELAY = 700; // ms, delay for ignition sound to match animation of hand touching the key
96 private const float ROUGH_SPECIALTY_WEIGHT = 0.5;
97 static const float MINIMUM_BATTERY_ENERGY = 5.0;
98 bool m_BatteryCon = false;
99 bool m_SparkCon = false;
100 bool m_BeltCon = false;
101 bool m_FuelCon = false;
102}
int m_CommandUID
Definition actionbase.c:31
int m_StanceMask
Definition actionbase.c:33
override void OnFinishProgress(ActionData action_data)
ActionStartCarCB ActionContinuousBaseCB ActionStartEngine()
ActionData m_ActionData
bool CanBeUsedInVehicle()
Definition actionbase.c:329
bool HasTarget()
Definition actionbase.c:244
bool UseMainItem()
Definition actionbase.c:385
void CreateConditionComponents()
Definition actionbase.c:230
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
void OnExecute(ActionData action_data)
DayZGame g_Game
Definition dayzgame.c:3868
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602