Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
handanimatedmovingtoatt.c
Go to the documentation of this file.
1class 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
26class 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
90class HandAnimatedMovingToAtt extends HandStateBase
91{
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
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
class LogManager EntityAI
map m_Player
Entity m_Entity
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
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