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

Protected Member Functions

void ActionCarDoorsOutside ()
 
override void CreateConditionComponents ()
 
override bool ActionCondition (PlayerBase player, ActionTarget target, ItemBase item)
 
override void OnStartServer (ActionData action_data)
 
override void OnEndServer (ActionData action_data)
 
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
 

Detailed Description

Definition at line 1 of file ActionCarDoorsOutside.c.

Constructor & Destructor Documentation

◆ ActionCarDoorsOutside()

void ActionCarDoorsOutside::ActionCarDoorsOutside ( )
inlineprotected

Definition at line 6 of file ActionCarDoorsOutside.c.

7 {
8 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
9 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
10 m_LockTargetOnUse = false;
11 }
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 ActionCarDoorsOutside::ActionCondition ( PlayerBase player,
ActionTarget target,
ItemBase item )
inlineprotected

reach check from outside of car

player is outside of vehicle

player is looking at one of the doors, can't open if obstructed

if player is in car and cannot reach doors

is in reach, should open the door

Definition at line 19 of file ActionCarDoorsOutside.c.

20 {
22
25 return false;
26
28 if (Class.CastTo(car, target.GetParent()))
29 {
31
32 CarDoor carDoor = CarDoor.Cast(target.GetObject());
33 if (carDoor)
34 {
35 carDoor.GetActionComponentNameList(target.GetComponentIndex(), selections);
36
37 string animSource = "";
38
39 for (int i = 0; i < selections.Count(); i++)
40 {
41 animSource = car.GetAnimSourceFromSelection(selections[i]);
42 if (animSource != "")
43 {
44 int idx = car.GetSeatIndexFromDoor(animSource);
45 if (idx != -1 && !car.IsAreaAtDoorFree(idx))
46 {
47 return false;
48 }
49
51 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
52
53 float animationPhase = car.GetAnimationPhase(animSource);
55 return (m_IsOpening && animationPhase <= 0.5) || (!m_IsOpening && animationPhase > 0.5);
56 }
57 }
58 }
59 }
60
61 return false;
62 }
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.

References Class::CastTo(), UAMaxDistances::DEFAULT, IsInReach(), AnimatedActionBase::m_CommandUID, and m_IsOpening.

◆ CreateConditionComponents()

override void ActionCarDoorsOutside::CreateConditionComponents ( )
inlineprotected

Definition at line 13 of file ActionCarDoorsOutside.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.

◆ FillCommandUIDPerCrewIdx() [1/2]

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

◆ FillCommandUIDPerCrewIdx() [2/2]

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

Definition at line 115 of file ActionCarDoorsOutside.c.

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

References FillCommandUIDPerCrewIdx().

◆ OnEndServer()

override void ActionCarDoorsOutside::OnEndServer ( ActionData action_data)
inlineprotected

Definition at line 99 of file ActionCarDoorsOutside.c.

100 {
101 CarScript car = CarScript.Cast(action_data.m_Target.GetParent());
102 if (car)
103 car.ForceUpdateLightsEnd();
104 }

◆ OnStartServer()

override void ActionCarDoorsOutside::OnStartServer ( ActionData action_data)
inlineprotected

Definition at line 64 of file ActionCarDoorsOutside.c.

65 {
66 float phase;
67
68 if (m_IsOpening)
69 phase = 1.0;
70 else
71 phase = 0.0;
72
73 string animSource = "";
74
75 CarScript car = CarScript.Cast(action_data.m_Target.GetParent());
76 if (car)
77 {
79 CarDoor carDoor = CarDoor.Cast(action_data.m_Target.GetObject());
80 if (carDoor)
81 {
82 carDoor.GetActionComponentNameList(action_data.m_Target.GetComponentIndex(), selections);
83 for (int i = 0; i < selections.Count(); i++)
84 {
85 animSource = car.GetAnimSourceFromSelection(selections[i]);
86 if (animSource != "")
87 break;
88 }
89 }
90 }
91
92 if (car)
93 {
94 car.ForceUpdateLightsStart();
95 car.SetAnimationPhase(animSource, phase);
96 }
97 }

References m_IsOpening.

Member Data Documentation

◆ m_CommandUIDPerCrewIdx

int ActionCarDoorsOutside::m_CommandUIDPerCrewIdx[4]
protected

Definition at line 3 of file ActionCarDoorsOutside.c.

Referenced by FillCommandUIDPerCrewIdx().

◆ m_IsOpening


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