Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
handanimatedmovingtoatt.c
Go to the documentation of this file.
1
class
HandStartHidingAnimated
extends
HandStartAction
2
{
3
void
HandStartHidingAnimated
(Man player = null,
HandStateBase
parent = null,
WeaponActions
action =
WeaponActions
.NONE,
int
actionType = -1)
4
{ }
5
6
override
void
OnEntry
(
HandEventBase
e)
7
{
8
super.OnEntry(e);
9
}
10
11
override
void
OnAbort
(
HandEventBase
e)
12
{
13
super.OnAbort(e);
14
}
15
16
override
void
OnExit
(
HandEventBase
e)
17
{
18
super.OnExit(e);
19
}
20
21
override
bool
IsWaitingForActionFinish
() {
return
m_ActionType == -1; }
22
};
23
24
// When editing this, take a look at HandAnimatedMoveToDst_W4T_Basic as well
25
// They can not be inherited from each other because of different inheritance
26
class
HandAnimatedMoveToDst_W4T
extends
HandStartAction
27
{
28
ref
InventoryLocation
m_Dst
;
29
30
override
void
OnEntry
(
HandEventBase
e)
31
{
32
if
(
m_Dst
&&
m_Dst
.IsValid())
33
{
34
EntityAI
item =
m_Dst
.GetItem();
35
InventoryLocation
src =
new
InventoryLocation
;
36
if
(item.GetInventory().GetCurrentInventoryLocation(src))
37
{
38
if
(
g_Game
.IsDedicatedServer())
39
{
40
g_Game
.ClearJunctureEx(
m_Player
,
m_Dst
.GetItem());
41
}
42
else
43
{
44
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Dst
.GetItem(),
m_Dst
);
45
}
46
47
#ifdef DIAG_DEVELOPER
48
if
(
g_Game
.IsMultiplayer() && InventoryDebug.IsHandAckEnable())
49
{
50
if
(!
g_Game
.IsDedicatedServer())
51
{
52
m_Player
.GetHumanInventory().PostDeferredEventTakeToDst(
InventoryMode
.JUNCTURE,src,
m_Dst
);
53
}
54
}
55
else
56
{
57
#endif
58
if
(
GameInventory
.
LocationSyncMoveEntity
(src,
m_Dst
))
59
{
60
m_Player
.OnItemInHandsChanged();
61
}
62
#ifdef DIAG_DEVELOPER
63
}
64
#endif
65
}
66
else
67
Error
(
"[hndfsm] "
+
Object
.GetDebugName(
m_Player
) +
" STS = "
+
m_Player
.GetSimulationTimeStamp() +
" HandAnimatedMoveToDst_W4T - item "
+ item +
" has no Inventory or Location, inv="
+ item.GetInventory());
68
}
69
else
70
Error
(
"[hndfsm] HandAnimatedMoveToDst_W4T - event has no valid m_Dst"
);
71
72
super.OnEntry(e);
73
}
74
75
override
void
OnAbort
(
HandEventBase
e)
76
{
77
m_Dst
= null;
78
super.OnAbort(e);
79
}
80
81
override
void
OnExit
(
HandEventBase
e)
82
{
83
m_Dst
= null;
84
super.OnExit(e);
85
}
86
87
override
bool
IsWaitingForActionFinish
() {
return
true
; }
88
};
89
90
class
HandAnimatedMovingToAtt
extends
HandStateBase
91
{
92
EntityAI
m_Entity
;
93
94
ref HandStartHidingAnimated
m_Hide
;
95
ref HandAnimatedMoveToDst_W4T
m_Show
;
96
97
ref
InventoryLocation
m_ilEntity
;
98
99
void
HandAnimatedMovingToAtt
(Man player = null,
HandStateBase
parent = null)
100
{
101
// setup nested state machine
102
m_Hide
=
new
HandStartHidingAnimated(player,
this
,
WeaponActions
.HIDE, -1);
103
m_Show
=
new
HandAnimatedMoveToDst_W4T(player,
this
,
WeaponActions
.SHOW, -1);
104
105
// events:
106
HandEventBase
_fin_ =
new
HandEventHumanCommandActionFinished;
107
HandEventBase
_AEh_ =
new
HandAnimEventChanged;
108
109
m_FSM
=
new
HandFSM
(
this
);
// @NOTE: set owner of the submachine fsm
110
111
m_FSM
.AddTransition(
new
HandTransition
(
m_Hide
, _AEh_,
m_Show
));
112
m_FSM
.AddTransition(
new
HandTransition
(
m_Show
, _fin_, null ));
113
114
m_FSM
.SetInitialState(
m_Hide
);
115
}
116
117
override
void
OnEntry
(
HandEventBase
e)
118
{
119
m_Entity
= e.GetSrcEntity();
120
HandEventMoveTo ev_move = HandEventMoveTo.Cast(e);
121
if
(ev_move)
122
{
123
m_Show
.m_Dst = ev_move.GetDst();
124
m_Hide
.m_ActionType = ev_move.GetAnimationID();
125
m_Show
.m_ActionType = ev_move.GetAnimationID();
126
127
m_ilEntity
=
m_Show
.m_Dst;
128
129
m_Player
.GetHumanInventory().AddInventoryReservationEx(
m_Entity
,
m_ilEntity
,
GameInventory
.
c_InventoryReservationTimeoutShortMS
);
130
}
131
132
super.OnEntry(e);
// @NOTE: super at the end (prevent override from submachine start)
133
}
134
135
override
void
OnAbort
(
HandEventBase
e)
136
{
137
if
( !
g_Game
.IsDedicatedServer())
138
{
139
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Entity
,
m_ilEntity
);
140
}
141
else
142
{
143
g_Game
.ClearJunctureEx(
m_Player
,
m_Entity
);
144
}
145
146
m_Entity
= null;
147
m_ilEntity
= null;
148
149
super.OnAbort(e);
150
}
151
152
override
void
OnExit
(
HandEventBase
e)
153
{
154
if
( !
g_Game
.IsDedicatedServer())
155
{
156
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Entity
,
m_ilEntity
);
157
}
158
159
m_Entity
= null;
160
m_ilEntity
= null;
161
162
super.OnExit(e);
163
}
164
};
165
166
InventoryMode
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition
inventory.c:22
m_Player
map m_Player
EntityAI
Definition
inventoryitem.c:2
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::c_InventoryReservationTimeoutShortMS
const int c_InventoryReservationTimeoutShortMS
Definition
inventory.c:715
GameInventory::LocationSyncMoveEntity
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
HandEventBase
Abstracted event, not to be used, only inherited.
Definition
hand_events.c:212
HandFSM
Hand finite state machine.
HandStartAction
simple class starting animation action specified by m_action and m_actionType
Definition
handanimatedforceswapping.c:77
HandStartAction::HandStartHidingAnimated
void HandStartHidingAnimated(Man player=null, HandStateBase parent=null, WeaponActions action=WeaponActions.NONE, int actionType=-1)
Definition
handanimatedmovingtoatt.c:3
HandStartAction::OnAbort
override void OnAbort(HandEventBase e)
Definition
handanimatedmovingtoatt.c:11
HandStartAction::OnEntry
override void OnEntry(HandEventBase e)
Definition
handanimatedmovingtoatt.c:6
HandStartAction::m_Dst
ref InventoryLocation m_Dst
Definition
handanimatedmovingtoatt.c:28
HandStartAction::OnExit
override void OnExit(HandEventBase e)
Definition
handanimatedmovingtoatt.c:16
HandStartAction::IsWaitingForActionFinish
override bool IsWaitingForActionFinish()
Definition
handanimatedmovingtoatt.c:21
HandStateBase
represent hand state base
Definition
handanimatedforceswapping.c:4
HandStateBase::OnAbort
override void OnAbort(HandEventBase e)
Definition
handanimatedmovingtoatt.c:135
HandStateBase::OnEntry
override void OnEntry(HandEventBase e)
Definition
handanimatedmovingtoatt.c:117
HandStateBase::HandAnimatedMovingToAtt
void HandAnimatedMovingToAtt(Man player=null, HandStateBase parent=null)
Definition
handanimatedmovingtoatt.c:99
HandStateBase::m_FSM
ref HandFSM m_FSM
hierarchical parent state of this state (or null)
Definition
handstatebase.c:10
HandStateBase::m_ilEntity
ref InventoryLocation m_ilEntity
Definition
handanimatedmovingtoatt.c:97
HandStateBase::HandStateBase
void HandStateBase(Man player=NULL, HandStateBase parent=NULL)
nested state machine (or null)
Definition
handstatebase.c:11
HandStateBase::OnExit
override void OnExit(HandEventBase e)
Definition
handanimatedmovingtoatt.c:152
HandStateBase::m_Hide
ref HandAnimatedMoveToDst_W4T_Basic m_Hide
Definition
handanimatedforceswapping.c:156
HandStateBase::m_Entity
EntityAI m_Entity
Definition
handanimatedmovingtoatt.c:92
HandStateBase::m_Show
ref HandAnimatedMoveToDst_W4T m_Show
Definition
handanimatedforceswapping.c:155
HandStateBase::m_Player
Man m_Player
Definition
handstatebase.c:8
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
Object
Definition
objecttyped.c:2
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Error
void Error(string err)
Messagebox with error message.
Definition
endebug.c:90
HandTransition
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition
handfsm.c:28
WeaponActions
WeaponActions
actions
Definition
human.c:816
Games
Dayz
scripts
3_game
systems
inventory
handanimatedmovingtoatt.c
Generated by
1.17.0