DayZ 1.29
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.

См. определение в файле 3_Game/DayZ/Systems/Inventory/Inventory.c строка 1012

1013 {
1014 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item);
1015
1016 InventoryLocation src = new InventoryLocation();
1017 if (item.GetInventory().GetCurrentInventoryLocation(src))
1018 {
1019 InventoryLocation dst = new InventoryLocation();
1020 if (FindFreeLocationFor(item, flags, dst))
1021 return TakeToDst(mode, src, dst);
1022
1023 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Warning - no room for item");
1024 return false;
1025 }
1026 Error("[inv] I::Take2Inv(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Error - src has no inventory location");
1027 return false;
1028 }
void inventoryDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
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().