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

Protected Member Functions

void ActionCarDoors ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
override void OnEnd (ActionData action_data)
 
override bool CanBeUsedInVehicle ()
 
void FillCommandUIDPerCrewIdx (int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
 
void FillCommandUIDPerCrewIdx (int evenCrewIdx0, int unevenCrewIdx1)
 

Protected Attributes

int m_CommandUIDPerCrewIdx [4]
 
bool m_IsOpening = true
 
CarScript m_Car = null
 
string m_AnimSource = ""
 

Detailed Description

Definition at line 1 of file ActionCarDoors.c.

Constructor & Destructor Documentation

◆ ActionCarDoors()

void ActionCarDoors::ActionCarDoors ( )
inlineprotected

Definition at line 10 of file ActionCarDoors.c.

11 {
12 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
13 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
14 m_LockTargetOnUse = false;
15 }
bool m_LockTargetOnUse
Definition ActionBase.c:51
int m_StanceMask
Definition ActionBase.c:53
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597

References AnimatedActionBase::m_CommandUID, m_LockTargetOnUse, and m_StanceMask.

Member Function Documentation

◆ ActionCondition()

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

player inside vehicle

crewIdx sanity checks and see if there is a door

see if door is in reach

Definition at line 23 of file ActionCarDoors.c.

24 {
26 string animSource = "";
27
29 if (player && player.GetCommand_Vehicle())
30 {
31 if (Class.CastTo(car, player.GetCommand_Vehicle().GetTransport()))
32 {
33 int crewIdx = car.CrewMemberIndex(player);
34
36 if (crewIdx < 0 || crewIdx > 3 || car.GetCarDoorsState(car.GetDoorInvSlotNameFromSeatPos(crewIdx)) == CarDoorState.DOORS_MISSING)
37 return false;
38
39 animSource = car.GetAnimSourceFromSelection(car.GetDoorSelectionNameFromSeatPos(crewIdx));
40
42 if (!car.CanReachDoorsFromSeat(animSource, crewIdx) || !car.IsAreaAtDoorFree(crewIdx))
43 return false;
44
46
47 float animationPhaseInside = car.GetAnimationPhase(animSource);
48 return (m_IsOpening && animationPhaseInside <= 0.5) || (!m_IsOpening && animationPhaseInside > 0.5);
49 }
50 }
51
52 return false;
53 }
CarDoorState
Definition CarScript.c:2
int m_CommandUIDPerCrewIdx[4]
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), AnimatedActionBase::m_CommandUID, m_CommandUIDPerCrewIdx, and m_IsOpening.

◆ CanBeUsedInVehicle()

override bool ActionCarDoors::CanBeUsedInVehicle ( )
inlineprotected

Definition at line 102 of file ActionCarDoors.c.

103 {
104 return true;
105 }

◆ CreateConditionComponents()

override void ActionCarDoors::CreateConditionComponents ( )
inlineprotected

Definition at line 17 of file ActionCarDoors.c.

18 {
21 }
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56

References m_ConditionItem, and m_ConditionTarget.

◆ FillCommandUIDPerCrewIdx() [1/2]

void ActionCarDoors::FillCommandUIDPerCrewIdx ( int crewIdx0,
int crewIdx1,
int crewIdx2,
int crewIdx3 )
inlineprotected

◆ FillCommandUIDPerCrewIdx() [2/2]

void ActionCarDoors::FillCommandUIDPerCrewIdx ( int evenCrewIdx0,
int unevenCrewIdx1 )
inlineprotected

Definition at line 115 of file ActionCarDoors.c.

116 {
118 }
void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)

References FillCommandUIDPerCrewIdx().

◆ OnEnd()

override void ActionCarDoors::OnEnd ( ActionData action_data)
inlineprotected

Definition at line 96 of file ActionCarDoors.c.

97 {
98 if (m_Car || m_AnimSource.Length() > 0)
99 Error("[WARNING] m_Car and m_AnimSource are left for backwards compatibility to not crash mods that are using it, but should no longer be used.");
100 }
CarScript m_Car
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto native int Length()
Returns length of string.

References Error(), string::Length(), m_AnimSource, and m_Car.

◆ OnEndServer()

override void ActionCarDoors::OnEndServer ( ActionData action_data)
inlineprotected

Definition at line 85 of file ActionCarDoors.c.

86 {
88 PlayerBase player = action_data.m_Player;
89 if (player && player.GetCommand_Vehicle())
90 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
91
92 if (car)
93 car.ForceUpdateLightsEnd();
94 }

◆ OnStartServer()

override void ActionCarDoors::OnStartServer ( ActionData action_data)
inlineprotected

Definition at line 55 of file ActionCarDoors.c.

56 {
57 PlayerBase player = action_data.m_Player;
58
59 float phase;
60 if (m_IsOpening)
61 phase = 1.0;
62 else
63 phase = 0.0;
64
65 string animSource = "";
66
68 if (player && player.GetCommand_Vehicle())
69 {
70 car = CarScript.Cast(player.GetCommand_Vehicle().GetTransport());
71 if (car)
72 {
73 int crewIdx = car.CrewMemberIndex(player);
74 animSource = car.GetAnimSourceFromSelection(car.GetDoorSelectionNameFromSeatPos(crewIdx));
75 }
76 }
77
78 if (car)
79 {
80 car.ForceUpdateLightsStart();
81 car.SetAnimationPhase(animSource, phase);
82 }
83 }

References m_IsOpening.

Member Data Documentation

◆ m_AnimSource

string ActionCarDoors::m_AnimSource = ""
protected

Definition at line 7 of file ActionCarDoors.c.

Referenced by OnEnd().

◆ m_Car

CarScript ActionCarDoors::m_Car = null
protected

Definition at line 6 of file ActionCarDoors.c.

Referenced by OnEnd().

◆ m_CommandUIDPerCrewIdx

int ActionCarDoors::m_CommandUIDPerCrewIdx[4]
protected

Definition at line 3 of file ActionCarDoors.c.

Referenced by ActionCondition(), and FillCommandUIDPerCrewIdx().

◆ m_IsOpening

bool ActionCarDoors::m_IsOpening = true
protected

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