Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actioncardoors.c
Go to the documentation of this file.
1
class
ActionCarDoors
:
ActionInteractBase
2
{
3
protected
int
m_CommandUIDPerCrewIdx
[4];
4
protected
bool
m_IsOpening
=
true
;
5
// --- Backwards compatibility 1.09 -> 1.10 (But please do not use these)
6
CarScript
m_Car
= null;
7
string
m_AnimSource
=
""
;
8
// ---
9
10
void
ActionCarDoors
()
11
{
12
m_CommandUID
=
DayZPlayerConstants
.CMD_ACTIONMOD_OPENDOORFW;
13
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ALL;
14
m_LockTargetOnUse
=
false
;
15
}
16
17
override
void
CreateConditionComponents
()
18
{
19
m_ConditionItem
=
new
CCINone
;
20
m_ConditionTarget
=
new
CCTNone
;
21
}
22
23
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
24
{
25
CarScript
car = null;
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 > car.CrewSize() || car.
GetCarDoorsState
(car.
GetDoorInvSlotNameFromSeatPos
(crewIdx)) ==
CarDoorState
.DOORS_MISSING)
37
{
38
return
false
;
39
}
40
41
animSource = car.
GetAnimSourceFromSelection
(car.
GetDoorSelectionNameFromSeatPos
(crewIdx));
42
44
if
(!car.
CanReachDoorsFromSeat
(animSource, crewIdx) || !car.IsAreaAtDoorFree(crewIdx))
45
{
46
return
false
;
47
}
48
49
int
safeCrewIdx = crewIdx % 4;
50
m_CommandUID
=
m_CommandUIDPerCrewIdx
[safeCrewIdx];
51
52
float
animationPhaseInside = car.GetAnimationPhase(animSource);
53
return
(
m_IsOpening
&& animationPhaseInside <= 0.5) || (!
m_IsOpening
&& animationPhaseInside > 0.5);
54
}
55
}
56
57
return
false
;
58
}
59
60
override
void
OnStartServer
(
ActionData
action_data)
61
{
62
super.OnStartServer(action_data);
63
64
PlayerBase
player = action_data.m_Player;
65
66
float
phase;
67
if
(
m_IsOpening
)
68
{
69
phase = 1.0;
70
}
71
else
72
{
73
phase = 0.0;
74
}
75
76
string
animSource =
""
;
77
78
CarScript
car;
79
if
(player && player.GetCommand_Vehicle())
80
{
81
car =
CarScript
.Cast(player.GetCommand_Vehicle().GetTransport());
82
if
(car)
83
{
84
int
crewIdx = car.CrewMemberIndex(player);
85
animSource = car.
GetAnimSourceFromSelection
(car.
GetDoorSelectionNameFromSeatPos
(crewIdx));
86
}
87
}
88
89
if
(car)
90
{
91
car.ForceUpdateLightsStart();
92
car.SetAnimationPhase(animSource, phase);
93
}
94
}
95
96
override
void
OnEndServer
(
ActionData
action_data)
97
{
98
super.OnEndServer(action_data);
99
100
CarScript
car;
101
PlayerBase
player = action_data.m_Player;
102
if
(player && player.GetCommand_Vehicle())
103
{
104
car =
CarScript
.Cast(player.GetCommand_Vehicle().GetTransport());
105
}
106
107
if
(car)
108
{
109
car.ForceUpdateLightsEnd();
110
}
111
}
112
113
override
void
OnEnd
(
ActionData
action_data)
114
{
115
if
(
m_Car
||
m_AnimSource
.Length() > 0)
116
{
117
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."
);
118
}
119
}
120
121
override
bool
CanBeUsedInVehicle
()
122
{
123
return
true
;
124
}
125
126
override
bool
HasTarget
()
127
{
128
return
false
;
129
}
130
131
protected
void
FillCommandUIDPerCrewIdx
(
int
crewIdx0,
int
crewIdx1,
int
crewIdx2,
int
crewIdx3)
132
{
133
m_CommandUIDPerCrewIdx
[0] = crewIdx0;
134
m_CommandUIDPerCrewIdx
[1] = crewIdx1;
135
m_CommandUIDPerCrewIdx
[2] = crewIdx2;
136
m_CommandUIDPerCrewIdx
[3] = crewIdx3;
137
}
138
139
protected
void
FillCommandUIDPerCrewIdx
(
int
evenCrewIdx0,
int
unevenCrewIdx1)
140
{
141
FillCommandUIDPerCrewIdx
(evenCrewIdx0, unevenCrewIdx1, evenCrewIdx0, unevenCrewIdx1);
142
}
143
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
CarDoorState
CarDoorState
Definition
carscript.c:2
ActionBase::m_LockTargetOnUse
bool m_LockTargetOnUse
Definition
actionbase.c:66
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionCarDoors::OnEndServer
override void OnEndServer(ActionData action_data)
Definition
actioncardoors.c:96
ActionCarDoors::m_AnimSource
string m_AnimSource
Definition
actioncardoors.c:7
ActionCarDoors::FillCommandUIDPerCrewIdx
void FillCommandUIDPerCrewIdx(int evenCrewIdx0, int unevenCrewIdx1)
Definition
actioncardoors.c:139
ActionCarDoors::CreateConditionComponents
override void CreateConditionComponents()
Definition
actioncardoors.c:17
ActionCarDoors::m_CommandUIDPerCrewIdx
int m_CommandUIDPerCrewIdx[4]
Definition
actioncardoors.c:3
ActionCarDoors::m_IsOpening
bool m_IsOpening
Definition
actioncardoors.c:4
ActionCarDoors::OnEnd
override void OnEnd(ActionData action_data)
Definition
actioncardoors.c:113
ActionCarDoors::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actioncardoors.c:23
ActionCarDoors::HasTarget
override bool HasTarget()
Definition
actioncardoors.c:126
ActionCarDoors::CanBeUsedInVehicle
override bool CanBeUsedInVehicle()
Definition
actioncardoors.c:121
ActionCarDoors::ActionCarDoors
void ActionCarDoors()
Definition
actioncardoors.c:10
ActionCarDoors::FillCommandUIDPerCrewIdx
void FillCommandUIDPerCrewIdx(int crewIdx0, int crewIdx1, int crewIdx2, int crewIdx3)
Definition
actioncardoors.c:131
ActionCarDoors::OnStartServer
override void OnStartServer(ActionData action_data)
Definition
actioncardoors.c:60
ActionCarDoors::m_Car
CarScript m_Car
Definition
actioncardoors.c:6
ActionInteractBase::ActionInteractBase
void ActionInteractBase()
Definition
actioninteractbase.c:43
AnimatedActionBase::m_CommandUID
int m_CommandUID
Definition
animatedactionbase.c:143
CCINone
Definition
ccinone.c:2
CCTNone
Definition
cctnone.c:2
CarScript
Definition
civiliansedan.c:2
CarScript::GetCarDoorsState
override int GetCarDoorsState(string slotType)
Definition
civiliansedan.c:173
CarScript::CanReachDoorsFromSeat
override bool CanReachDoorsFromSeat(string pDoorsSelection, int pCurrentSeat)
Definition
civiliansedan.c:388
CarScript::GetAnimSourceFromSelection
override string GetAnimSourceFromSelection(string selection)
Definition
civiliansedan.c:337
CarScript::GetDoorSelectionNameFromSeatPos
override string GetDoorSelectionNameFromSeatPos(int posIdx)
Definition
civiliansedan.c:250
CarScript::GetDoorInvSlotNameFromSeatPos
override string GetDoorInvSlotNameFromSeatPos(int posIdx)
Definition
civiliansedan.c:271
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Error
void Error(string err)
Messagebox with error message.
Definition
endebug.c:90
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
interact
vehicles
actioncardoors.c
Generated by
1.17.0