24 if (!inventory.HasInventoryReservation(
m_dst.GetItem(),
m_dst))
36 inventory.ClearInventoryReservationEx(
m_dst.GetItem(),
m_dst);
135 return m_event.ReserveInventory();
140 m_event.ClearInventoryReservation();
173 if (!
Class.CastTo(player, GetInventoryOwner()))
184 if (!
Class.CastTo(player, GetInventoryOwner()))
195 if (!
Class.CastTo(player, GetInventoryOwner()))
210 CreateStableStates();
212 m_Taking =
new HandAnimatedTakingFromAtt(GetManOwner(), null);
213 m_MovingTo =
new HandAnimatedMovingToAtt(GetManOwner(), null);
214 m_Swapping =
new HandAnimatedSwapping(GetManOwner(), null);
215 m_FSwapping =
new HandAnimatedForceSwapping(GetManOwner(), null);
216 m_FSwappingInst =
new HandAnimatedForceSwapping_Inst(GetManOwner(), null);
219 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
220 HandEventBase _abt_ =
new HandEventHumanCommandActionAborted;
229 m_FSM.AddTransition(
new HandTransition( m_Empty , __T__,
m_Taking, NULL,
new HandSelectAnimationOfTakeToHandsEvent(GetManOwner())));
230 m_FSM.AddTransition(
new HandTransition(
m_Taking , _fin_, m_Empty, null,
new HandGuardNot(
new HandGuardHasItemInHands(GetManOwner()))));
232 m_FSM.AddTransition(
new HandTransition(
m_Taking , __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
236 m_FSM.AddTransition(
new HandTransition( m_Equipped, __M__,
m_MovingTo, NULL,
new HandSelectAnimationOfMoveFromHandsEvent(GetManOwner())));
237 m_FSM.AddTransition(
new HandTransition(
m_MovingTo, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
238 m_FSM.AddTransition(
new HandTransition(
m_MovingTo, _fin_, m_Equipped, null,
new HandGuardHasItemInHands(GetManOwner())));
243 m_FSM.AddTransition(
new HandTransition( m_Equipped, __W__,
m_Swapping, NULL,
new HandSelectAnimationOfSwapInHandsEvent(GetManOwner())));
244 m_FSM.AddTransition(
new HandTransition(
m_Swapping, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
245 m_FSM.AddTransition(
new HandTransition(
m_Swapping, _fin_, m_Empty, null,
new HandGuardNot(
new HandGuardHasItemInHands(GetManOwner()))));
252 m_FSM.AddTransition(
new HandTransition(
m_FSwappingInst, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
256 m_FSM.AddTransition(
new HandTransition(
m_FSwapping, _fin_, m_Equipped, null,
new HandGuardHasItemInHands(GetManOwner())));
258 m_FSM.AddTransition(
new HandTransition(
m_FSwapping, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
287 Class.CastTo(weapon, GetEntityInHands());
289 if (hcw && weapon && weapon.CanProcessWeaponEvents() && !weapon.IsIdle())
293 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
296 weapon.ProcessWeaponAbortEvent(
new WeaponEventHumanCommandActionAborted(
GetDayZPlayerOwner()));
317 Error(
"[wpnfsm] " +
Object.GetDebugName(GetInventoryOwner()) +
" warning - pending event already posted, curr_event=" +
m_DeferredWeaponEvent.DumpToString() +
" new_event=" + e.DumpToString());
324 Class.CastTo(weapon, GetEntityInHands());
326 string secondPart =
" - ENTITY IN HANDS IS NOT A WEAPON: " +
Object.GetDebugName(GetEntityInHands());
328 string firstPart =
"[wpnfsm] " +
Object.GetDebugName(GetInventoryOwner()) +
" failed to perform weaponevent " +
m_DeferredWeaponEvent.DumpToString();
331 secondPart =
" on " +
Object.GetDebugName(GetEntityInHands()) +
" which is in state " + weapon.GetCurrentState();
332 secondPart +=
" with physical state: J: " + weapon.IsJammed() +
" | ";
333 for (
int i = 0; i < weapon.GetMuzzleCount(); ++i)
335 secondPart +=
"Chamber_" + i +
": B(" + weapon.IsChamberFull(i) +
") F(" + weapon.IsChamberFiredOut(i) +
") E(" + weapon.IsChamberEmpty(i) +
") | ";
336 secondPart +=
"Magazine_" + i +
": " + weapon.GetMagazine(i);
337 if (i < weapon.GetMuzzleCount() - 1)
342 Error(firstPart + secondPart);
351 Class.CastTo(weapon, GetEntityInHands());
355 weapon.UpdateCoolDown(dt);
356 if (hcw && weapon.CanProcessWeaponEvents())
359 weapon.GetCurrentState().OnUpdate(dt);
363 wpnDebugSpamALot(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" HCW: playing A=" +
typename.EnumToString(WeaponActions, hcw.GetRunningAction()) +
" AT=" + WeaponActionTypeToString(hcw.GetRunningAction(), hcw.GetRunningActionType()) +
" fini=" + hcw.IsActionFinished());
366 if (!weapon.IsIdle())
370 int weaponEventId = hcw.IsEvent();
371 if (weaponEventId == -1)
376 if (weaponEventId == WeaponEvents.CHANGE_HIDE)
385 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" HandleWeapons: event arrived " +
typename.EnumToString(WeaponEvents, weaponEventId) +
"(" + weaponEventId +
") fsm_ev=" + anim_event.ToString());
388 if (anim_event != NULL)
390 weapon.ProcessWeaponEvent(anim_event);
394 if (hcw.IsActionFinished())
396 if (weapon.IsWaitingForActionFinish())
400 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: finished! notifying waiting state=" + weapon.GetCurrentState());
403 weapon.ProcessWeaponEvent(
new WeaponEventHumanCommandActionFinished(
GetDayZPlayerOwner()));
409 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
412 weapon.ProcessWeaponAbortEvent(
new WeaponEventHumanCommandActionAborted(
GetDayZPlayerOwner()));
426 exitIronSights =
true;
451 Class.CastTo(weapon, ih);
455 m_FSM.GetCurrentState().OnUpdate(dt);
457 #ifdef ENABLE_LOGGING
460 hndDebugSpamALot(
"[hndfsm] HCW: playing A=" +
typename.EnumToString(WeaponActions, hcw.GetRunningAction()) +
" AT=" + WeaponActionTypeToString(hcw.GetRunningAction(), hcw.GetRunningActionType()) +
" fini=" + hcw.IsActionFinished());
464 if ( !m_FSM.GetCurrentState().IsIdle() || !m_FSM.IsRunning())
468 int weaponEventId = hcw.IsEvent();
469 if (weaponEventId == -1)
476 #ifdef ENABLE_LOGGING
479 hndDebugPrint(
"[hndfsm] HandleInventory: event arrived " +
typename.EnumToString(WeaponEvents, weaponEventId) +
"(" + weaponEventId +
") fsm_ev=" + anim_event.ToString());
483 if (anim_event != NULL)
486 ProcessHandEvent(anim_event);
490 if (hcw.IsActionFinished())
492 if (m_FSM.GetCurrentState().IsWaitingForActionFinish())
494 #ifdef ENABLE_LOGGING
497 hndDebugPrint(
"[hndfsm] Hand-Weapon event: finished! notifying waiting state=" + m_FSM.GetCurrentState());
501 HandEventBase fin_event =
new HandEventHumanCommandActionFinished(GetManOwner());
503 ProcessHandEvent(fin_event);
507 #ifdef ENABLE_LOGGING
510 hndDebugPrint(
"[hndfsm] Hand-Weapon event: ABORT! notifying running state=" + m_FSM.GetCurrentState());
514 HandEventBase abt_event =
new HandEventHumanCommandActionAborted(GetManOwner());
516 ProcessHandAbortEvent(abt_event);
596 if (
GetGame().IsDedicatedServer())
601 int udtIdentifier = -1;
621 src.ReadFromContext(ctx);
622 dst.ReadFromContext(ctx);
623 ClearInventoryReservationEx(dst.GetItem(), dst);
631 e.ClearInventoryReservation();
636 src.ReadFromContext(ctx);
637 temp.ReadFromContext(ctx);
638 dst.ReadFromContext(ctx);
639 temp.ReadFromContext(ctx);
641 ClearInventoryReservationEx(dst.GetItem(), dst);
642 ClearInventoryReservationEx(temp.GetItem(), temp);
651 src.ReadFromContext(ctx);
657 if (!ctx.Read(reason))
780 src.ReadFromContext(ctx);
781 dst.ReadFromContext(ctx);
783 #ifdef ENABLE_LOGGING
790 if (validation.m_IsRemote && (!src.GetItem() || !dst.GetItem()))
886 #ifdef ENABLE_LOGGING
896 LocationSyncMoveEntity(src, dst);
904 #ifdef ENABLE_LOGGING
913 #ifdef ENABLE_LOGGING
916 DumpInventoryDebug();
934 #ifdef ENABLE_LOGGING
949 ClearInventoryReservationEx(dst.GetItem(), dst);
963 #ifdef ENABLE_LOGGING
966 DumpInventoryDebug();
982 #ifdef ENABLE_LOGGING
985 Debug.InventoryMoveLog(
"Failed - MoveCheckExclusionMaskLocal - condition failed locally",
"SYNC_MOVE" ,
"n/a",
"ProcessInputData",
GetDayZPlayerOwner().
ToString() );
991 #ifdef ENABLE_LOGGING
998 LocationSyncMoveEntity(src, dst);
1007 bool success =
true;
1010 e.ClearInventoryReservation();
1015 e.m_IsRemote = validation.m_IsRemote;
1016 e.m_IsJuncture = validation.m_IsJuncture;
1018 EntityAI itemSrc = e.GetSrcEntity();
1019 EntityAI itemDst = e.GetSecondSrcEntity();
1021 #ifdef ENABLE_LOGGING
1024 Debug.InventoryMoveLog(
"STS = " + e.m_Player.GetSimulationTimeStamp() +
" event= " + e.DumpToString(),
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1028 if (validation.m_IsRemote && !e.GetSrcEntity())
1034 srcNew.Copy(e.GetSrc());
1037 Error(
"[syncinv] HandleInputData remote swap event REPLACED with TAKE (cmd=HAND_EVENT, event=" + e.DumpToString() +
"), src item is null! Continuing.");
1041 #ifdef ENABLE_LOGGING
1044 Debug.InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1048 Error(
"[syncinv] HandleInputData remote input (cmd=HAND_EVENT, event=" + e.DumpToString() +
") dropped, item not in bubble");
1063 if (success && !validation.m_IsRemote && !validation.m_IsJuncture && !e.CheckRequestSrc())
1065 #ifdef ENABLE_LOGGING
1068 Debug.InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1072 if (!validation.m_IsRemote)
1091 if (success && !e.CheckRequestEx(validation))
1093 #ifdef ENABLE_LOGGING
1096 Debug.InventoryMoveLog(
"Failed - CheckRequest",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1105#ifdef ENABLE_LOGGING
1127 if (success && !validation.m_IsRemote && !e.CanPerformEventEx(validation))
1129 #ifdef ENABLE_LOGGING
1132 Debug.InventoryMoveLog(
"Failed - CanPerformEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1141#ifdef ENABLE_LOGGING
1144 syncDebugPrint(
"[desync] HandleInputData man=" +
Object.GetDebugName(GetManOwner()) +
" CANNOT do cmd=HAND_EVENT e=" + e.DumpToString());
1170 #ifdef ENABLE_LOGGING
1173 Debug.InventoryMoveLog(
"Juncture not required",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1181 #ifdef ENABLE_LOGGING
1184 Debug.InventoryMoveLog(
"Juncture sended",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1201 #ifdef ENABLE_LOGGING
1204 Debug.InventoryMoveLog(
"Juncture denied",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1219 #ifdef ENABLE_LOGGING
1222 Debug.InventoryMoveLog(
"Success - ProcessHandEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1229 if (!e.m_Player.GetHumanInventory().ProcessHandEvent(e))
1249 bool skippedSwap =
false;
1250 bool success =
true;
1252 src1.ReadFromContext(ctx);
1253 src2.ReadFromContext(ctx);
1254 dst1.ReadFromContext(ctx);
1255 dst2.ReadFromContext(ctx);
1256 ctx.Read(skippedSwap);
1258 #ifdef ENABLE_LOGGING
1265 if (validation.m_IsRemote && (!src1.GetItem() || !src2.GetItem()))
1269 #ifdef ENABLE_LOGGING
1286 #ifdef ENABLE_LOGGING
1293 Error(
"[syncinv] HandleInputData remote input (cmd=SWAP) dropped, item not in bubble");
1307#ifdef ENABLE_LOGGING
1337#ifdef ENABLE_LOGGING
1367#ifdef ENABLE_LOGGING
1397 ClearInventoryReservationEx(dst1.GetItem(), dst1);
1398 ClearInventoryReservationEx(dst2.GetItem(), dst2);
1406 #ifdef ENABLE_LOGGING
1409 DumpInventoryDebug();
1435 if (!(src1.IsValid() && src2.IsValid() && dst1.IsValid() && dst2.IsValid()))
1447 #ifdef ENABLE_LOGGING
1458 #ifdef ENABLE_LOGGING
1472 #ifdef ENABLE_LOGGING
1487 ClearInventoryReservationEx(dst1.GetItem(), dst1);
1488 ClearInventoryReservationEx(dst2.GetItem(), dst2);
1499 #ifdef ENABLE_LOGGING
1502 Debug.InventoryMoveLog(
"Failed - !SwapCheckExclusionMaskLocal - condition failed locally",
"SYNC_MOVE" ,
"n/a",
"ProcessInputData",
GetDayZPlayerOwner().
ToString() );
1508 #ifdef ENABLE_LOGGING
1516 bool isNotSkipped = LocationSwap(src1, src2, dst1, dst2);
1532 if (isJuncture && isRemote)
1539 if (!ctx.Read(type))
1545 validation.m_IsJuncture = isJuncture;
1546 validation.m_IsRemote = isRemote;
1554 if (!ValidateUserReservationCancel(serializer, validation))
1583 switch (validation.m_Result)
1586 if (canSendJuncture)
1589 if (!serializer.CanWrite())
1592 writeableSerializer.CopyFrom(serializer);
1593 serializer = writeableSerializer;
1596 serializer.Write(validation.m_Reason);
1602 if (canSendJuncture)
1609 Error(
"InventoryValidationResult.JUNCTURE returned when not possible to send!");
1624 itemIB.SetCanBeMovedOverride(
false);
1631 itemIB.SetCanBeMovedOverride(
true);
1637 Rope rope = Rope.Cast(src.GetItem());
1639 rope.SetTargetLocation(dst);
1651 #ifdef ENABLE_LOGGING
1667 if (GetManOwner().IsAlive() ==
false)
1668 return super.TakeToDst(mode, src, dst);
1670 #ifdef ENABLE_LOGGING
1680 if (RedirectToHandEvent(mode, src, dst))
1682 #ifdef ENABLE_LOGGING
1693 if (
GetDayZPlayerOwner().NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
1697#ifdef ENABLE_LOGGING
1706#ifdef ENABLE_LOGGING
1728#ifdef ENABLE_LOGGING
1737 #ifdef ENABLE_LOGGING
1746 LocationSyncMoveEntity(src, dst);
1749 if (!super.TakeToDst(mode,src,dst))
1758 if (!super.PostDeferredEventTakeToDst(mode,src,dst))
1775 if( deferred_take_to_dst )
1777 #ifdef ENABLE_LOGGING
1784 deferred_take_to_dst.ClearInventoryReservation(
this);
1791 switch (deferred_take_to_dst.m_mode)
1794 #ifdef ENABLE_LOGGING
1801 if (LocationCanMoveEntity(deferred_take_to_dst.m_src,deferred_take_to_dst.m_dst))
1804 LocationSyncMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst);
1808 #ifdef ENABLE_LOGGING
1817 #ifdef ENABLE_LOGGING
1824 if (LocationCanMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst))
1833 #ifdef ENABLE_LOGGING
1842 #ifdef ENABLE_LOGGING
1850 #ifdef ENABLE_LOGGING
1858 Error(
"HandEvent - Invalid mode");
1866 #ifdef ENABLE_LOGGING
1878 LocationSwap(src1, src2, dst1, dst2);
1883 if(!super.SwapEntities(mode,item1,item2))
1895 if (!super.PostDeferredForceSwapEntities(mode, item1, item2, dst1, dst2))
1912 if( deferred_swap_entities )
1914 deferred_swap_entities.ClearInventoryReservation(
this);
1923 switch (deferred_swap_entities.m_mode)
1926 if (CanSwapEntitiesEx(deferred_swap_entities.m_dst1.GetItem(),deferred_swap_entities.m_dst2.GetItem()) )
1928 InventoryInputUserData.SendInputUserDataSwap(src1, src2, deferred_swap_entities.m_dst1, deferred_swap_entities.m_dst2);
1929 LocationSwap(src1, src2, deferred_swap_entities.m_dst1, deferred_swap_entities.m_dst2);
1933 #ifdef ENABLE_LOGGING
1936 Debug.InventoryMoveLog(
"Can not swap (PREDICTIVE) STS = " +
GetDayZPlayerOwner().GetSimulationTimeStamp() +
" item1 = " + deferred_swap_entities.m_dst1.GetItem() +
" item2 = " + deferred_swap_entities.m_dst2.GetItem() +
" dst=" +
InventoryLocation.DumpToStringNullSafe(deferred_swap_entities.m_dst2),
"n/a" ,
"n/a",
"ForceSwapEntities",
GetDayZPlayerOwner().
ToString() );
1943 if (CanSwapEntitiesEx(deferred_swap_entities.m_dst1.GetItem(),deferred_swap_entities.m_dst2.GetItem()) )
1950 InventoryInputUserData.SendInputUserDataSwap(src1, src2, deferred_swap_entities.m_dst1, deferred_swap_entities.m_dst2);
1954 #ifdef ENABLE_LOGGING
1957 Debug.InventoryMoveLog(
"Can not swap (JUNCTURE) STS = " +
GetDayZPlayerOwner().GetSimulationTimeStamp() +
" item1 = " + deferred_swap_entities.m_dst1.GetItem() +
" item2 = " + deferred_swap_entities.m_dst2.GetItem() +
" dst=" +
InventoryLocation.DumpToStringNullSafe(deferred_swap_entities.m_dst2),
"n/a" ,
"n/a",
"ForceSwapEntities",
GetDayZPlayerOwner().
ToString() );
1967 Error(
"SwapEntities - HandEvent - Invalid mode");
1971 Error(
"SwapEntities - MakeSrcAndDstForSwap - no inv loc");
1977 #ifdef ENABLE_LOGGING
1989 LocationSwap(src1, src2, dst1, item2_dst);
1995 if(!super.ForceSwapEntities(mode,item1,item2,item2_dst))
2009 if (deferred_force_swap_entities)
2011 deferred_force_swap_entities.ClearInventoryReservation(
this);
2014 deferred_force_swap_entities.m_item1.GetInventory().GetCurrentInventoryLocation(src1);
2015 deferred_force_swap_entities.m_item2.GetInventory().GetCurrentInventoryLocation(src2);
2024 switch (deferred_force_swap_entities.m_mode)
2027 if (CanForceSwapEntitiesEx(deferred_force_swap_entities.m_dst1.GetItem(),deferred_force_swap_entities.m_dst1,deferred_force_swap_entities.m_dst2.GetItem(), deferred_force_swap_entities.m_dst2))
2029 InventoryInputUserData.SendInputUserDataSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2030 LocationSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2034 #ifdef ENABLE_LOGGING
2037 Debug.InventoryMoveLog(
"Can not force swap (PREDICTIVE) STS = " +
GetDayZPlayerOwner().GetSimulationTimeStamp() +
" item1 = " + deferred_force_swap_entities.m_dst1.GetItem() +
" item2 = " + deferred_force_swap_entities.m_dst2.GetItem() +
" dst=" +
InventoryLocation.DumpToStringNullSafe(deferred_force_swap_entities.m_dst2),
"n/a" ,
"n/a",
"ForceSwapEntities",
GetDayZPlayerOwner().
ToString());
2044 if (CanForceSwapEntitiesEx(deferred_force_swap_entities.m_dst1.GetItem(), deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2.GetItem(), deferred_force_swap_entities.m_dst2))
2049 InventoryInputUserData.SendInputUserDataSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2053 #ifdef ENABLE_LOGGING
2056 Debug.InventoryMoveLog(
"Can not force swap (JUNCTURE) STS = " +
GetDayZPlayerOwner().GetSimulationTimeStamp() +
" item1 = " + deferred_force_swap_entities.m_dst1.GetItem() +
" item2 = " + deferred_force_swap_entities.m_dst2.GetItem() +
" dst=" +
InventoryLocation.DumpToStringNullSafe(deferred_force_swap_entities.m_dst2),
"n/a" ,
"n/a",
"ForceSwapEntities",
GetDayZPlayerOwner().
ToString());
2066 Error(
"ForceSwapEntities - HandEvent - Invalid mode");
2075 if (e.IsServerSideOnly())
2077 Error(
"[syncinv] " +
Object.GetDebugName(player) +
" SendServerHandEventViaJuncture - called on server side event only, e=" + e.DumpToString());
2080 if (player.IsAlive())
2084 if (src.IsValid() && dst.IsValid())
2086 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
2088#ifdef ENABLE_LOGGING
2097#ifdef ENABLE_LOGGING
2106#ifdef ENABLE_LOGGING
2115#ifdef ENABLE_LOGGING
2126#ifdef ENABLE_LOGGING
2139 Error(
"[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
2149 super.NetSyncCurrentStateID(
id);
2170 if (GetEntityInHands())
2180 pb.GetWeaponManager().SetRunning(
true);
2184 fsmDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(wpn) +
" recv event from remote: created event=" + e);
2187 if (e.GetEventID() ==
WeaponEventID.HUMANCOMMAND_ACTION_ABORTED)
2189 wpn.ProcessWeaponAbortEvent(e);
2193 wpn.ProcessWeaponEvent(e);
2195 pb.GetWeaponManager().SetRunning(
false);
2199 Error(
"OnEventForRemoteWeapon - entity in hands, but not weapon. item=" + GetEntityInHands());
2202 Error(
"OnEventForRemoteWeapon - no entity in hands");
2217 hndDebugSpam(
"[hndfsm] recv event from remote: created event=" + e);
2222 if (e.GetEventID() ==
HandEventID.HUMANCOMMAND_ACTION_ABORTED)
2225 m_FSM.ProcessAbortEvent(e, aa);
2229 m_FSM.ProcessEvent(e);
2245 e.WriteToContext(ctx);
2249 hndDebugPrint(
"[hndfsm] send 2 remote: sending e=" + e +
" id=" + e.GetEventID() +
" p=" + p +
" e=" + e.DumpToString());
2252 p.StoreInputForRemotes(ctx);
2258 super.OnHandsExitedStableState(src, dst);
2262 hndDebugPrint(
"[hndfsm] hand fsm exit stable src=" + src.Type().ToString());
2268 super.OnHandsEnteredStableState(src, dst);
2272 hndDebugPrint(
"[hndfsm] hand fsm entered stable dst=" + dst.Type().ToString());
2278 super.OnHandsStateChanged(src, dst);
2282 hndDebugPrint(
"[hndfsm] hand fsm changed state src=" + src.Type().ToString() +
" ---> dst=" + dst.Type().ToString());
2291#ifdef DIAG_DEVELOPER
2304 EntityAI itemInHands = GetEntityInHands();
2307 il.SetHands(GetInventoryOwner(), itemInHands);
2310 if (e.CanPerformEventEx(validation))
2332 serializer.Write(validation.m_Reason);
2348 if (deferred_hand_event)
2350 #ifdef ENABLE_LOGGING
2359 hndDebugPrint(
"[inv] HumanInventory::HandEvent(" +
typename.EnumToString(
InventoryMode, deferred_hand_event.m_mode) +
") ev=" + deferred_hand_event.m_event.DumpToString());
2362 switch (deferred_hand_event.m_mode)
2365 #ifdef ENABLE_LOGGING
2372 deferred_hand_event.ClearInventoryReservation(
this);
2373 if (deferred_hand_event.m_event.CanPerformEventEx(validation))
2376 ProcessHandEvent(deferred_hand_event.m_event);
2381 #ifdef ENABLE_LOGGING
2388 deferred_hand_event.ClearInventoryReservation(
this);
2389 if (deferred_hand_event.m_event.CanPerformEventEx(validation))
2391 deferred_hand_event.ReserveInventory(
this);
2395 EntityAI itemSrc = deferred_hand_event.m_event.GetSrcEntity();
2397 if (deferred_hand_event.m_event.GetDst())
2398 itemDst = deferred_hand_event.m_event.GetDst().GetItem();
2407 #ifdef ENABLE_LOGGING
2414 deferred_hand_event.ClearInventoryReservation(
this);
2415 ProcessHandEvent(deferred_hand_event.m_event);
2420 #ifdef ENABLE_LOGGING
2432 if (!deferred_hand_event.m_event.IsServerSideOnly())
2445 ProcessHandEvent(deferred_hand_event.m_event);
2450 Error(
"HumanInventory::HandEvent - Invalid mode");
2457 super.HandleInventoryManipulation();
2488 if (player.IsAlive())
2490 if (!player.IsRestrained() && !player.IsUnconscious())
2519 if (player.IsAlive())
2521 if (!player.IsRestrained() && !player.IsUnconscious())
2532 result = CheckMoveToDstRequest( GetManOwner(), src, dst, radius);
2546 player =
PlayerBase.Cast(ent.GetHierarchyRootPlayer());
2551 if (player.IsAlive())
2553 if (!player.IsRestrained() && !player.IsUnconscious())
2562 ent = dst2.GetParent();
2565 player =
PlayerBase.Cast(ent.GetHierarchyRootPlayer());
2570 if (player.IsAlive())
2572 if (!player.IsRestrained() && !player.IsUnconscious())
2603 if (player.IsAlive())
2605 if (!player.IsRestrained() && !player.IsUnconscious())
2616 result = CheckDropRequest( GetManOwner(), src, radius);
2627 return dst.GetParent().CheckAttachmentReceiveExclusion(src.GetItem(),dst.GetSlot());
2636 bool failed =
false;
2640 failed |= !dst1.GetParent().CheckAttachmentReceiveExclusion(dst1.GetItem(),dst1.GetSlot());
2645 failed |= !dst2.GetParent().CheckAttachmentReceiveExclusion(dst2.GetItem(),dst2.GetSlot());
2655 if (validation.m_IsJuncture)
2668 src.ReadFromContext(ctx);
2670 #ifdef ENABLE_LOGGING
2677 if (validation.m_IsRemote && !src.GetItem())
2679 #ifdef ENABLE_LOGGING
2686 Error(
"[syncinv] HandleInputData remote input (cmd=DESTROY) dropped, item not in bubble");
2695 #ifdef ENABLE_LOGGING
2710 #ifdef ENABLE_LOGGING
2720 #ifdef ENABLE_LOGGING
2727 GetGame().ObjectDelete(src.GetItem());
void syncDebugPrint(string s)
void inventoryDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
InventoryValidationResult
InventoryValidationReason
void wpnDebugSpamALot(string s)
void wpnDebugPrint(string s)
Super root of all classes in Enforce script.
override void OnItemInHandsChanged()
script counterpart to engine's class Inventory
const int c_InventoryReservationTimeoutShortMS
static bool MakeSrcAndDstForSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, out InventoryLocation dst2)
helper function for swap
static bool MakeSrcAndDstForForceSwap(notnull EntityAI item1, notnull EntityAI item2, out InventoryLocation src1, out InventoryLocation src2, out InventoryLocation dst1, notnull InventoryLocation dst2)
helper function for ForceSwap
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
const int c_InventoryReservationTimeoutMS
reservations
static bool LocationCanMoveEntitySyncCheck(notnull InventoryLocation src, notnull InventoryLocation dst)
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
Abstracted event, not to be used, only inherited.
represent hand state base
inventory for plain man/human
HumanInventory... with FSM (synchronous, no anims)
Serialization general interface. Serializer API works with:
signalize mechanism manipulation
proto native void StoreInputForRemotes(ParamsWriteContext ctx)
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerInstanceType GetInstanceType()
bool PlayerCheckDropRequest(notnull InventoryLocation src, float radius)
bool ValidateSyncMove(inout Serializer ctx, InventoryValidation validation)
bool ValidateHandEvent(inout Serializer ctx, InventoryValidation validation)
void EnableMovableOverride(EntityAI item)
void OnHandleStoredInputUserData(ParamsReadContext ctx)
bool SwapCheckExclusionMaskLocal(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
Local, checks only stuff that is in guaranteed sync.
bool ProcessInputData(ParamsReadContext ctx, bool isJuncture, bool isRemote)
ref HandAnimatedForceSwapping m_FSwapping
void HandleHandEvent(DeferredEvent deferred_event)
void HandleWeaponEvents(float dt, out bool exitIronSights)
proto native void StoreInputUserData(ParamsReadContext ctx)
void OnHandleStoredJunctureData(ParamsReadContext ctx)
void SyncHandEventToRemote(HandEventBase e)
void HandleTakeToDst(DeferredEvent deferred_event)
void DeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
ref HandAnimatedForceSwapping_Inst m_FSwappingInst
ref HandAnimatedSwapping m_Swapping
bool ValidateDestroy(inout Serializer ctx, InventoryValidation validation)
DEPRECATED.
bool MoveCheckExclusionMaskLocal(notnull InventoryLocation src, notnull InventoryLocation dst)
Local, checks only stuff that is in guaranteed sync.
void CheckForRope(InventoryLocation src, InventoryLocation dst)
bool PlayerCheckRequestSrc(notnull InventoryLocation src, float radius)
override void OnInventoryFailure(InventoryCommandType type, InventoryValidationReason reason, InventoryLocation src, InventoryLocation dst)
void PostWeaponEvent(WeaponEventBase e)
override void NetSyncCurrentStateID(int id)
override void OnHandsEnteredStableState(HandStateBase src, HandStateBase dst)
bool IsServerOrLocalPlayer()
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
override void OnInventoryJunctureFailureFromServer(ParamsReadContext ctx)
void RemoveMovableOverride(EntityAI item)
ref HandEventBase m_event
ref HandEventBase m_DeferredPostedHandEvent
override void HandleInventoryManipulation()
override bool OnInventoryJunctureFromServer(ParamsReadContext ctx)
void DayZPlayerInventory()
ref HandAnimatedTakingFromAtt m_Taking
deferred weapon event
override bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
ref HandAnimatedMovingToAtt m_MovingTo
override bool OnInventoryJunctureRepairFromServer(ParamsReadContext ctx)
void DeferredTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
override void OnHandsExitedStableState(HandStateBase src, HandStateBase dst)
override void OnHandsStateChanged(HandStateBase src, HandStateBase dst)
override bool PostDeferredForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
bool OnHandEventForRemote(ParamsReadContext ctx)
ref InventoryLocation m_dst1
ref WeaponEventBase m_DeferredWeaponEvent
deferred hand event
void OnInputUserDataForRemote(ParamsReadContext ctx)
DayZPlayer GetDayZPlayerOwner()
void DeferredHandEvent(InventoryMode mode, HandEventBase e)
override bool ForceSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation item2_dst)
bool ValidateSwap(inout Serializer ctx, InventoryValidation validation)
void HandleSwapEntities(DeferredEvent deferred_event)
bool PlayerCheckSwapItemsRequest(notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2, float radius)
void HandleInventory(float dt)
void DeferredWeaponFailed()
ref InventoryLocation m_dst
void HandleForceSwapEntities(DeferredEvent deferred_event)
ref Timer m_DeferredWeaponTimer
override bool PostDeferredEventTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
bool PlayerCheckRequestDst(notnull InventoryLocation src, notnull InventoryLocation dst, float radius)
bool OnEventForRemoteWeapon(ParamsReadContext ctx)
override void OnServerInventoryCommand(ParamsReadContext ctx)
void CancelHandEvent()
cancels any handevents that will be executed this frame @NOTE: this is used in situations where the p...
proto native void StoreJunctureData(ParamsReadContext ctx)
ref InventoryLocation m_dst2
DeferredSwapEntities m_item1
override bool HandEvent(InventoryMode mode, HandEventBase e)
class DeferredEvent m_src
bool OnInputUserDataProcess(int userDataType, ParamsReadContext ctx)
WeaponEventBase WeaponAnimEventFactory(WeaponEvents type, DayZPlayer p=NULL, Magazine m=NULL)
creates animation system events
WeaponEventBase CreateWeaponEventFromContext(ParamsReadContext ctx)
WeaponEventID
identifier for events. mainly for rpc purposes
bool IsProcessing()
returns true when FP is heating or cooling
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
HandEventBase HandAnimEventFactory(WeaponEvents type, Man p=null, InventoryLocation src=null)
void ClearInventoryReservation()
void hndDebugSpam(string s)
void hndDebugSpamALot(string s)
void hndDebugPrint(string s)
FSMTransition< HandStateBase, HandEventBase, HandActionBase, HandGuardBase > HandTransition
void fsmDebugSpam(string s)
InventoryLocationType
types of Inventory Location
bool TryAcquireInventoryJunctureFromServer(notnull Man player, notnull InventoryLocation src, notnull InventoryLocation dst)
bool TryAcquireTwoInventoryJuncturesFromServer(notnull Man player, notnull InventoryLocation src1, notnull InventoryLocation src2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
override void OnAfterStoreLoad()
engine reaction to load from database originates in: engine - Person::BinLoad script - PlayerBase....