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

◆ TakeEntityAsTargetAttachmentEx()

bool GameInventory::TakeEntityAsTargetAttachmentEx ( InventoryMode mode,
notnull EntityAI target,
notnull EntityAI item,
int slot )
inlineprotected

put item as attachment of target

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

1138 {
1139 if (LogManager.IsInventoryMoveLogEnable()) inventoryDebugPrint("[inv] I::Take2TargetAttEx(" + typename.EnumToString(InventoryMode, mode) + ") as ATT of target=" + target + " item=" + item + " slot=" + slot);
1140 InventoryLocation src = new InventoryLocation();
1141 if (item.GetInventory().GetCurrentInventoryLocation(src))
1142 {
1143 EntityAI att = target.GetInventory().FindAttachment(slot);
1144 if (att)
1145 {
1146 if (mode == InventoryMode.SERVER)
1147 {
1148 att.CombineItemsEx(item, true);
1149 }
1150 else
1151 {
1152 att.CombineItemsClient(item, true);
1153 }
1154 return true;
1155 }
1156 else if (item.CanBeSplit() && item.GetTargetQuantityMax(slot) < item.GetQuantity())
1157 {
1158 if (mode == InventoryMode.SERVER)
1159 {
1160 item.SplitIntoStackMaxEx(target, slot);
1161 }
1162 else
1163 {
1164 item.SplitIntoStackMaxClient(target,slot);
1165 }
1166 return true;
1167 }
1168 else
1169 {
1170 InventoryLocation dst = new InventoryLocation();
1171 dst.SetAttachment(target, item, slot);
1172 return TakeToDst(mode, src, dst);
1173 }
1174 }
1175 Error("[inv] I::Take2AttEx(" + typename.EnumToString(InventoryMode, mode) + ") item=" + item + " Error - src has no inventory location");
1176 return false;
1177 }
void inventoryDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
class LogManager EntityAI
bool TakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
move src to dst
proto native void SetAttachment(notnull EntityAI parent, EntityAI e, int slotId)
sets current inventory location type to Attachment with slot id set to <slotId>
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

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

Используется в TakeEntityAsAttachmentEx().