1004 {
1006 return true;
1007
1008
1009 bool success = true;
1010 InventoryLocation targetInventoryLocation = NULL;
1011 InventoryLocation handInventoryLocation = NULL;
1012
1013
1015 {
1017 if (
ItemBase.CastTo(targetItem,action_data.m_Target.GetObject()) )
1018 {
1019 targetInventoryLocation = new InventoryLocation;
1020 targetItem.GetInventory().GetCurrentInventoryLocation(targetInventoryLocation);
1021 if ( action_data.m_Player.GetInventory().HasInventoryReservation( targetItem, targetInventoryLocation) )
1022 {
1023 success = false;
1024 }
1025 else
1026 {
1027 action_data.m_Player.GetInventory().AddInventoryReservationEx( targetItem, targetInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
1028 }
1029 }
1030 }
1031
1032 handInventoryLocation = new InventoryLocation;
1033 handInventoryLocation.
SetHands(action_data.m_Player,action_data.m_Player.GetItemInHands());
1034
1035 if (action_data.m_Player.GetInventory().HasInventoryReservation( action_data.m_Player.GetItemInHands(), handInventoryLocation))
1036 {
1038 {
1039 action_data.m_Player.GetInventory().ClearInventoryReservation(targetItem, targetInventoryLocation);
1040 }
1041
1042 success = false;
1043 }
1044 else
1045 {
1046 action_data.m_Player.GetInventory().AddInventoryReservationEx( action_data.m_Player.GetItemInHands(), handInventoryLocation, GameInventory.c_InventoryReservationTimeoutMS);
1047 }
1048
1049 if (success)
1050 {
1051 if (targetInventoryLocation)
1052 action_data.m_ReservedInventoryLocations.Insert(targetInventoryLocation);
1053
1054 if (handInventoryLocation)
1055 action_data.m_ReservedInventoryLocations.Insert(handInventoryLocation);
1056 }
1057
1058 return success;
1059 }
class GP5GasMask extends MaskBase ItemBase
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands