DayZ 1.24
Loading...
Searching...
No Matches
ActionStartEngine.c File Reference

Go to the source code of this file.

Classes

class  ActionStartCarCB
 

Functions

void ActionStartEngine ()
 DEPRECATED.
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnFinishProgressServer (ActionData action_data)
 
override void OnExecuteServer (ActionData action_data)
 
override bool CanBeUsedInVehicle ()
 

Variables

ActionStartCarCB ROUGH_SPECIALTY_WEIGHT = 0.5
 
static const float MINIMUM_BATTERY_ENERGY = 5.0
 
bool m_BatteryCon = false
 DEPRECATED.
 
bool m_SparkCon = false
 DEPRECATED.
 
bool m_BeltCon = false
 DEPRECATED.
 
bool m_FuelCon = false
 DEPRECATED.
 

Function Documentation

◆ ActionCondition()

override bool ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )

Definition at line 35 of file ActionStartEngine.c.

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 return false;
48
49 return car.CrewMemberIndex(player) == DayZPlayerConstants.VEHICLESEAT_DRIVER);
50 }
51 }
52 }
53
54 return false;
55 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
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:757

References Class::CastTo(), and GameConstants::STATE_RUINED.

◆ ActionStartEngine()

void ActionStartEngine ( )

DEPRECATED.

Definition at line 19 of file ActionStartEngine.c.

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 }
string m_Text
Definition ActionBase.c:49
bool m_LockTargetOnUse
Definition ActionBase.c:51
float m_SpecialtyWeight
Definition ActionBase.c:68
int m_StanceMask
Definition ActionBase.c:53
ActionStartCarCB ROUGH_SPECIALTY_WEIGHT

References m_LockTargetOnUse, m_SpecialtyWeight, m_StanceMask, m_Text, and ROUGH_SPECIALTY_WEIGHT.

Referenced by ActionConstructor::RegisterActions(), and ManBase::SetActions().

◆ CanBeUsedInVehicle()

override bool CanBeUsedInVehicle ( )

Definition at line 87 of file ActionStartEngine.c.

88 {
89 return true;
90 }

◆ CreateConditionComponents()

override void CreateConditionComponents ( )

Definition at line 29 of file ActionStartEngine.c.

30 {
33 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnExecuteServer()

override void OnExecuteServer ( ActionData action_data)

Definition at line 72 of file ActionStartEngine.c.

73 {
74 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
75 if (vehCommand)
76 {
77 Transport trans = vehCommand.GetTransport();
78 if (trans)
79 {
81 if (Class.CastTo(car, trans))
82 car.OnBeforeEngineStart();
83 }
84 }
85 }

References Class::CastTo().

◆ OnFinishProgressServer()

override void OnFinishProgressServer ( ActionData action_data)

Definition at line 57 of file ActionStartEngine.c.

58 {
59 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
60 if (vehCommand)
61 {
62 Transport trans = vehCommand.GetTransport();
63 if (trans)
64 {
66 if (Class.CastTo(car, trans))
67 car.EngineStart();
68 }
69 }
70 }

References Class::CastTo().

Variable Documentation

◆ m_BatteryCon

bool m_BatteryCon = false

DEPRECATED.

Definition at line 14 of file ActionStartEngine.c.

◆ m_BeltCon

bool m_BeltCon = false

DEPRECATED.

Definition at line 16 of file ActionStartEngine.c.

◆ m_FuelCon

bool m_FuelCon = false

DEPRECATED.

Definition at line 17 of file ActionStartEngine.c.

◆ m_SparkCon

bool m_SparkCon = false

DEPRECATED.

Definition at line 15 of file ActionStartEngine.c.

◆ MINIMUM_BATTERY_ENERGY

const float MINIMUM_BATTERY_ENERGY = 5.0
static

Definition at line 12 of file ActionStartEngine.c.

◆ ROUGH_SPECIALTY_WEIGHT

ActionStartCarCB ROUGH_SPECIALTY_WEIGHT = 0.5

Referenced by ActionStartEngine().