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

◆ PredictiveMoveItemFromHandsToInventory()

void EntityAI::PredictiveMoveItemFromHandsToInventory ( )
inlineprotected

ToDo: Old system method. Might should be adjusted to new system at some point.

returns item to previous location, if available

Check if old strored location is somewhere on this player

This should not happen after clearing inventory reservation but just in case handle also getting a new location if the old location is obscured by an item.

См. определение в файле 3_Game/Entities/Man.c строка 223

224 {
225 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Stash IH=" + GetHumanInventory().GetEntityInHands());
226 if (!ScriptInputUserData.CanStoreInputUserData())
227 {
228 Print("[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
229 return;
230 }
231
232 InventoryMode invMode = InventoryMode.PREDICTIVE;
233 EntityAI entityInHands = GetHumanInventory().GetEntityInHands();
234
235 if (NeedInventoryJunctureFromServer(entityInHands, this, this))
236 invMode = InventoryMode.JUNCTURE;
237
239 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
240 {
241 InventoryLocation invLoc = new InventoryLocation;
242 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
243
245 if (entityInHands.m_OldLocation.GetParent() && entityInHands.m_OldLocation.GetParent().GetHierarchyRootPlayer())
246 {
247 GetHumanInventory().ClearInventoryReservation(entityInHands, entityInHands.m_OldLocation);
248 if (GetHumanInventory().LocationCanMoveEntity(invLoc, entityInHands.m_OldLocation))
249 {
250 EntityAI oldLocEntity = GetHumanInventory().LocationGetEntity(entityInHands.m_OldLocation);
251 if (!oldLocEntity && GetHumanInventory().TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
252 {
254 return;
255 }
256 else
257 {
258 InventoryLocation newLocation = new InventoryLocation;
259 if (GetHumanInventory().FindFreeLocationFor(entityInHands, FindInventoryLocationType.CARGO, newLocation))
260 {
261 if (GetHumanInventory().TakeToDst(invMode, invLoc, newLocation))
262 {
264 return;
265 }
266 }
267 }
268 }
269 }
270 }
271
274 }
void syncDebugPrint(string s)
Определения 3_Game/Systems/Inventory/Debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
class LogManager EntityAI
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения DayZPlayerInventory.c:1665
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
void UpdateInventoryMenu()
bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
Определения 3_Game/Entities/Man.c:155
proto native HumanInventory GetHumanInventory()
static proto native EntityAI LocationGetEntity(notnull InventoryLocation inv_loc)
static proto native bool ClearInventoryReservation(EntityAI item, InventoryLocation dst)
proto native EntityAI GetEntityInHands()
override bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Определения HumanInventory.c:245
override string GetDebugName()
Определения dayzplayer.c:1170
proto void Print(void var)
Prints content of variable to console/log.

Перекрестные ссылки ScriptInputUserData::CanStoreInputUserData(), GameInventory::ClearInventoryReservation(), GetDebugName(), HumanInventory::GetEntityInHands(), GetHumanInventory(), LogManager::IsSyncLogEnable(), GameInventory::LocationGetEntity(), NeedInventoryJunctureFromServer(), Print(), syncDebugPrint(), HumanInventory::TakeEntityToInventory(), TakeToDst() и UpdateInventoryMenu().