DayZ 1.24
Loading...
Searching...
No Matches
ActionSwitchSeats Class Reference
Inheritance diagram for ActionSwitchSeats:
[legend]
Collaboration diagram for ActionSwitchSeats:
[legend]

Private Member Functions

void ActionSwitchSeats ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void Start (ActionData action_data)
 
override void OnUpdate (ActionData action_data)
 
override bool CanBeUsedInVehicle ()
 

Detailed Description

Definition at line 2 of file ActionSwitchSeats.c.

Constructor & Destructor Documentation

◆ ActionSwitchSeats()

void ActionSwitchSeats::ActionSwitchSeats ( )
inlineprivate

Definition at line 4 of file ActionSwitchSeats.c.

5 {
6 //m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STARTENGINE;
7 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
9 m_LockTargetOnUse = false;
10 m_Text = "#change_seat";
11 }
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
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References m_LockTargetOnUse, m_SpecialtyWeight, m_StanceMask, and m_Text.

Member Function Documentation

◆ ActionCondition()

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

Definition at line 19 of file ActionSwitchSeats.c.

20 {
21
23 int nextSeatIdx = -1;
24
25 HumanCommandVehicle vehCommand = player.GetCommand_Vehicle();
26
27 if (!vehCommand)
28 return false;
29
30 int componentIndex = target.GetComponentIndex();
31
32 if (!target)
33 return false;
34
35 if (!Class.CastTo(trans, target.GetObject()))
36 return false;
37
38 nextSeatIdx = trans.CrewPositionIndex(componentIndex);
39
40 if (nextSeatIdx < 0)
41 return false;
42
43 Human crew = trans.CrewMember(nextSeatIdx);
44 if (crew)
45 return false;
46
47 if (!trans.CanReachSeatFromSeat(trans.CrewMemberIndex(player), nextSeatIdx))
48 return false;
49
50 return true;
51 }
Super root of all classes in Enforce script.
Definition EnScript.c:11
Base native class for all motorized wheeled vehicles.
Definition Car.c:75
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo().

◆ CanBeUsedInVehicle()

override bool ActionSwitchSeats::CanBeUsedInVehicle ( )
inlineprivate

Definition at line 87 of file ActionSwitchSeats.c.

88 {
89 return true;
90 }

◆ CreateConditionComponents()

override void ActionSwitchSeats::CreateConditionComponents ( )
inlineprivate

Definition at line 13 of file ActionSwitchSeats.c.

14 {
17 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ OnUpdate()

override void ActionSwitchSeats::OnUpdate ( ActionData action_data)
inlineprivate

Definition at line 76 of file ActionSwitchSeats.c.

77 {
78
79 if (action_data.m_State == UA_START)
80 {
81 HumanCommandVehicle hcv = action_data.m_Player.GetCommand_Vehicle();
82 if (!hcv || !action_data.m_Player.GetCommand_Vehicle().IsSwitchSeat())
84 }
85 }
void End()
called on surrender end request end
const int UA_START
Definition constants.c:439

References End(), and UA_START.

◆ Start()

override void ActionSwitchSeats::Start ( ActionData action_data)
inlineprivate

Definition at line 53 of file ActionSwitchSeats.c.

54 {
55 super.Start(action_data);
56 HumanCommandVehicle vehCommand = action_data.m_Player.GetCommand_Vehicle();
57 if (vehCommand)
58 {
60 if (Class.CastTo(trans, action_data.m_Target.GetObject()))
61 {
62 int nextSeat = trans.CrewPositionIndex(action_data.m_Target.GetComponentIndex());
63 int seat = trans.GetSeatAnimationType(nextSeat);
64 if (seat >= 0)
65 {
66 //pTransportPositionIndex, int pVehicleSeat
67 vehCommand.SwitchSeat(nextSeat, seat);
68 if (!GetGame().IsDedicatedServer())
69
70 action_data.m_Player.OnVehicleSwitchSeat(nextSeat);
71 }
72 }
73 }
74 }
proto native CGame GetGame()

References Class::CastTo(), and GetGame().


The documentation for this class was generated from the following file: