Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
actionstopengine.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 = CarScript.Cast(vehCommand.GetTransport());
23 if (!vehicle)
24 return false;
25
26 if (!vehicle.EngineIsOn())
27 return false;
28
29 if (vehicle.GetSpeedometerAbsolute() > 8)
30 return false;
31
32 return vehicle.CrewDriver() == player;
33 }
34
35 override void OnExecute(ActionData action_data)
36 {
37 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
38 if (!vehCommand)
39 return;
40
41 auto vehicle = CarScript.Cast(vehCommand.GetTransport());
42 if (!vehicle)
43 return;
44
45 if (vehicle.GetNetworkMoveStrategy() == NetworkMoveStrategy.PHYSICS)
46 {
47 // Only perform on clients (or robos), validation is performed in C++
48 if (action_data.m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_SERVER)
49 {
50 return;
51 }
52 }
53 else
54 {
55 if (g_Game.IsClient())
56 return;
57 }
58
59 vehicle.EngineStop();
60 }
61
62 override bool CanBeUsedInVehicle()
63 {
64 return true;
65 }
66
67 override bool UseMainItem()
68 {
69 return false;
70 }
71
72 override bool HasTarget()
73 {
74 return false;
75 }
76}
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
DayZGame g_Game
Definition dayzgame.c:3868
DayZPlayerInstanceType
defined in C++
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:602