DayZ 1.27
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 строка 372

373 {
374 InventoryLocation src1, src2, dst1;
375 if (GameInventory.MakeSrcAndDstForForceSwap(item1, item2, src1, src2, dst1, item2_dst))
376 {
377 GameInventory manOwnerInventory = GetManOwner().GetInventory();
378
379 if (LogManager.IsInventoryHFSMLogEnable()) hndDebugPrint("[inv] HumanInventory::FSwap(" + typename.EnumToString(InventoryMode, mode) + ") dst1=" + InventoryLocation.DumpToStringNullSafe(dst1)+ " dst2=" + InventoryLocation.DumpToStringNullSafe(item2_dst));
380 bool handled = false;
381 switch (src1.GetType())
382 {
383 case InventoryLocationType.HANDS:
384 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));
385 HandEventBase e = new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst);
387 HandEvent(mode, e);
388 handled = true;
389 break;
390
391 }
392
393 switch (src2.GetType())
394 {
395 case InventoryLocationType.HANDS:
397 InventoryLocation fswap_dst2 = new InventoryLocation;
398 if ( SwappingToPreviousLocation(item2, item1, fswap_dst2))
399 {
400 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));
401 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, fswap_dst2));
402 }
403 else
404 {
405 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));
406 HandEvent(mode, new HandEventForceSwap(GetManOwner(), src1, src2, dst1, item2_dst));
407 }
408
409 handled = true;
410 break;
411 }
412
413 bool returnValue = true;
414
415 if (!handled)
416 returnValue = super.ForceSwapEntities(mode, item1, item2, item2_dst);
417
418 return returnValue;
419 }
420
421 Error("HumanInventory::ForceSwapEntities: No inventory location");
422 return false;
423 }
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
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:652
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:540
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().

Используется в EntityAI::ForceSwapEntitiesImpl().