Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
actionswitchseats.c
Go to the documentation of this file.
1
2
class
ActionSwitchSeats
:
ActionBase
3
{
4
void
ActionSwitchSeats
()
5
{
6
//m_CommandUID = DayZPlayerConstants.CMD_ACTIONMOD_STARTENGINE;
7
m_StanceMask
=
DayZPlayerConstants
.STANCEMASK_ALL;
8
m_SpecialtyWeight
= 1.0;
9
m_LockTargetOnUse
=
false
;
10
m_Text
=
"#change_seat"
;
11
}
12
13
override
void
CreateConditionComponents
()
14
{
15
m_ConditionItem
=
new
CCINone
;
16
m_ConditionTarget
=
new
CCTObject
;
17
}
18
19
override
bool
ActionCondition
(
PlayerBase
player,
ActionTarget
target,
ItemBase
item )
20
{
21
22
Transport
trans = null;
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
}
52
53
override
void
OnStart
(
ActionData
action_data)
54
{
55
super.OnStart(action_data);
56
HumanCommandVehicle
vehCommand = action_data.m_Player.GetCommand_Vehicle();
57
if
( vehCommand )
58
{
59
Transport
trans;
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
69
action_data.m_Player.OnVehicleSwitchSeat( nextSeat );
70
}
71
}
72
}
73
}
74
75
override
void
OnUpdate
(
ActionData
action_data)
76
{
77
78
if
(action_data.m_State ==
UA_START
)
79
{
80
HumanCommandVehicle
hcv = action_data.m_Player.GetCommand_Vehicle();
81
if
( !hcv || !action_data.m_Player.GetCommand_Vehicle().IsSwitchSeat() )
82
{
83
End
(action_data);
84
}
85
}
86
}
87
88
override
bool
CanBeUsedInVehicle
()
89
{
90
return
true
;
91
}
92
93
override
bool
AddActionJuncture
(
ActionData
action_data)
94
{
95
Transport
trans =
Transport
.Cast(action_data.m_Target.GetObject());
96
bool
accepted =
false
;
97
int
currSeat = trans.CrewMemberIndex(action_data.m_Player);
98
int
nextSeat = trans.CrewPositionIndex( action_data.m_Target.GetComponentIndex() );
99
Transport
transport =
Transport
.Cast(action_data.m_Target.GetObject());
100
InventoryLocation
il =
new
InventoryLocation
;
101
if
(transport)
102
{
103
il.
SetVehicle
(transport, action_data.m_Player, nextSeat);
104
105
//Lock target
106
if
(
g_Game
.AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il,
true
, 10000, action_data))
107
{
108
accepted =
true
;
109
action_data.m_ReservedInventoryLocations.Insert(il);
110
}
111
112
if
(accepted)
113
{
114
il.
SetVehicle
(transport, action_data.m_Player, currSeat);
115
116
if
(
g_Game
.AddInventoryJunctureEx(action_data.m_Player, action_data.m_Player, il,
true
, 10000, action_data))
117
{
118
action_data.m_ReservedInventoryLocations.Insert(il);
119
}
120
else
121
{
122
ClearActionJuncture
(action_data);
123
accepted =
false
;
124
}
125
}
126
}
127
128
return
accepted;
129
}
130
};
ActionData
ActionBase ActionData
Definition
actionbase.c:30
ActionTarget
class ActionTargets ActionTarget
ActionBase::m_Text
string m_Text
Definition
actionbase.c:64
ActionBase::m_LockTargetOnUse
bool m_LockTargetOnUse
Definition
actionbase.c:66
ActionBase::m_ConditionItem
ref CCIBase m_ConditionItem
Definition
actionbase.c:70
ActionBase::m_SpecialtyWeight
float m_SpecialtyWeight
Definition
actionbase.c:83
ActionBase::m_ConditionTarget
ref CCTBase m_ConditionTarget
Definition
actionbase.c:71
ActionBase::ClearActionJuncture
void ClearActionJuncture(ActionData action_data)
Definition
actionbase.c:1104
ActionBase::ActionBase
void ActionBase()
Definition
actionbase.c:88
ActionBase::m_StanceMask
int m_StanceMask
Definition
actionbase.c:68
ActionSwitchSeats::OnUpdate
override void OnUpdate(ActionData action_data)
Definition
actionswitchseats.c:75
ActionSwitchSeats::AddActionJuncture
override bool AddActionJuncture(ActionData action_data)
Definition
actionswitchseats.c:93
ActionSwitchSeats::CreateConditionComponents
override void CreateConditionComponents()
Definition
actionswitchseats.c:13
ActionSwitchSeats::ActionCondition
override bool ActionCondition(PlayerBase player, ActionTarget target, ItemBase item)
Definition
actionswitchseats.c:19
ActionSwitchSeats::CanBeUsedInVehicle
override bool CanBeUsedInVehicle()
Definition
actionswitchseats.c:88
ActionSwitchSeats::OnStart
override void OnStart(ActionData action_data)
Definition
actionswitchseats.c:53
ActionSwitchSeats::ActionSwitchSeats
void ActionSwitchSeats()
Definition
actionswitchseats.c:4
CCINone
Definition
ccinone.c:2
CCTObject
Definition
cctobject.c:2
Class
Super root of all classes in Enforce script.
Definition
enscript.c:11
HumanCommandVehicle
Definition
human.c:690
HumanCommandVehicle::SwitchSeat
proto native void SwitchSeat(int pTransportPositionIndex, int pVehicleSeat)
Human
Definition
human.c:1333
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
InventoryLocation::SetVehicle
proto native void SetVehicle(notnull EntityAI parent, EntityAI e, int idx)
ItemBase
Definition
inventoryitem.c:742
PlayerBase
Definition
playerbaseclient.c:2
Transport
Native class for boats - handles physics simulation.
Definition
boat.c:32
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
DayZPlayerConstants
DayZPlayerConstants
defined in C++
Definition
dayzplayer.c:602
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
UA_START
const int UA_START
Definition
constants.c:472
End
proto static native void End()
Finalizes the testing process.
Games
Dayz
scripts
4_world
classes
useractionscomponent
actions
singleuse
vehicles
actionswitchseats.c
Generated by
1.17.0