980 {
981 if (
g_Game.IsDedicatedServer())
982 return true;
983
985 return true;
986
987
988 bool success = true;
989 InventoryLocation targetInventoryLocation = NULL;
990 InventoryLocation handInventoryLocation = NULL;
991
992
994 {
996 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
997 {
998 targetInventoryLocation = new InventoryLocation;
999 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
1000 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
1001 {
1002 success = false;
1003 }
1004 else
1005 {
1006 action_data.m_Player.GetInventory().AddInventoryReservationEx( targetItem, targetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
1007 }
1008 }
1009 }
1010
1011 handInventoryLocation = new InventoryLocation;
1012 handInventoryLocation.
SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
1013
1014 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1015 {
1017 {
1018 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1019 }
1020
1021 success = false;
1022 }
1023 else
1024 {
1025 action_data.m_Player.GetInventory().AddInventoryReservationEx( action_data.m_Player.GetItemInHands(), handInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
1026 }
1027
1028 if (success)
1029 {
1030 if (targetInventoryLocation)
1031 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1032
1033 if (handInventoryLocation)
1034 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1035 }
1036
1037 return success;
1038 }
class GP5GasMask extends MaskBase ItemBase
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands