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

◆ TransferInventory()

static TransferInventoryResult TransferInventory ( EntityAI sourceItem,
EntityAI targetItem,
PlayerBase player )
staticprotected

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

345 {
347
348 array<EntityAI> children = new array<EntityAI>;
349 sourceItem.GetInventory().EnumerateInventory(InventoryTraversalType.LEVELORDER, children);
350 int count = children.Count();
351 for (int i = 0; i < count; ++i)
352 {
353 EntityAI child = children.Get(i);
354 if (child)
355 {
356 InventoryLocation child_src = new InventoryLocation;
357 child.GetInventory().GetCurrentInventoryLocation( child_src );
358
359 InventoryLocation child_dst = new InventoryLocation;
360 child_dst.Copy( child_src );
361 child_dst.SetParent( targetItem );
362
363 bool drop = false;
364
365 if (GameInventory.LocationCanAddEntity(child_dst))
366 {
367 // try to move it to the same exact place in dst
368 targetItem.GetInventory().TakeToDst(InventoryMode.LOCAL, child_src, child_dst);
369 }
370 else
371 {
372 drop = true; // or drop otherwise
373 }
374
375 if (drop)
376 {
377 player.LocalDropEntity(child);
379 result = TransferInventoryResult.DroppedSome;
380 }
381 }
382 }
383 return result;
384 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
TransferInventoryResult
Определения MiscGameplayFunctions.c:203
proto native void RemoteObjectTreeCreate(Object obj)
RemoteObjectCreate - postponed registration of network object (and creation of remote object)....
Определения Building.c:6
static proto native bool LocationCanAddEntity(notnull InventoryLocation inv_loc)
queries if the entity contained in inv_loc.m_item can be added to ground/attachment/cargo/hands/....
script counterpart to engine's class Inventory
Определения Inventory.c:79
proto native void SetParent(notnull EntityAI parent)
proto native InventoryLocation Copy(notnull InventoryLocation rhs)
copies location data to another location
InventoryLocation.
Определения InventoryLocation.c:29
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()

Перекрестные ссылки InventoryLocation::Copy(), GetGame(), GameInventory::LocationCanAddEntity(), CGame::RemoteObjectTreeCreate() и InventoryLocation::SetParent().