DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ InventoryReservation()

bool ActionBase::InventoryReservation ( ActionData action_data)
inlineprotected

См. определение в файле ActionBase.c строка 967

968 {
969 if ((IsLocal() || !UseAcknowledgment()) && IsInstant())
970 return true;
971
972 //action_data.m_ReservedInventoryLocations = new array<ref InventoryLocation>;
973 bool success = true;
974 InventoryLocation targetInventoryLocation = NULL;
975 InventoryLocation handInventoryLocation = NULL;
976
977 // lock target if it has target
978 if (HasTarget())
979 {
980 ItemBase targetItem;
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 {
1001 if (HasTarget())
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
bool HasTarget()
Определения ActionBase.c:244
bool UseAcknowledgment()
Определения ActionBase.c:1123
bool IsInstant()
Определения ActionBase.c:262
bool IsLocal()
Определения ActionBase.c:256
proto native void SetHands(notnull EntityAI parent, EntityAI e)
sets current inventory location type to Hands

Перекрестные ссылки ActionData, GameInventory::c_InventoryReservationTimeoutMS, HasTarget(), IsInstant(), IsLocal(), InventoryLocation::SetHands() и UseAcknowledgment().

Используется в ActionWorldCraft::OnFinishProgressServer(), ActionDeployBase::OnUpdate() и SetupAction().