Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
handanimatedswapping.c
Go to the documentation of this file.
1
class
HandSwappingAnimated_Show
extends
HandForceSwappingAnimated_Show
2
{
3
};
4
5
6
class
HandAnimatedSwapping
extends
HandStateBase
7
{
8
ref
InventoryLocation
m_Src1 = null;
9
ref
InventoryLocation
m_Src2 = null;
10
ref
InventoryLocation
m_Dst1 = null;
11
ref
InventoryLocation
m_Dst2 = null;
12
13
ref HandStartHidingAnimated m_Hide;
14
ref HandSwappingAnimated_Show
m_Show
;
15
16
void
HandAnimatedSwapping
(Man player = null,
HandStateBase
parent = null)
17
{
18
// setup nested state machine
19
m_Hide
=
new
HandStartHidingAnimated(player,
this
,
WeaponActions
.HIDE, -1);
20
m_Show
=
new
HandSwappingAnimated_Show(player,
this
,
WeaponActions
.SHOW, -1);
21
22
// events:
23
HandEventBase
_fin_ =
new
HandEventHumanCommandActionFinished;
24
HandEventBase
_AEh_ =
new
HandAnimEventChanged;
25
26
m_FSM
=
new
HandFSM
(
this
);
// @NOTE: set owner of the submachine fsm
27
28
m_FSM
.AddTransition(
new
HandTransition
(
m_Hide
, _AEh_,
m_Show
));
29
m_FSM
.AddTransition(
new
HandTransition
(
m_Show
, _fin_, null ));
30
31
m_FSM
.SetInitialState(
m_Hide
);
32
}
33
34
override
void
OnEntry
(
HandEventBase
e)
35
{
36
HandEventSwap
es =
HandEventSwap
.Cast(e);
37
if
(es)
38
{
39
m_Src1
= es.m_Src2;
40
m_Src2
= es.GetSrc();
41
m_Dst1
= es.m_Dst2;
42
m_Dst2
= es.GetDst();
43
44
m_Show
.m_Src1 =
m_Src1
;
45
m_Show
.m_Src2 =
m_Src2
;
46
m_Show
.m_Dst1 =
m_Dst1
;
47
m_Show
.m_Dst2 =
m_Dst2
;
48
49
m_Hide
.m_ActionType = es.m_AnimationID;
50
m_Show
.m_ActionType = es.m_Animation2ID;
51
52
if
(!
g_Game
.IsDedicatedServer())
53
{
54
m_Player
.GetHumanInventory().AddInventoryReservationEx(
m_Dst2
.GetItem(),
m_Dst2
,
GameInventory
.
c_InventoryReservationTimeoutShortMS
);
55
m_Player
.GetHumanInventory().AddInventoryReservationEx(
m_Dst1
.GetItem(),
m_Dst1
,
GameInventory
.
c_InventoryReservationTimeoutShortMS
);
56
}
57
}
58
59
super.OnEntry(e);
// @NOTE: super at the end (prevent override from submachine start)
60
}
61
62
override
void
OnAbort
(
HandEventBase
e)
63
{
64
if
( !
g_Game
.IsDedicatedServer())
65
{
66
if
(
m_Dst2
)
67
{
68
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Dst2
.GetItem(),
m_Dst2
);
69
}
70
if
(
m_Dst1
)
71
{
72
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Dst1
.GetItem(),
m_Dst1
);
73
}
74
}
75
else
76
{
77
if
(
m_Dst2
)
78
{
79
g_Game
.ClearJunctureEx(
m_Player
,
m_Dst2
.GetItem());
80
}
81
if
(
m_Dst1
)
82
{
83
g_Game
.ClearJunctureEx(
m_Player
,
m_Dst1
.GetItem());
84
}
85
}
86
87
m_Src1
= null;
88
m_Src2
= null;
89
m_Dst1
= null;
90
m_Dst2
= null;
91
92
super.OnAbort(e);
93
}
94
95
override
void
OnExit
(
HandEventBase
e)
96
{
97
if
( !
g_Game
.IsDedicatedServer())
98
{
99
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Dst2
.GetItem(),
m_Dst2
);
100
m_Player
.GetHumanInventory().ClearInventoryReservationEx(
m_Dst1
.GetItem(),
m_Dst1
);
101
}
102
103
m_Src1
= null;
104
m_Src2
= null;
105
m_Dst1
= null;
106
m_Dst2
= null;
107
108
super.OnExit(e);
109
}
110
};
111
GameInventory
script counterpart to engine's class Inventory
Definition
inventory.c:81
GameInventory::c_InventoryReservationTimeoutShortMS
const int c_InventoryReservationTimeoutShortMS
Definition
inventory.c:715
HandEventBase
Abstracted event, not to be used, only inherited.
Definition
hand_events.c:212
HandEventSwap
Definition
hand_events.c:726
HandFSM
Hand finite state machine.
HandForceSwappingAnimated_Show
Definition
handanimatedswapping.c:2
HandStateBase
represent hand state base
Definition
handanimatedforceswapping.c:4
HandStateBase::OnAbort
override void OnAbort(HandEventBase e)
Definition
handanimatedswapping.c:62
HandStateBase::OnEntry
override void OnEntry(HandEventBase e)
Definition
handanimatedswapping.c:34
HandStateBase::m_FSM
ref HandFSM m_FSM
hierarchical parent state of this state (or null)
Definition
handstatebase.c:10
HandStateBase::m_Src2
ref InventoryLocation m_Src2
Definition
handanimatedforceswapping.c:150
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
handanimatedswapping.c:95
HandStateBase::m_Dst1
ref InventoryLocation m_Dst1
Definition
handanimatedforceswapping.c:151
HandStateBase::m_Dst2
ref InventoryLocation m_Dst2
Definition
handanimatedforceswapping.c:152
HandStateBase::HandAnimatedSwapping
void HandAnimatedSwapping(Man player=null, HandStateBase parent=null)
Definition
handanimatedswapping.c:16
HandStateBase::m_Hide
ref HandAnimatedMoveToDst_W4T_Basic m_Hide
Definition
handanimatedforceswapping.c:156
HandStateBase::m_Show
ref HandAnimatedMoveToDst_W4T m_Show
Definition
handanimatedforceswapping.c:155
HandStateBase::m_Src1
ref InventoryLocation m_Src1
Definition
handanimatedforceswapping.c:149
HandStateBase::m_Player
Man m_Player
Definition
handstatebase.c:8
InventoryLocation
InventoryLocation.
Definition
inventorylocation.c:30
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
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
handanimatedswapping.c
Generated by
1.17.0