DayZ 1.30
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/DayZ/Entities/Man.c строка 238

239 {
240 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Stash IH=" + GetEntityInHands());
241 if (!ScriptInputUserData.CanStoreInputUserData())
242 {
243 Print("[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
244 return;
245 }
246
247 InventoryMode invMode = InventoryMode.PREDICTIVE;
248 EntityAI entityInHands = GetEntityInHands();
249
250 if (NeedInventoryJunctureFromServer(entityInHands, this, this))
251 invMode = InventoryMode.JUNCTURE;
252
253 HumanInventory humanInventory = GetHumanInventory();
255 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
256 {
257 InventoryLocation invLoc = new InventoryLocation;
258 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
259
261 EntityAI oldLocationParent = entityInHands.m_OldLocation.GetParent();
262 if (oldLocationParent && oldLocationParent.GetHierarchyRootPlayer())
263 {
264 humanInventory.ClearInventoryReservation(entityInHands, entityInHands.m_OldLocation);
265 if (humanInventory.LocationCanMoveEntity(invLoc, entityInHands.m_OldLocation))
266 {
267 EntityAI oldLocEntity = humanInventory.LocationGetEntity(entityInHands.m_OldLocation);
268 if (!oldLocEntity && humanInventory.TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
269 {
271 return;
272 }
273 else
274 {
275 InventoryLocation newLocation = new InventoryLocation;
276 if (humanInventory.FindFreeLocationFor(entityInHands, FindInventoryLocationType.CARGO, newLocation))
277 {
278 if (humanInventory.TakeToDst(invMode, invLoc, newLocation))
279 {
281 return;
282 }
283 }
284 }
285 }
286 }
287 }
288
291 }
void syncDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
class LogManager EntityAI
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:18
void UpdateInventoryMenu()
proto native EntityAI GetEntityInHands()
Returns the current entity in hands.
bool NeedInventoryJunctureFromServer(notnull EntityAI item, EntityAI currParent, EntityAI newParent)
Определения 3_Game/DayZ/Entities/Man.c:170
proto native HumanInventory GetHumanInventory()
static proto native EntityAI LocationGetEntity(notnull InventoryLocation inv_loc)
static proto native bool ClearInventoryReservation(EntityAI item, InventoryLocation dst)
static proto native bool LocationCanMoveEntity(notnull InventoryLocation src, notnull InventoryLocation dst)
queries if the entity contained in inv_loc.m_item can be moved to another location This is a shorthan...
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
override bool TakeEntityToInventory(InventoryMode mode, FindInventoryLocationType flags, notnull EntityAI item)
Определения HumanInventory.c:254
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения HumanInventory.c:243
override string GetDebugName()
Определения dayzplayer.c:1191
proto void Print(void var)
Prints content of variable to console/log.

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