3class HandAnimatedMoveToDst_W4T_Basic
extends HandStateBase
9 Man player = e.m_Player;
10 if (m_Dst && m_Dst.IsValid())
14 if (item.GetInventory().GetCurrentInventoryLocation(src))
16 if (
g_Game.IsDedicatedServer())
18 g_Game.ClearJunctureEx(m_Player, m_Dst.GetItem());
22 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
25 if (
g_Game.IsMultiplayer() && InventoryDebug.IsHandAckEnable())
27 if (!
g_Game.IsDedicatedServer())
29 m_Player.GetHumanInventory().PostDeferredEventTakeToDst(
InventoryMode.JUNCTURE, src, m_Dst);
37 player.OnItemInHandsChanged();
44 Debug.InventoryHFSMLog(
"[hndfsm] HandAnimatedMoveToDst_W4T_Basic - not allowed");
53 Error(
"[hndfsm] " +
Object.GetDebugName(e.m_Player) +
" STS = " + e.m_Player.GetSimulationTimeStamp() +
" HandAnimatedMoveToDst_W4T_Basic - item " + item +
" has no Inventory or Location, inv=" + item.GetInventory());
56 Error(
"[hndfsm] HandAnimatedMoveToDst_W4T_Basic - event has no valid m_Dst");
83 void HandForceSwapingAnimated_Show(Man player = null,
HandStateBase parent = null, WeaponActions action = WeaponActions.NONE,
int actionType = -1) { }
87 if (m_Src1 && m_Src2 && m_Dst1 && m_Dst2)
89 if (
g_Game.IsDedicatedServer())
96 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
97 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
100 #ifdef DIAG_DEVELOPER
101 if (
g_Game.IsMultiplayer() && InventoryDebug.IsHandAckEnable())
103 if (!
g_Game.IsDedicatedServer())
105 m_Player.GetHumanInventory().PostDeferredForceSwapEntities(
InventoryMode.JUNCTURE, m_Dst1.GetItem(), m_Dst2.GetItem(), m_Dst1, m_Dst2);
113 e.m_Player.OnItemInHandsChanged();
115 #ifdef DIAG_DEVELOPER
120 Error(
"[hndfsm] HandForceSwappingAnimated_Show is not properly configured!");
154 ref HandStartHidingAnimated m_Start;
155 ref HandAnimatedMoveToDst_W4T m_Show;
156 ref HandAnimatedMoveToDst_W4T_Basic m_Hide;
158 void HandAnimatedForceSwapping(Man player = null,
HandStateBase parent = null)
161 m_Start =
new HandStartHidingAnimated(player,
this, WeaponActions.HIDE, -1);
162 m_Show =
new HandAnimatedMoveToDst_W4T(player,
this, WeaponActions.SHOW, -1);
163 m_Hide =
new HandAnimatedMoveToDst_W4T_Basic(player,
this);
166 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
172 m_FSM.AddTransition(
new HandTransition( m_Start, _AEh_, m_Hide ));
179 m_FSM.SetInitialState(m_Start);
184 HandEventForceSwap efs = HandEventForceSwap.Cast(e);
189 m_Start.m_ActionType = efs.m_AnimationID;
192 m_Src2 = efs.GetSrc();
194 m_Dst2 = efs.GetDst();
197 m_Show.m_ActionType = efs.m_Animation2ID;
201 m_Start.m_ActionType = efs.m_Animation2ID;
203 m_Src1 = efs.GetSrc();
205 m_Dst1 = efs.GetDst();
208 m_Show.m_ActionType = efs.m_AnimationID;
211 m_Show.m_Dst = m_Dst1;
212 m_Hide.m_Dst = m_Dst2;
215 if (!
g_Game.IsDedicatedServer())
217 e.m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst1.GetItem(), m_Dst1, GameInventory.c_InventoryReservationTimeoutShortMS);
218 e.m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst2.GetItem(), m_Dst2, GameInventory.c_InventoryReservationTimeoutShortMS);
227 if ( !
g_Game.IsDedicatedServer())
231 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
236 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
262 if ( !
g_Game.IsDedicatedServer())
264 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
265 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
284 ref InventoryLocation m_Src1 = null;
285 ref InventoryLocation m_Src2 = null;
286 ref InventoryLocation m_Dst1 = null;
287 ref InventoryLocation m_Dst2 = null;
289 ref HandStartHidingAnimated m_Start;
290 ref HandForceSwappingAnimated_Show m_Swap;
292 void HandAnimatedForceSwapping_Inst(Man player = null, HandStateBase parent = null)
295 m_Start =
new HandStartHidingAnimated(player,
this, WeaponActions.HIDE, -1);
296 m_Swap =
new HandForceSwappingAnimated_Show(player,
this, WeaponActions.SHOW, -1);
299 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
303 m_FSM =
new HandFSM(
this);
305 m_FSM.AddTransition(
new HandTransition( m_Start, _AEh_, m_Swap ));
309 m_FSM.SetInitialState(m_Start);
314 HandEventForceSwap efs = HandEventForceSwap.Cast(e);
319 m_Start.m_ActionType = efs.m_AnimationID;
322 m_Src2 = efs.GetSrc();
324 m_Dst2 = efs.GetDst();
326 m_Swap.m_ActionType = efs.m_Animation2ID;
330 m_Start.m_ActionType = efs.m_Animation2ID;
332 m_Src1 = efs.GetSrc();
334 m_Dst1 = efs.GetDst();
337 m_Swap.m_ActionType = efs.m_AnimationID;
340 m_Swap.m_Src1 = m_Src1;
341 m_Swap.m_Dst1 = m_Dst1;
342 m_Swap.m_Src2 = m_Src2;
343 m_Swap.m_Dst2 = m_Dst2;
345 if (!
g_Game.IsDedicatedServer())
347 m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst1.GetItem(), m_Dst1, GameInventory.c_InventoryReservationTimeoutShortMS);
348 m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst2.GetItem(), m_Dst2, GameInventory.c_InventoryReservationTimeoutShortMS);
357 if ( !
g_Game.IsDedicatedServer())
361 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
365 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
390 if ( !
g_Game.IsDedicatedServer())
392 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
393 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
script counterpart to engine's class Inventory
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...
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
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
void Error(string err)
Messagebox with error message.
void HandEventBase(Man p=null, InventoryLocation src=null)
HandStateEquipped OnEntry
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
InventoryLocationType
types of Inventory Location
class WeaponChambering extends WeaponStateBase IsWaitingForActionFinish
class WeaponChambering_Chamber_OnEntry extends WeaponChambering_Base OnExit