DayZ 1.29
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 строка 382

383 {
384 InventoryLocation src1, src2, dst1;
385 if (GameInventory.MakeSrcAndDstForForceSwap(item1, item2, src1, src2, dst1, item2_dst))
386 {
387 GameInventory manOwnerInventory = GetManOwner().GetInventory();
388
389 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1)+ " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
390 bool handled = false;
391 switch (src1.GetType())
392 {
393 case InventoryLocationType.HANDS:
394 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));
395 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
397 HandEvent(mode, e);
398 handled = true;
399 break;
400
401 }
402
403 switch (src2.GetType())
404 {
405 case InventoryLocationType.HANDS:
407 InventoryLocation fswap_dst2 = new InventoryLocation;
408 if ( SwappingToPreviousLocation(item2, item1, fswap_dst2))
409 {
410 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));
411 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
412 }
413 else
414 {
415 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));
416 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
417 }
418
419 handled = true;
420 break;
421 }
422
423 bool returnValue = true;
424
425 if (!handled)
426 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
427
428 return returnValue;
429 }
430
431 Error("HumanInventory::ForceSwapEntities: No inventory location");
432 return false;
433 }
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:699
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:553
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().