9 Man player = e.m_Player;
10 if (m_Dst && m_Dst.IsValid())
14 if (item.GetInventory().GetCurrentInventoryLocation(src))
18 player.OnItemInHandsChanged();
25 Debug.InventoryHFSMLog(
"[hndfsm] HandAnimatedMoveToDst_W4T_Basic - not allowed");
31 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());
34 Error(
"[hndfsm] HandAnimatedMoveToDst_W4T_Basic - event has no valid m_Dst");
61 void HandForceSwapingAnimated_Show(Man player = null,
HandStateBase parent = null, WeaponActions action = WeaponActions.NONE,
int actionType = -1) { }
65 if (m_Src1 && m_Src2 && m_Dst1 && m_Dst2)
69 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
70 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
74 e.m_Player.OnItemInHandsChanged();
79 if (!
GetGame().IsDedicatedServer())
81 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
82 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
84 m_Player.GetHumanInventory().PostDeferredForceSwapEntities(
InventoryMode.JUNCTURE, m_Dst1.GetItem(), m_Dst2.GetItem(), m_Dst1, m_Dst2);
94 Error(
"[hndfsm] HandForceSwappingAnimated_Show is not properly configured!");
128 ref HandStartHidingAnimated m_Start;
129 ref HandAnimatedMoveToDst_W4T m_Show;
130 ref HandAnimatedMoveToDst_W4T_Basic m_Hide;
132 void HandAnimatedForceSwapping(Man player = null,
HandStateBase parent = null)
135 m_Start =
new HandStartHidingAnimated(player,
this, WeaponActions.HIDE, -1);
136 m_Show =
new HandAnimatedMoveToDst_W4T(player,
this, WeaponActions.SHOW, -1);
137 m_Hide =
new HandAnimatedMoveToDst_W4T_Basic(player,
this);
140 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
146 m_FSM.AddTransition(
new HandTransition( m_Start, _AEh_, m_Hide ));
153 m_FSM.SetInitialState(m_Start);
158 HandEventForceSwap efs = HandEventForceSwap.Cast(e);
163 m_Start.m_ActionType = efs.m_AnimationID;
166 m_Src2 = efs.GetSrc();
168 m_Dst2 = efs.GetDst();
171 m_Show.m_ActionType = efs.m_Animation2ID;
175 m_Start.m_ActionType = efs.m_Animation2ID;
177 m_Src1 = efs.GetSrc();
179 m_Dst1 = efs.GetDst();
182 m_Show.m_ActionType = efs.m_AnimationID;
185 m_Show.m_Dst = m_Dst1;
186 m_Hide.m_Dst = m_Dst2;
189 if (!
GetGame().IsDedicatedServer())
201 if ( !
GetGame().IsDedicatedServer())
205 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
206 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
228 if ( !
GetGame().IsDedicatedServer())
230 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
231 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
255 ref HandStartHidingAnimated m_Start;
258 void HandAnimatedForceSwapping_Inst(Man player = null,
HandStateBase parent = null)
261 m_Start =
new HandStartHidingAnimated(player,
this, WeaponActions.HIDE, -1);
265 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
271 m_FSM.AddTransition(
new HandTransition( m_Start, _AEh_, m_Swap ));
275 m_FSM.SetInitialState(m_Start);
280 HandEventForceSwap efs = HandEventForceSwap.Cast(e);
285 m_Start.m_ActionType = efs.m_AnimationID;
288 m_Src2 = efs.GetSrc();
290 m_Dst2 = efs.GetDst();
292 m_Swap.m_ActionType = efs.m_Animation2ID;
296 m_Start.m_ActionType = efs.m_Animation2ID;
298 m_Src1 = efs.GetSrc();
300 m_Dst1 = efs.GetDst();
303 m_Swap.m_ActionType = efs.m_AnimationID;
306 m_Swap.m_Src1 = m_Src1;
307 m_Swap.m_Dst1 = m_Dst1;
308 m_Swap.m_Src2 = m_Src2;
309 m_Swap.m_Dst2 = m_Dst2;
311 if (!
GetGame().IsDedicatedServer())
323 if ( !
GetGame().IsDedicatedServer())
327 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
331 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
356 if ( !
GetGame().IsDedicatedServer())
358 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst1.GetItem(), m_Dst1);
359 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...
const int c_InventoryReservationTimeoutShortMS
static proto native bool LocationSwap(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
swaps two entities
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
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
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
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