Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
handanimatedtakingfromatt.c
Go to the documentation of this file.
1class HandTakingAnimated_Hide extends HandStartAction
2{ };
3
4class HandTakingAnimated_Show extends HandStartAction
5{
6 ref InventoryLocation m_Src;
7 ref InventoryLocation m_Dst;
8
9 void HandTakingAnimated_Show(Man player = null, HandStateBase parent = null, WeaponActions action = WeaponActions.NONE, int actionType = -1)
10 {
11 m_Src = null;
12 m_Dst = null;
13 }
14
15 override void OnEntry(HandEventBase e)
16 {
17 super.OnEntry(e);
18
19 if (m_Src)
20 {
21 if (m_Src.IsValid())
22 {
23 #ifdef ENABLE_LOGGING
24 if ( LogManager.IsInventoryHFSMLogEnable() )
25 {
26 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString() , "n/a", "OnEntry", e.m_Player.ToString() );
27 }
28 #endif
29
30 if (g_Game.IsDedicatedServer())
31 {
32 g_Game.ClearJunctureEx(e.m_Player, m_Dst.GetItem());
33 }
34 else
35 {
36 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
37 }
38
39 #ifdef DIAG_DEVELOPER
40 if (g_Game.IsMultiplayer() && InventoryDebug.IsHandAckEnable())
41 {
42 if (!g_Game.IsDedicatedServer())
43 {
44 m_Player.GetHumanInventory().PostDeferredEventTakeToDst(InventoryMode.JUNCTURE, m_Src, m_Dst);
45 }
46 }
47 else
48 {
49 #endif
50 if (GameInventory.LocationSyncMoveEntity(m_Src, m_Dst))
51 {
52 m_Player.OnItemInHandsChanged();
53 }
54 #ifdef DIAG_DEVELOPER
55 }
56 #endif
57 }
58 else
59 {
60 Error("[hndfsm] " + Object.GetDebugName(e.m_Player) + " STS = " + e.m_Player.GetSimulationTimeStamp() + " HandTakingAnimated_Show m_Src=invalid, item not in bubble?");
61 }
62 }
63 else
64 Error("[hndfsm] HandTakingAnimated_Show, error - m_Src not configured");
65 }
66
67 override void OnAbort(HandEventBase e)
68 {
69 m_Src = null;
70 m_Dst = null;
71 super.OnAbort(e);
72 }
73
74 override void OnExit(HandEventBase e)
75 {
76 m_Src = null;
77 m_Dst = null;
78 super.OnExit(e);
79 }
80
81 override bool IsWaitingForActionFinish() { return true; }
82};
83
84
85class HandAnimatedTakingFromAtt extends HandStateBase
86{
87 ref HandTakingAnimated_Hide m_Hide;
88 ref HandTakingAnimated_Show m_Show;
89
90 ref InventoryLocation m_Dst;
91
92 void HandAnimatedTakingFromAtt(Man player = null, HandStateBase parent = null)
93 {
94 // setup nested state machine
95 m_Hide = new HandTakingAnimated_Hide(player, this, WeaponActions.HIDE, -1);
96 m_Show = new HandTakingAnimated_Show(player, this, WeaponActions.SHOW, -1);
97
98 // events:
99 HandEventBase _fin_ = new HandEventHumanCommandActionFinished;
100 HandEventBase _AEh_ = new HandAnimEventChanged;
101 HandEventBase __Xd_ = new HandEventDestroyed;
102
103 m_FSM = new HandFSM(this); // @NOTE: set owner of the submachine fsm
104
105 m_FSM.AddTransition(new HandTransition( m_Hide, _AEh_, m_Show ));
106 m_FSM.AddTransition(new HandTransition( m_Hide, __Xd_, null ));
107 m_FSM.AddTransition(new HandTransition( m_Show, _fin_, null ));
108 m_FSM.AddTransition(new HandTransition( m_Show, __Xd_, null ));
109
110 m_FSM.SetInitialState(m_Hide);
111 }
112
113 override void OnEntry(HandEventBase e)
114 {
115 m_Dst = e.GetDst();
116 m_Show.m_Src = e.GetSrc();
117 m_Show.m_Dst = e.GetDst();
118
119 m_Hide.m_ActionType = e.GetAnimationID();
120 m_Show.m_ActionType = e.GetAnimationID();
121
122 m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst.GetItem(), m_Dst, GameInventory.c_InventoryReservationTimeoutShortMS);
123
124 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
125 }
126
127 override void OnAbort(HandEventBase e)
128 {
129 #ifdef ENABLE_LOGGING
130 if ( LogManager.IsInventoryHFSMLogEnable() )
131 {
132 Debug.InventoryHFSMLog("Action - STS = " + e.m_Player.GetSimulationTimeStamp(), e.ToString() , "n/a", "OnAbort", e.m_Player.ToString() );
133 }
134 #endif
135 if (m_Dst)
136 {
137 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
138 if ( g_Game.IsServer() )
139 g_Game.ClearJunctureEx(e.m_Player, m_Dst.GetItem());
140 }
141 m_Dst = null;
142
143 super.OnAbort(e);
144 }
145
146 override void OnExit(HandEventBase e)
147 {
148 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
149 m_Dst = null;
150
151 super.OnExit(e);
152 }
153};
154
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
map m_Player
string Debug()
simple class starting animation action specified by m_action and m_actionType
represent hand state base
DayZGame g_Game
Definition dayzgame.c:3942
class LOD Object
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
ref InventoryLocation m_Src
Definition hand_events.c:43
void HandEventBase(Man p=null, InventoryLocation src=null)
Definition hand_events.c:52
HandStateEquipped OnEntry
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
Definition handfsm.c:28
override void OnAbort()
class WeaponChambering extends WeaponStateBase IsWaitingForActionFinish
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit