DayZ 1.29
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 строка 231

232 {
233 if (LogManager.IsSyncLogEnable()) syncDebugPrint("[inv] " + GetDebugName(this) + " STS = " + GetSimulationTimeStamp() + " Stash IH=" + GetEntityInHands());
234 if (!ScriptInputUserData.CanStoreInputUserData())
235 {
236 Print("[inv] PredictiveMoveItemFromHandsToInventory input data not sent yet, cannot allow another input action");
237 return;
238 }
239
240 InventoryMode invMode = InventoryMode.PREDICTIVE;
241 EntityAI entityInHands = GetEntityInHands();
242
243 if (NeedInventoryJunctureFromServer(entityInHands, this, this))
244 invMode = InventoryMode.JUNCTURE;
245
246 HumanInventory humanInventory = GetHumanInventory();
248 if (entityInHands.m_OldLocation && entityInHands.m_OldLocation.IsValid())
249 {
250 InventoryLocation invLoc = new InventoryLocation;
251 entityInHands.GetInventory().GetCurrentInventoryLocation(invLoc);
252
254 EntityAI oldLocationParent = entityInHands.m_OldLocation.GetParent();
255 if (oldLocationParent && oldLocationParent.GetHierarchyRootPlayer())
256 {
257 humanInventory.ClearInventoryReservation(entityInHands, entityInHands.m_OldLocation);
258 if (humanInventory.LocationCanMoveEntity(invLoc, entityInHands.m_OldLocation))
259 {
260 EntityAI oldLocEntity = humanInventory.LocationGetEntity(entityInHands.m_OldLocation);
261 if (!oldLocEntity && humanInventory.TakeToDst(invMode, invLoc, entityInHands.m_OldLocation))
262 {
264 return;
265 }
266 else
267 {
268 InventoryLocation newLocation = new InventoryLocation;
269 if (humanInventory.FindFreeLocationFor(entityInHands, FindInventoryLocationType.CARGO, newLocation))
270 {
271 if (humanInventory.TakeToDst(invMode, invLoc, newLocation))
272 {
274 return;
275 }
276 }
277 }
278 }
279 }
280 }
281
284 }
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:163
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:253
override bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения HumanInventory.c:243
override string GetDebugName()
Определения dayzplayer.c:1173
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().