Put item anywhere into this entity (as attachment or into cargo, recursively)
- Аргументы
-
[in] | mode | inventory mode |
[in] | flags | preferred location, |
- См. также
- FindInventoryLocationType
- Аргументы
-
[in] | item | item 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 {
1014
1015 InventoryLocation src = new InventoryLocation();
1016 if (item.GetInventory().GetCurrentInventoryLocation(src))
1017 {
1018 InventoryLocation dst = new InventoryLocation();
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)
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.
Перекрестные ссылки Error(), FindFreeLocationFor(), inventoryDebugPrint(), LogManager::IsInventoryMoveLogEnable() и TakeToDst().
Используется в TakeEntityAsAttachment() и TakeEntityToCargo().