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

◆ TakeEntityToInventory()

bool GameInventory::TakeEntityToInventory ( InventoryMode mode,
FindInventoryLocationType flags,
notnull EntityAI item )
inlineprotected

Put item anywhere into this entity (as attachment or into cargo, recursively)

Аргументы
[in]modeinventory mode
[in]flagspreferred location,
См. также
FindInventoryLocationType
Аргументы
[in]itemitem to be taken in inventory
Возвращает
true on success

@NOTE: Predictive.* / Local.* functions: a) 'Predictive' means that the operation uses Client-Side Prediction, i.e. the action runs the same code on both, client AND server.

b) 'Local' operation executes from where it is run, i.e. the operation from client is NOT sent to server, and only client performs the inventory operation (TakeEntityTo.*) this behaviour is necessary when inventory operations are ALREADY synchronized by another means, like Actions. For example

См. также
ActionTakeItemToHands that performs OnCompleteServer and OnCompleteClient with synchronization set to false in order to avoid duplicate synchronization.

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

1012 {
1013 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1014
1015 InventoryLocation src = new InventoryLocation();
1016 if (item.GetInventory().GetCurrentInventoryLocation(src))
1017 {
1018 InventoryLocation dst = new InventoryLocation();
1019 if (FindFreeLocationFor(item, flags, dst))
1020 return TakeToDst(mode, src, dst);
1021
1022 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Warning - no room for item");
1023 return false;
1024 }
1025 Error("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Error - src has no inventory location");
1026 return false;
1027 }
void inventoryDebugPrint(string s)
Определения Debug.c:19
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
Определения Inventory.c:1055
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки Error(), FindFreeLocationFor(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().

Используется в TakeEntityAsAttachment() и TakeEntityToCargo().