DayZ 1.24
Loading...
Searching...
No Matches
ActionCarDoorsOutside.c
Go to the documentation of this file.
2{
3 protected int m_CommandUIDPerCrewIdx[4];
4 protected bool m_IsOpening = true;
5
7 {
8 m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_OPENDOORFW;
9 m_StanceMask = DayZPlayerConstants.STANCEMASK_ALL;
10 m_LockTargetOnUse = false;
11 }
12
14 {
17 }
18
19 override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
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 }
63
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 }
98
100 {
101 CarScript car = CarScript.Cast(action_data.m_Target.GetParent());
102 if (car)
103 car.ForceUpdateLightsEnd();
104 }
105
106 //--------- Not used for this class
114
119 //-----------------------------------
120};
bool IsInReach(PlayerBase player, ActionTarget target, float maxDistance=1.0)
Definition ActionBase.c:856
bool m_LockTargetOnUse
Definition ActionBase.c:51
ref CCIBase m_ConditionItem
Definition ActionBase.c:55
ref CCTBase m_ConditionTarget
Definition ActionBase.c:56
int m_StanceMask
Definition ActionBase.c:53
void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
override void CreateConditionComponents()
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
override void OnStartServer(ActionData action_data)
void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
override void OnEndServer(ActionData action_data)
Super root of all classes in Enforce script.
Definition EnScript.c:11
const float DEFAULT
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.