Dayz Explorer 1.28.160049
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();
36 if (item.GetInventory().GetCurrentInventoryLocation(src))
37 {
38 if (!GetGame().IsDedicatedServer())
39 {
40 if (!GetGame().IsMultiplayer())
41 {
42 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
45 }
46 else
47 {
48 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
49 m_Player.GetHumanInventory().PostDeferredEventTakeToDst(InventoryMode.JUNCTURE,src, m_Dst);
50 }
51 }
52 else
53 {
54 GetGame().ClearJunctureEx(m_Player, m_Dst.GetItem());
55 }
56 }
57 else
58 Error("[hndfsm] " + Object.GetDebugName(m_Player) + " STS = " + m_Player.GetSimulationTimeStamp() + " HandAnimatedMoveToDst_W4T - item " + item + " has no Inventory or Location, inv=" + item.GetInventory());
59 }
60 else
61 Error("[hndfsm] HandAnimatedMoveToDst_W4T - event has no valid m_Dst");
62
63 super.OnEntry(e);
64 }
65
66 override void OnAbort(HandEventBase e)
67 {
68 m_Dst = null;
69 super.OnAbort(e);
70 }
71
72 override void OnExit(HandEventBase e)
73 {
74 m_Dst = null;
75 super.OnExit(e);
76 }
77
78 override bool IsWaitingForActionFinish() { return true; }
79};
80
81class HandAnimatedMovingToAtt extends HandStateBase
82{
84
85 ref HandStartHidingAnimated m_Hide;
86 ref HandAnimatedMoveToDst_W4T m_Show;
87
88 ref InventoryLocation m_ilEntity;
89
90 void HandAnimatedMovingToAtt(Man player = null, HandStateBase parent = null)
91 {
92 // setup nested state machine
93 m_Hide = new HandStartHidingAnimated(player, this, WeaponActions.HIDE, -1);
94 m_Show = new HandAnimatedMoveToDst_W4T(player, this, WeaponActions.SHOW, -1);
95
96 // events:
97 HandEventBase _fin_ = new HandEventHumanCommandActionFinished;
98 HandEventBase _AEh_ = new HandAnimEventChanged;
99
100 m_FSM = new HandFSM(this); // @NOTE: set owner of the submachine fsm
101
102 m_FSM.AddTransition(new HandTransition( m_Hide, _AEh_, m_Show ));
103 m_FSM.AddTransition(new HandTransition( m_Show, _fin_, null ));
104
105 m_FSM.SetInitialState(m_Hide);
106 }
107
108 override void OnEntry(HandEventBase e)
109 {
110 m_Entity = e.GetSrcEntity();
111 HandEventMoveTo ev_move = HandEventMoveTo.Cast(e);
112 if (ev_move)
113 {
114 m_Show.m_Dst = ev_move.GetDst();
115 m_Hide.m_ActionType = ev_move.GetAnimationID();
116 m_Show.m_ActionType = ev_move.GetAnimationID();
117
118 m_ilEntity = m_Show.m_Dst;
119
120 m_Player.GetHumanInventory().AddInventoryReservationEx(m_Entity, m_ilEntity, GameInventory.c_InventoryReservationTimeoutShortMS);
121 }
122
123 super.OnEntry(e); // @NOTE: super at the end (prevent override from submachine start)
124 }
125
126 override void OnAbort(HandEventBase e)
127 {
128 if ( !GetGame().IsDedicatedServer())
129 {
130 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Entity, m_ilEntity);
131 }
132 else
133 {
134 GetGame().ClearJunctureEx(m_Player, m_Entity);
135 }
136
137 m_Entity = null;
138 m_ilEntity = null;
139
140 super.OnAbort(e);
141 }
142
143 override void OnExit(HandEventBase e)
144 {
145 if ( !GetGame().IsDedicatedServer())
146 {
147 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Entity, m_ilEntity);
148 }
149
150 m_Entity = null;
151 m_ilEntity = null;
152
153 super.OnExit(e);
154 }
155};
156
157
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Definition inventory.c:22
EntityAI m_Entity
Definition actiondebug.c:11
override void OnItemInHandsChanged()
script counterpart to engine's class Inventory
Definition inventory.c:79
static proto native bool LocationSyncMoveEntity(notnull InventoryLocation src_loc, notnull InventoryLocation dst_loc)
synchronously removes item from current inventory location and adds it to destination no anims involv...
const int c_InventoryReservationTimeoutShortMS
Definition inventory.c:713
Abstracted event, not to be used, only inherited.
Hand finite state machine.
simple class starting animation action specified by m_action and m_actionType
represent hand state base
InventoryLocation.
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
DayZPlayer m_Player
Definition hand_events.c:42
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