Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionstopengineboat.c
Go to the documentation of this file.
2{
4 {
5 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STOPENGINE;
6 m_StanceMask = DayZPlayerConstants.STANCEMASK_CROUCH | DayZPlayerConstants.STANCEMASK_ERECT;
7 m_Text = "#stop_engine";
8 }
9
10 override void CreateConditionComponents()
11 {
14 }
15
16 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
17 {
18 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
19 if (!vehCommand)
20 return false;
21
22 auto vehicle = BoatScript.Cast(vehCommand.GetTransport());
23 if (!vehicle)
24 return false;
25
26 if (!vehicle.EngineIsOn())
27 return false;
28
29 return vehicle.CrewDriver() == player;
30 }
31
32 override void OnExecute(ActionData action_data)
33 {
34 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
35 if (!vehCommand)
36 return;
37
38 auto vehicle = BoatScript.Cast(vehCommand.GetTransport());
39 if (!vehicle)
40 return;
41
42 if (vehicle.GetNetworkMoveStrategy() == NetworkMoveStrategy.PHYSICS)
43 {
44 // Only perform on clients (or robos), validation is performed in C++
45 if (action_data.m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
46 {
47 return;
48 }
49 }
50
51 vehicle.EngineStop();
52 }
53
54 override bool CanBeUsedInVehicle()
55 {
56 return true;
57 }
58
59 override bool UseMainItem()
60 {
61 return false;
62 }
63
64 override bool HasTarget()
65 {
66 return false;
67 }
68}
int m_StanceMask
Definition actionbase.c:62
string m_Text
Definition actionbase.c:58
ref CCIBase m_ConditionItem
Definition actionbase.c:64
ref CCTBase m_ConditionTarget
Definition actionbase.c:65
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602