968 {
970 return true;
971
972
973 bool success = true;
974 InventoryLocation targetInventoryLocation = NULL;
975 InventoryLocation handInventoryLocation = NULL;
976
977
979 {
981 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
982 {
983 targetInventoryLocation = new InventoryLocation;
984 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
985 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
986 {
987 success = false;
988 }
989 else
990 {
991 action_data.m_Player.GetInventory().AddInventoryReservationEx( targetItem, targetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
992 }
993 }
994 }
995
996 handInventoryLocation = new InventoryLocation;
997 handInventoryLocation.
SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
998
999 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1000 {
1002 {
1003 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1004 }
1005
1006 success = false;
1007 }
1008 else
1009 {
1010 action_data.m_Player.GetInventory().AddInventoryReservationEx( action_data.m_Player.GetItemInHands(), handInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
1011 }
1012
1013 if (success)
1014 {
1015 if (targetInventoryLocation)
1016 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1017
1018 if (handInventoryLocation)
1019 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1020 }
1021
1022 return success;
1023 }
class GP5GasMask extends MaskBase ItemBase
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands