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

◆ InventoryReservation()

bool ActionBase::InventoryReservation ( ActionData action_data)
inlineprotected

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

1004 {
1005 if ((IsLocal() || !UseAcknowledgment()) && IsInstant())
1006 return true;
1007
1008 //action_data.m_ReservedInventoryLocations = new array<ref InventoryLocation>;
1009 bool success = true;
1010 InventoryLocation targetInventoryLocation = NULL;
1011 InventoryLocation handInventoryLocation = NULL;
1012
1013 // lock target if it has target
1014 if (HasTarget())
1015 {
1016 ItemBase targetItem;
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 {
1037 if (HasTarget())
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
bool HasTarget()
Определения ActionBase.c:244
bool UseAcknowledgment()
Определения ActionBase.c:1162
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().