135 return m_event.ReserveInventory();
140 m_event.ClearInventoryReservation();
209 CreateStableStates();
211 m_Taking =
new HandAnimatedTakingFromAtt(GetManOwner(), null);
212 m_MovingTo =
new HandAnimatedMovingToAtt(GetManOwner(), null);
213 m_Swapping =
new HandAnimatedSwapping(GetManOwner(), null);
214 m_FSwapping =
new HandAnimatedForceSwapping(GetManOwner(), null);
215 m_FSwappingInst =
new HandAnimatedForceSwapping_Inst(GetManOwner(), null);
218 HandEventBase _fin_ =
new HandEventHumanCommandActionFinished;
219 HandEventBase _abt_ =
new HandEventHumanCommandActionAborted;
228 m_FSM.AddTransition(
new HandTransition( m_Empty , __T__,
m_Taking, NULL,
new HandSelectAnimationOfTakeToHandsEvent(GetManOwner())));
229 m_FSM.AddTransition(
new HandTransition(
m_Taking , _fin_, m_Empty, null,
new HandGuardNot(
new HandGuardHasItemInHands(GetManOwner()))));
231 m_FSM.AddTransition(
new HandTransition(
m_Taking , __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
235 m_FSM.AddTransition(
new HandTransition( m_Equipped, __M__,
m_MovingTo, NULL,
new HandSelectAnimationOfMoveFromHandsEvent(GetManOwner())));
236 m_FSM.AddTransition(
new HandTransition(
m_MovingTo, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
237 m_FSM.AddTransition(
new HandTransition(
m_MovingTo, _fin_, m_Equipped, null,
new HandGuardHasItemInHands(GetManOwner())));
242 m_FSM.AddTransition(
new HandTransition( m_Equipped, __W__,
m_Swapping, NULL,
new HandSelectAnimationOfSwapInHandsEvent(GetManOwner())));
243 m_FSM.AddTransition(
new HandTransition(
m_Swapping, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
244 m_FSM.AddTransition(
new HandTransition(
m_Swapping, _fin_, m_Empty, null,
new HandGuardNot(
new HandGuardHasItemInHands(GetManOwner()))));
251 m_FSM.AddTransition(
new HandTransition(
m_FSwappingInst, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
255 m_FSM.AddTransition(
new HandTransition(
m_FSwapping, _fin_, m_Equipped, null,
new HandGuardHasItemInHands(GetManOwner())));
257 m_FSM.AddTransition(
new HandTransition(
m_FSwapping, __Xd_, m_Empty,
new HandActionDestroyed,
new HandGuardHasDestroyedItemInHands(GetManOwner())));
288 if (hcw && weapon && weapon.CanProcessWeaponEvents() && !weapon.IsIdle())
292 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
295 weapon.ProcessWeaponAbortEvent(
new WeaponEventHumanCommandActionAborted(
GetDayZPlayerOwner()));
325 string secondPart =
" - ENTITY IN HANDS IS NOT A WEAPON: " +
Object.GetDebugName(GetEntityInHands());
327 string firstPart =
"[wpnfsm] " +
Object.GetDebugName(GetInventoryOwner()) +
" failed to perform weaponevent " +
m_DeferredWeaponEvent.DumpToString();
330 secondPart =
" on " +
Object.GetDebugName(GetEntityInHands()) +
" which is in state " + weapon.GetCurrentState();
331 secondPart +=
" with physical state: J: " + weapon.IsJammed() +
" | ";
332 for (
int i = 0; i < weapon.GetMuzzleCount(); ++i)
334 secondPart +=
"Chamber_" + i +
": B(" + weapon.IsChamberFull(i) +
") F(" + weapon.IsChamberFiredOut(i) +
") E(" + weapon.IsChamberEmpty(i) +
") | ";
335 secondPart +=
"Magazine_" + i +
": " + weapon.GetMagazine(i);
336 if (i < weapon.GetMuzzleCount() - 1)
341 Error(firstPart + secondPart);
354 weapon.UpdateCoolDown(dt);
355 if (hcw && weapon.CanProcessWeaponEvents())
358 weapon.GetCurrentState().OnUpdate(dt);
365 if (!weapon.IsIdle())
369 int weaponEventId = hcw.
IsEvent();
370 if (weaponEventId == -1)
384 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" HandleWeapons: event arrived " +
typename.EnumToString(
WeaponEvents, weaponEventId) +
"(" + weaponEventId +
") fsm_ev=" + anim_event.ToString());
387 if (anim_event != NULL)
389 weapon.ProcessWeaponEvent(anim_event);
395 if (weapon.IsWaitingForActionFinish())
399 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: finished! notifying waiting state=" + weapon.GetCurrentState());
402 weapon.ProcessWeaponEvent(
new WeaponEventHumanCommandActionFinished(
GetDayZPlayerOwner()));
408 wpnDebugPrint(
"[wpnfsm] " +
Object.GetDebugName(weapon) +
" Weapon event: ABORT! notifying running state=" + weapon.GetCurrentState());
411 weapon.ProcessWeaponAbortEvent(
new WeaponEventHumanCommandActionAborted(
GetDayZPlayerOwner()));
425 exitIronSights =
true;
457 #ifdef ENABLE_LOGGING
464 if ( !fsmState.
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);
494 #ifdef ENABLE_LOGGING
497 hndDebugPrint(
"[hndfsm] Hand-Weapon event: finished! notifying waiting state=" + fsmState);
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=" + fsmState);
514 HandEventBase abt_event =
new HandEventHumanCommandActionAborted(GetManOwner());
516 ProcessHandAbortEvent(abt_event);
571 if (
g_Game.IsDedicatedServer())
576 int udtIdentifier = -1;
598 ClearInventoryReservationEx(dst.
GetItem(), dst);
616 ClearInventoryReservationEx(dst.
GetItem(), dst);
617 ClearInventoryReservationEx(temp.
GetItem(), temp);
632 if (!ctx.
Read(reason))
758 #ifdef ENABLE_LOGGING
768 if (validation.
m_IsRemote && (!itemSrc || !itemDst))
789 #ifdef ENABLE_LOGGING
797 syncDebugPrint(
"[syncinv] HandleInputData Failed - src and dst are for different items src item =" + itemSrc +
" dst item =" + itemDst);
837 #ifdef DIAG_DEVELOPER
838 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
843 src.
GetItem().GetInventory().GetCurrentInventoryLocation(realIl);
847 itemsToRepair.Insert(src.
GetItem());
850 #ifdef DIAG_DEVELOPER
905 #ifdef ENABLE_LOGGING
915 LocationSyncMoveEntity(src, dst);
923 #ifdef ENABLE_LOGGING
932 #ifdef ENABLE_LOGGING
935 DumpInventoryDebug();
953 #ifdef ENABLE_LOGGING
968 bool hasJuncture =
false;
969 if (itemSrc != null && itemDst != null)
973 else if (itemSrc != null)
977 else if (itemDst != null)
990 ClearInventoryReservationEx(itemDst, dst);
1004 #ifdef ENABLE_LOGGING
1007 DumpInventoryDebug();
1023 #ifdef ENABLE_LOGGING
1032 #ifdef ENABLE_LOGGING
1041 LocationSyncMoveEntity(src, dst);
1051 bool success =
true;
1062 EntityAI itemSrc = e.GetSrcEntity();
1065 #ifdef ENABLE_LOGGING
1068 Debug.
InventoryMoveLog(
"STS = " + e.m_Player.GetSimulationTimeStamp() +
" event= " + e.
DumpToString(),
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1072 if (validation.
m_IsRemote && !e.GetSrcEntity())
1078 srcNew.
Copy(e.GetSrc());
1081 Error(
"[syncinv] HandleInputData remote swap event REPLACED with TAKE (cmd=HAND_EVENT, event=" + e.
DumpToString() +
"), src item is null! Continuing.");
1085 #ifdef ENABLE_LOGGING
1088 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1092 Error(
"[syncinv] HandleInputData remote input (cmd=HAND_EVENT, event=" + e.
DumpToString() +
") dropped, item not in bubble");
1109 #ifdef ENABLE_LOGGING
1112 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1128 #ifdef DIAG_DEVELOPER
1129 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1134 itemSrc.GetInventory().GetCurrentInventoryLocation(repairIl);
1136 if(e.GetSrc() != repairIl)
1138 itemsToRepair.Insert(itemSrc);
1141 if(itemDst && itemSrc != itemDst )
1143 itemDst.GetInventory().GetCurrentInventoryLocation(repairIl);
1146 itemsToRepair.Insert(itemDst);
1150 if (itemsToRepair.Count())
1154 #ifdef DIAG_DEVELOPER
1164 if (success && !e.CheckRequestEx(validation))
1166 #ifdef ENABLE_LOGGING
1169 Debug.
InventoryMoveLog(
"Failed - CheckRequest",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1178#ifdef ENABLE_LOGGING
1202 #ifdef ENABLE_LOGGING
1205 Debug.
InventoryMoveLog(
"Failed - CanPerformEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1214#ifdef ENABLE_LOGGING
1251 #ifdef ENABLE_LOGGING
1254 Debug.
InventoryMoveLog(
"Juncture not required",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1262 #ifdef ENABLE_LOGGING
1265 Debug.
InventoryMoveLog(
"Juncture sended",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1282 #ifdef ENABLE_LOGGING
1285 Debug.
InventoryMoveLog(
"Juncture denied",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1297 bool hasJuncture =
false;
1299 if (itemSrc != null && itemDst != null)
1303 else if (itemSrc != null)
1307 else if (itemDst != null)
1324 #ifdef ENABLE_LOGGING
1327 Debug.
InventoryMoveLog(
"Success - ProcessHandEvent",
"HAND_EVENT" ,
"n/a",
"ProcessInputData", e.m_Player.ToString() );
1334 if (!e.m_Player.GetHumanInventory().ProcessHandEvent(e))
1348 if (!swapValidation)
1354 #ifdef ENABLE_LOGGING
1366 LocationSyncMoveEntity(swapValidation.
m_Src1, swapValidation.
m_Dst1);
1373 LocationSyncMoveEntity(swapValidation.
m_Src2, swapValidation.
m_Dst2);
1381 #ifdef ENABLE_LOGGING
1384 Debug.
InventoryMoveLog(
"Remote - skipped",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1391 #ifdef ENABLE_LOGGING
1394 Debug.
InventoryMoveLog(
"Failed - item1 or item2 not exist",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1398 Error(
"[syncinv] HandleInputData remote input (cmd=SWAP) dropped, item not in bubble");
1410 #ifdef ENABLE_LOGGING
1422 syncDebugPrint(
"[syncinv] HandleInputData Failed - first src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
1424 syncDebugPrint(
"[syncinv] HandleInputData Failed - second src and dst are for different items src item =" + swapValidation.
m_SrcItem1 +
" dst item =" + swapValidation.
m_DstItem1);
1443 #ifdef ENABLE_LOGGING
1446 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc1",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1461 #ifdef DIAG_DEVELOPER
1462 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1468 swapValidation.
m_SrcItem1.GetInventory().GetCurrentInventoryLocation(repairIl);
1470 if(swapValidation.
m_Src1 != repairIl)
1472 itemsToRepair.Insert(swapValidation.
m_SrcItem1);
1475 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
1476 if(swapValidation.
m_Src2 != repairIl)
1478 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
1481 if (itemsToRepair.Count())
1485 #ifdef DIAG_DEVELOPER
1500 #ifdef ENABLE_LOGGING
1503 Debug.
InventoryMoveLog(
"Failed - CheckRequestSrc2",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1518 #ifdef DIAG_DEVELOPER
1519 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
1525 swapValidation.
m_SrcItem2.GetInventory().GetCurrentInventoryLocation(repairIl);
1526 if(swapValidation.
m_Src2 != repairIl)
1528 itemsToRepair.Insert(swapValidation.
m_SrcItem2);
1531 if (itemsToRepair.Count())
1535 #ifdef DIAG_DEVELOPER
1550 #ifdef ENABLE_LOGGING
1553 Debug.
InventoryMoveLog(
"Failed - CheckSwapItemsRequest",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
1580 ClearInventoryReservationEx(swapValidation.
m_DstItem1, swapValidation.
m_Dst1);
1581 ClearInventoryReservationEx(swapValidation.
m_DstItem2, swapValidation.
m_Dst2);
1589 #ifdef ENABLE_LOGGING
1591 DumpInventoryDebug();
1596 Debug.
InventoryMoveLog(
"Failed - CanForceSwapEntitiesEx",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString());
1602 if (swapValidation.
m_Dst1)
1605 if (swapValidation.
m_Dst2)
1636 #ifdef ENABLE_LOGGING
1647 #ifdef ENABLE_LOGGING
1661 #ifdef ENABLE_LOGGING
1676 bool hasJuncture =
false;
1677 int nonNullCount = 0;
1678 bool failed =
false;
1687 if (!failed && swapValidation.
m_SrcItem2 != null)
1694 if (!failed && swapValidation.
m_DstItem1 != null)
1701 if (!failed && swapValidation.
m_DstItem2 != null)
1708 hasJuncture = (nonNullCount > 0 && !failed);
1719 ClearInventoryReservationEx(swapValidation.
m_DstItem1, swapValidation.
m_Dst1);
1720 ClearInventoryReservationEx(swapValidation.
m_DstItem2, swapValidation.
m_Dst2);
1731 #ifdef ENABLE_LOGGING
1734 Debug.
InventoryMoveLog(
"Failed - !SwapCheckExclusionMaskLocal - condition failed locally",
"SYNC_MOVE" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1740 #ifdef ENABLE_LOGGING
1743 Debug.
InventoryMoveLog(
"Success - item swap",
"SWAP" ,
"n/a",
"ProcessInputData", playerOwner.ToString() );
1749 bool isNotSkipped = LocationSwap(swapValidation.
m_Src1, swapValidation.
m_Src2, swapValidation.
m_Dst1, swapValidation.
m_Dst2);
1764 if (isJuncture && isRemote)
1771 if (!ctx.
Read(type))
1787 if (!ValidateUserReservationCancel(serializer, validation))
1819 if (canSendJuncture)
1825 writeableSerializer.
CopyFrom(serializer);
1826 serializer = writeableSerializer;
1835 if (canSendJuncture)
1842 Error(
"InventoryValidationResult.JUNCTURE returned when not possible to send!");
1857 itemIB.SetCanBeMovedOverride(
false);
1864 itemIB.SetCanBeMovedOverride(
true);
1870 Rope rope = Rope.Cast(src.
GetItem());
1872 rope.SetTargetLocation(dst);
1884 #ifdef ENABLE_LOGGING
1900 if (GetManOwner().IsAlive() ==
false)
1901 return super.TakeToDst(mode, src, dst);
1903 #ifdef ENABLE_LOGGING
1913 if (RedirectToHandEvent(mode, src, dst))
1915 #ifdef ENABLE_LOGGING
1926 if (
GetDayZPlayerOwner().NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
1930#ifdef ENABLE_LOGGING
1939#ifdef ENABLE_LOGGING
1961#ifdef ENABLE_LOGGING
1970 #ifdef ENABLE_LOGGING
1979 LocationSyncMoveEntity(src, dst);
1982 if (!super.TakeToDst(mode,src,dst))
1991 if (!super.PostDeferredEventTakeToDst(mode,src,dst))
2008 if( deferred_take_to_dst )
2010 #ifdef ENABLE_LOGGING
2017 deferred_take_to_dst.ClearInventoryReservation(
this);
2024 switch (deferred_take_to_dst.m_mode)
2027 #ifdef ENABLE_LOGGING
2034 if (LocationCanMoveEntity(deferred_take_to_dst.m_src,deferred_take_to_dst.m_dst))
2036 #ifdef DIAG_DEVELOPER
2037 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2039 LocationSyncMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst);
2045 LocationSyncMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst);
2046 #ifdef DIAG_DEVELOPER
2052 #ifdef ENABLE_LOGGING
2061 #ifdef ENABLE_LOGGING
2068 if (LocationCanMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst))
2070 #ifdef DIAG_DEVELOPER
2071 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2073 LocationSyncMoveEntity(deferred_take_to_dst.m_src, deferred_take_to_dst.m_dst);
2082 #ifdef DIAG_DEVELOPER
2088 #ifdef ENABLE_LOGGING
2097 #ifdef ENABLE_LOGGING
2105 #ifdef ENABLE_LOGGING
2113 Error(
"HandEvent - Invalid mode");
2121 #ifdef ENABLE_LOGGING
2133 LocationSwap(src1, src2, dst1, dst2);
2138 if(!super.SwapEntities(mode,item1,item2))
2150 if (!super.PostDeferredForceSwapEntities(mode, item1, item2, dst1, dst2))
2167 if( deferred_swap_entities )
2178 switch (deferred_swap_entities.
m_mode)
2183 #ifdef DIAG_DEVELOPER
2184 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2186 LocationSwap(src1, src2, deferred_swap_entities.
m_dst1, deferred_swap_entities.
m_dst2);
2193 LocationSwap(src1, src2, deferred_swap_entities.
m_dst1, deferred_swap_entities.
m_dst2);
2195 #ifdef DIAG_DEVELOPER
2201 #ifdef ENABLE_LOGGING
2213 #ifdef DIAG_DEVELOPER
2214 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2216 LocationSwap(src1, src2, deferred_swap_entities.
m_dst1, deferred_swap_entities.
m_dst2);
2229 #ifdef DIAG_DEVELOPER
2235 #ifdef ENABLE_LOGGING
2248 Error(
"SwapEntities - HandEvent - Invalid mode");
2252 Error(
"SwapEntities - MakeSrcAndDstForSwap - no inv loc");
2258 #ifdef ENABLE_LOGGING
2270 LocationSwap(src1, src2, dst1, item2_dst);
2276 if(!super.ForceSwapEntities(mode,item1,item2,item2_dst))
2290 if (deferred_force_swap_entities)
2292 deferred_force_swap_entities.ClearInventoryReservation(
this);
2295 deferred_force_swap_entities.m_item1.GetInventory().GetCurrentInventoryLocation(src1);
2296 deferred_force_swap_entities.m_item2.GetInventory().GetCurrentInventoryLocation(src2);
2305 switch (deferred_force_swap_entities.m_mode)
2308 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))
2310 #ifdef DIAG_DEVELOPER
2311 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2313 LocationSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2319 LocationSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2320 #ifdef DIAG_DEVELOPER
2326 #ifdef ENABLE_LOGGING
2336 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))
2338 #ifdef DIAG_DEVELOPER
2339 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2341 LocationSwap(src1, src2, deferred_force_swap_entities.m_dst1, deferred_force_swap_entities.m_dst2);
2352 #ifdef DIAG_DEVELOPER
2358 #ifdef ENABLE_LOGGING
2371 Error(
"ForceSwapEntities - HandEvent - Invalid mode");
2382 Error(
"[syncinv] " +
Object.GetDebugName(player) +
" SendServerHandEventViaJuncture - called on server side event only, e=" + e.
DumpToString());
2385 if (player.IsAlive())
2393#ifdef ENABLE_LOGGING
2402#ifdef ENABLE_LOGGING
2411#ifdef ENABLE_LOGGING
2420#ifdef ENABLE_LOGGING
2431#ifdef ENABLE_LOGGING
2444 Error(
"[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
2454 super.NetSyncCurrentStateID(
id);
2475 if (GetEntityInHands())
2485 pb.GetWeaponManager().SetRunning(
true);
2489 fsmDebugSpam(
"[wpnfsm] " +
Object.GetDebugName(wpn) +
" recv event from remote: created event=" + e);
2494 wpn.ProcessWeaponAbortEvent(e);
2498 wpn.ProcessWeaponEvent(e);
2500 pb.GetWeaponManager().SetRunning(
false);
2504 Error(
"OnEventForRemoteWeapon - entity in hands, but not weapon. item=" + GetEntityInHands());
2507 Error(
"OnEventForRemoteWeapon - no entity in hands");
2522 hndDebugSpam(
"[hndfsm] recv event from remote: created event=" + e);
2527 if (e.GetEventID() ==
HandEventID.HUMANCOMMAND_ACTION_ABORTED)
2530 m_FSM.ProcessAbortEvent(e, aa);
2534 m_FSM.ProcessEvent(e);
2554 hndDebugPrint(
"[hndfsm] send 2 remote: sending e=" + e +
" id=" + e.GetEventID() +
" p=" + p +
" e=" + e.
DumpToString());
2557 p.StoreInputForRemotes(ctx);
2563 super.OnHandsExitedStableState(src, dst);
2567 hndDebugPrint(
"[hndfsm] hand fsm exit stable src=" + src.Type().ToString());
2573 super.OnHandsEnteredStableState(src, dst);
2577 hndDebugPrint(
"[hndfsm] hand fsm entered stable dst=" + dst.Type().ToString());
2583 super.OnHandsStateChanged(src, dst);
2587 hndDebugPrint(
"[hndfsm] hand fsm changed state src=" + src.Type().ToString() +
" ---> dst=" + dst.Type().ToString());
2596#ifdef DIAG_DEVELOPER
2609 EntityAI itemInHands = GetEntityInHands();
2612 il.
SetHands(GetInventoryOwner(), itemInHands);
2615 validation.
m_Mode = mode;
2650 if (!deferred_hand_event)
2662 if (deferred_hand_event)
2664 #ifdef ENABLE_LOGGING
2678 switch (deferred_hand_event.
m_mode)
2681 #ifdef ENABLE_LOGGING
2691 #ifdef DIAG_DEVELOPER
2692 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2694 ProcessHandEvent(deferred_hand_event.
m_event);
2700 ProcessHandEvent(deferred_hand_event.
m_event);
2701 #ifdef DIAG_DEVELOPER
2708 #ifdef ENABLE_LOGGING
2718 #ifdef DIAG_DEVELOPER
2719 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsLocalOnlyMoveEnable())
2721 ProcessHandEvent(deferred_hand_event.
m_event);
2738 #ifdef DIAG_DEVELOPER
2745 #ifdef ENABLE_LOGGING
2753 ProcessHandEvent(deferred_hand_event.
m_event);
2758 #ifdef ENABLE_LOGGING
2783 ProcessHandEvent(deferred_hand_event.
m_event);
2788 Error(
"HumanInventory::HandEvent - Invalid mode");
2795 super.HandleInventoryManipulation();
2826 if (player.IsAlive())
2828 if (!player.IsRestrained() && !player.IsUnconscious())
2844 EntityAI item = src.GetItem().GetHierarchyRoot();
2845 EntityAI root = item.GetHierarchyRoot();
2864 if (player.IsAlive())
2866 if (!player.IsRestrained() && !player.IsUnconscious())
2875 if (!LocationCanMoveEntity(src, dst))
2883 result = CheckMoveToDstRequest( GetManOwner(), src, dst, radius);
2888 EntityAI item = dst.GetItem().GetHierarchyRoot();
2889 EntityAI root = item.GetHierarchyRoot();
2898 #ifdef DIAG_DEVELOPER
2899 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
2903 switch(dst.GetType())
2907 CargoBase cargo = dst.GetParent().GetInventory().GetCargo();
2911 itemInCargo.GetInventory().GetCurrentInventoryLocation(ilCargoItem);
2912 if (dst.CollidesWith(ilCargoItem))
2914 itemsToRepair.Insert(itemInCargo);
2919 EntityAI entityInAttachment = dst.GetParent().GetInventory().FindAttachment(dst.GetSlot());
2921 if(entityInAttachment)
2923 itemsToRepair.Insert(entityInAttachment);
2927 EntityAI entityInHands = GetEntityInHands();
2930 itemsToRepair.Insert(entityInHands);
2938 if(itemsToRepair.Count() > 0)
2942 #ifdef DIAG_DEVELOPER
2955 player =
PlayerBase.Cast(ent.GetHierarchyRootPlayer());
2960 if (player.IsAlive())
2962 if (!player.IsRestrained() && !player.IsUnconscious())
2971 ent = dst2.GetParent();
2974 player =
PlayerBase.Cast(ent.GetHierarchyRootPlayer());
2979 if (player.IsAlive())
2981 if (!player.IsRestrained() && !player.IsUnconscious())
3001 item = dst1.GetItem().GetHierarchyRoot();
3002 root = item.GetHierarchyRoot();
3009 item = dst2.GetItem().GetHierarchyRoot();
3010 root = item.GetHierarchyRoot();
3031 if (player.IsAlive())
3033 if (!player.IsRestrained() && !player.IsUnconscious())
3044 result = CheckDropRequest( GetManOwner(), src, radius);
3055 return dst.GetParent().CheckAttachmentReceiveExclusion(src.GetItem(),dst.GetSlot());
3064 bool failed =
false;
3068 failed |= !dst1.GetParent().CheckAttachmentReceiveExclusion(dst1.GetItem(),dst1.GetSlot());
3073 failed |= !dst2.GetParent().CheckAttachmentReceiveExclusion(dst2.GetItem(),dst2.GetSlot());
3098 #ifdef ENABLE_LOGGING
3107 #ifdef ENABLE_LOGGING
3114 Error(
"[syncinv] HandleInputData remote input (cmd=DESTROY) dropped, item not in bubble");
3123 #ifdef ENABLE_LOGGING
3138 #ifdef ENABLE_LOGGING
3148 if (GetInventoryOwner() != src.
GetParent())
3150 #ifdef ENABLE_LOGGING
3160 #ifdef ENABLE_LOGGING
3177 bool correct =
true;
3185 if(!ctx.
Read(count))
3188 for (
int i = 0; i < count; i++)
3195 clientIl.
GetItem().GetInventory().GetCurrentInventoryLocation(realIl);
3197 if(clientIl != realIl)
3199 itemsToRepair.Insert(clientIl.
GetItem());
3204 if (itemsToRepair.Count())
3206 #ifdef DIAG_DEVELOPER
3207 if (PluginInventoryDebug.Cast(
GetPlugin(PluginInventoryDebug)).IsDesyncRepairEnable())
3211 #ifdef DIAG_DEVELOPER
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)
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)
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_DeferredPostedHandEvent
void SyncDeferredEventToRemotes()
override void HandleInventoryManipulation()
override bool OnInventoryJunctureFromServer(ParamsReadContext ctx)
void DayZPlayerInventory()
ref HandAnimatedTakingFromAtt m_Taking
deferred weapon event
override bool OnInventoryCheck(int userDataType, ParamsReadContext ctx)
override bool SwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2)
ref HandAnimatedMovingToAtt m_MovingTo
void SendRepairToClientDst(notnull InventoryLocation dst)
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
static void SendServerHandEventViaJuncture(notnull DayZPlayer player, HandEventBase e)
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
void fsmDebugSpam(string s)
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
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....
PluginBase GetPlugin(typename plugin_type)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
represents base for cargo storage for entities
Super root of all classes in Enforce script.
override void OnItemInHandsChanged()
static const int SJ_INVENTORY_FAILURE
static const int SJ_INVENTORY
static void InventoryHFSMLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
bool ReserveInventory(HumanInventory inventory)
void ClearInventoryReservation(HumanInventory inventory)
override bool ReserveInventory(HumanInventory inventory)
ref HandEventBase m_event
void DeferredHandEvent(InventoryMode mode, HandEventBase e)
override void ClearInventoryReservation(HumanInventory inventory)
ref InventoryLocation m_dst1
void DeferredSwapEntities(InventoryMode mode, notnull EntityAI item1, notnull EntityAI item2, notnull InventoryLocation dst1, notnull InventoryLocation dst2)
override void ClearInventoryReservation(HumanInventory inventory)
override bool ReserveInventory(HumanInventory inventory)
ref InventoryLocation m_dst2
bool ClearInventoryReservationEx(EntityAI item, InventoryLocation dst)
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 proto native bool HasInventoryReservation(EntityAI item, InventoryLocation dst)
Internally: HasInventoryReservationEx(item, dst, FindInventoryReservationMode.LEGACY,...
static bool CanForceSwapEntitiesEx(notnull EntityAI item1, InventoryLocation item1_dst, notnull EntityAI item2, out InventoryLocation item2_dst)
const float c_MaxItemDistanceRadius
anti-cheats
bool AddInventoryReservationEx(EntityAI item, InventoryLocation dst, int timeout_ms)
script counterpart to engine's class Inventory
override InventoryLocation GetSecondDst()
override InventoryLocation GetDst()
override bool AcquireInventoryJunctureFromServer(notnull Man player)
override EntityAI GetSecondSrcEntity()
override bool IsServerSideOnly()
override string DumpToString()
override void ClearInventoryReservation()
override void WriteToContext(ParamsWriteContext ctx)
override bool CheckRequestSrc()
override bool CanPerformEventEx(InventoryValidation validation)
override InventoryLocation GetSecondSrc()
Abstracted event, not to be used, only inherited.
override bool IsIdle()
idle state does not expect any animation events
override void OnUpdate(float dt)
override bool IsWaitingForActionFinish()
waiting for active animation action/actionType finish
represent hand state base
proto native bool IsActionFinished()
proto native int GetRunningAction()
returns -1 when no action is running or RELOAD,MECHANISM, ....
proto native int IsEvent()
return -1 when there is no event, otherwise it returns pId of event from animation
proto native int GetRunningActionType()
returns -1 when no action is running or appropriate action type
inventory for plain man/human
HumanInventory... with FSM (synchronous, no anims)
ref InventoryLocation m_Src2
ref InventoryLocation m_Src1
ref InventoryLocation m_Dst1
ref InventoryLocation m_Dst2
proto native bool IsValid()
verify current set inventory location
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands
proto native EntityAI GetParent()
returns parent of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
bool ReadFromContext(ParamsReadContext ctx)
proto native EntityAI GetItem()
returns item of current inventory location
InventoryValidationResult m_Result
InventoryValidationReason m_Reason
static bool IsWeaponLogEnable()
static bool IsSyncLogEnable()
static bool IsInventoryHFSMLogEnable()
static bool IsInventoryMoveLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native bool CanWrite()
Serialization general interface. Serializer API works with:
WeaponEventID GetEventID()
returns id from enum WeaponEventID
signalize mechanism manipulation
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native void StoreInputForRemotes(ParamsWriteContext ctx)
DayZPlayerInstanceType
defined in C++
proto native DayZPlayerInstanceType GetInstanceType()
Serializer ParamsReadContext
void Error(string err)
Messagebox with error message.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
void Obsolete(string msg="")
vector GetPosition()
Get the world position of the Effect.
string WeaponActionTypeToString(int A, int AT)