Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionstartengineboat.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 = ActionStartEngineBoatCB;
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 = BoatScript.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 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
42 if (!vehCommand)
43 return;
44
45 auto vehicle = BoatScript.Cast(vehCommand.GetTransport());
46 if (!vehicle)
47 return;
48
49 if (vehicle.GetNetworkMoveStrategy() == NetworkMoveStrategy.PHYSICS)
50 {
51 // Only perform on clients (or robos), validation is performed in C++ with respect to scripted 'Car.OnBeforeEngineStart'
52 if (action_data.m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
53 {
54 return;
55 }
56 }
57
58 vehicle.EngineStart();
59 }
60
61 override void OnExecute(ActionData action_data)
62 {
63 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
64 if (!vehCommand)
65 return;
66
67 auto vehicle = BoatScript.Cast(vehCommand.GetTransport());
68 if (vehicle)
69 vehicle.OnIgnition();
70 }
71
72 override bool CanBeUsedInVehicle()
73 {
74 return true;
75 }
76
77 override bool HasTarget()
78 {
79 return false;
80 }
81
82 override bool UseMainItem()
83 {
84 return false;
85 }
86}
int m_CommandUID
Definition actionbase.c:31
int m_StanceMask
Definition actionbase.c:33
override void OnFinishProgress(ActionData action_data)
ActionStartEngineBoatCB ActionContinuousBaseCB ActionStartEngineBoat()
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)
void OnIgnition()
Definition boatscript.c:280
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602