84 return m_Src.GetItem();
87 EntityAI GetSecondSrcEntity () {
return null; }
90 bool AcquireInventoryJunctureFromServer (notnull Man player) {
return false; }
91 bool CheckRequest () {
return true; }
97 if (validation.m_IsRemote || validation.m_IsJuncture)
100 return CheckRequest();
102 bool CanPerformEvent () {
return true; }
104 bool CheckRequestSrc () {
return true; }
105 bool IsServerSideOnly () {
return false; }
112 case HandEventID.TAKE:
return new HandEventTake(p, src);
113 case HandEventID.MOVETO:
return new HandEventMoveTo(p, src);
114 case HandEventID.DROP:
return new HandEventDrop(p, src);
115 case HandEventID.THROW:
return new HandEventThrow(p, src);
117 case HandEventID.FORCESWAP:
return new HandEventForceSwap(p, src);
118 case HandEventID.DESTROY:
return new HandEventDestroy(p, src);
119 case HandEventID.CREATED:
return new HandEventCreated(p, src);
120 case HandEventID.DESTROYED:
return new HandEventDestroyed(p, src);
122 case HandEventID.REPLACE2:
return new HandEventDestroyAndReplaceWithNewElsewhere(p, src);
123 case HandEventID.REPLACE3:
return new HandEventDestroyElsewhereAndReplaceWithNewInHands(p, src);
124 case HandEventID.REPLACED:
return new HandEventReplaced(p, src);
125 case HandEventID.ANIMEVENT_CHANGE_HIDE:
return HandAnimEventChanged(p, src);
126 case HandEventID.HUMANCOMMAND_ACTION_FINISHED :
return HandEventHumanCommandActionFinished(p, src);
127 case HandEventID.HUMANCOMMAND_ACTION_ABORTED :
return HandEventHumanCommandActionAborted(p, src);
129 Error(
"[hndfsm] HandEventFactory - unregistered hand event with id=" +
id);
136 if (!ctx.Read(eventID))
138 Error(
"[hndfsm] CreateHandEventFromContext - cannot read eventID");
142 if (!ctx.Read(player))
144 Error(
"[hndfsm] CreateHandEventFromContext - cannot read player");
151 if (!ctx.Read(animID))
153 Error(
"[hndfsm] CreateHandEventFromContext - cannot read animID");
159 b.m_AnimationID = animID;
160 b.ReadFromContext(ctx);
165 string DumpToString ()
174 bool ReserveInventory()
177 if( dst && !
m_Player.GetHumanInventory().AddInventoryReservationEx(dst.GetItem(), dst,
GameInventory.c_InventoryReservationTimeoutShortMS) )
184 void ClearInventoryReservation()
189 m_Player.GetHumanInventory().ClearInventoryReservationEx(dst.GetItem(), dst);
223 if (validation.m_IsJuncture)
240 return super.CanPerformEventEx(validation);
251 Error(
"[hndfsm] HandEventTake. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
265 super.ReadFromContext(ctx);
266 m_Dst.ReadFromContext(ctx);
270 super.WriteToContext(ctx);
271 m_Dst.WriteToContext(ctx);
314 Error(
"[hndfsm] HandEventMoveTo. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
376 Error(
"[hndfsm] HandEventThrow. AcquireInventoryJunctureFromServer: no src or dst for ev=" +
DumpToString());
388 m_CanPerformDrop =
true;
393 super.ReadFromContext(ctx);
395 ctx.Read(m_CanPerformDrop);
405 super.WriteToContext(ctx);
407 ctx.Write(m_CanPerformDrop);
419 if (!m_CanPerformDrop)
425 return super.CheckRequestEx(validation);
430 if (!m_CanPerformDrop)
436 if (!validation.m_IsJuncture && !validation.m_IsRemote && !
GetDst() && (
GetGame().IsMultiplayer() &&
GetGame().IsClient()))
442 if (!validation.m_IsRemote && !
GetDst())
447 if (!m_CanPerformDrop)
454 return super.CanPerformEventEx(validation);
457 bool m_CanPerformDrop;
472 entity.GetTransform(mat);
473 m_Dst.SetGround(entity, mat);
477 Error(
"[hndfsm] HandEventThrow src entity null!");
484 super.ReadFromContext(ctx);
487 m_Dst.ReadFromContext(ctx);
500 super.WriteToContext(ctx);
502 m_Dst.WriteToContext(ctx);
504 ctx.Write(m_Force[0]);
505 ctx.Write(m_Force[1]);
506 ctx.Write(m_Force[2]);
509 void SetForce(
vector force) { m_Force = force; }
510 vector GetForce() {
return m_Force; }
521 int m_Animation2ID = -1;
533 super.ReadFromContext(ctx);
539 m_Src2.ReadFromContext(ctx);
540 m_Dst.ReadFromContext(ctx);
541 m_Dst2.ReadFromContext(ctx);
542 ctx.Read(m_Animation2ID);
547 super.WriteToContext(ctx);
549 m_Src2.WriteToContext(ctx);
550 m_Dst.WriteToContext(ctx);
551 m_Dst2.WriteToContext(ctx);
552 ctx.Write(m_Animation2ID);
562 return m_Src2.GetItem();
582 override bool CheckRequest ()
593 else if (!
m_Player.GetHumanInventory().CanAddSwappedEntity(
m_Src, m_Src2, m_Dst, m_Dst2))
608 override bool CanPerformEvent ()
632 void CheckAndExecuteForceStandUp()
635 player.ForceStandUpForHeavyItemsSwap(
m_Src.GetItem(), m_Src2.GetItem() );
640 if( !
m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst.GetItem(), m_Dst,
GameInventory.c_InventoryReservationTimeoutShortMS) )
644 if( !
m_Player.GetHumanInventory().AddInventoryReservationEx(m_Dst2.GetItem(), m_Dst2,
GameInventory.c_InventoryReservationTimeoutShortMS) )
646 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
654 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst.GetItem(), m_Dst);
655 m_Player.GetHumanInventory().ClearInventoryReservationEx(m_Dst2.GetItem(), m_Dst2);
667 if (
GetSrcEntity() && inHands && m_Dst && m_Dst.IsValid())
683 bool test2 =
GameInventory.CanForceSwapEntitiesEx(
m_Src.GetItem(), m_Dst, m_Src2.GetItem(), m_Dst2);
721 super.ReadFromContext(ctx);
723 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (read)");
727 super.WriteToContext(ctx);
729 Error(
"[hndfsm] HandEventDestroyAndReplaceWithNew - Cannot serialize lambda (write)");
779 case WeaponEvents.CHANGE_HIDE:
return new HandAnimEventChanged(p, src);
780 case WeaponEvents.CHANGE_SHOW:
return new HandAnimEventChanged(p, src);
787 class HandEventHumanCommandActionFinished
extends HandEventBase
793 class HandEventHumanCommandActionAborted
extends HandEventBase