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

◆ ForceSwapEntities()

override bool HumanInventory::ForceSwapEntities ( InventoryMode mode,
notnull EntityAI item1,
notnull EntityAI item2,
notnull InventoryLocation item2_dst )
inlineprivate

returns item to previous location, if available

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

320 {
321 InventoryLocation src1, src2, dst1;
322 if (GameInventory.MakeSrcAndDstForForceSwap(item1, item2, src1, src2, dst1, item2_dst))
323 {
324 GameInventory manOwnerInventory = GetManOwner().GetInventory();
325
326 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1)+ " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
327 bool handled = false;
328 switch (src1.GetType())
329 {
330 case InventoryLocationType.HANDS:
331 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-HND@1(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " item2_dst=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
332 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
334 HandEvent(mode, e);
335 handled = true;
336 break;
337
338 }
339
340 switch (src2.GetType())
341 {
342 case InventoryLocationType.HANDS:
344 InventoryLocation fswap_dst2 = new InventoryLocation;
345 if ( SwappingToPreviousLocation(item2, item1, fswap_dst2))
346 {
347 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-PREV(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " fswap_dst2=" + InventoryLocation.DumpToStringNullSafe(fswap_dst2));
348 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
349 }
350 else
351 {
352 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap-HND@2(" + typename.EnumToString(InventoryMode, mode) + ") src1=" + InventoryLocation.DumpToStringNullSafe(src1) + " src2=" + InventoryLocation.DumpToStringNullSafe(src2) + " dst1=" + InventoryLocation.DumpToStringNullSafe(dst1) + " item2_dst=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
353 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
354 }
355
356 handled = true;
357 break;
358 }
359
360 bool returnValue = true;
361
362 if (!handled)
363 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
364
365 return returnValue;
366 }
367
368 Error("HumanInventory::ForceSwapEntities: No inventory location");
369 return false;
370 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
void HandEventBase(Man p=null, InventoryLocation src=null)
Определения Hand_Events.c:52
void hndDebugPrint(string s)
Определения HandFSM.c:1
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
override bool ReserveInventory()
Определения Hand_Events.c:705
Man GetManOwner()
Определения HumanInventory.c:102
bool HandEvent(InventoryMode mode, HandEventBase e)
Определения HumanInventory.c:134
bool SwappingToPreviousLocation(EntityAI item1, EntityAI item2, out InventoryLocation dst)
Определения HumanInventory.c:490
proto native int GetType()
returns type of InventoryLocation
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки InventoryLocation::DumpToStringNullSafe(), Error(), GetManOwner(), InventoryLocation::GetType(), HandEvent(), hndDebugPrint(), LogManager::IsInventoryHFSMLogEnable(), GameInventory::MakeSrcAndDstForForceSwap(), HandEventBase::ReserveInventory() и SwappingToPreviousLocation().