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

◆ TakeToDst()

override bool TakeToDst ( InventoryMode mode,
notnull InventoryLocation src,
notnull InventoryLocation dst )
protected

Remote inputs are processed in sync juncture once performed on the server - this code below was executing the inventory command before the player simulation timeestamp for remotes which is illegal

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

1656 {
1657 if (GetManOwner().IsAlive() == false)
1658 return super.TakeToDst(mode, src, dst);
1659
1660 #ifdef ENABLE_LOGGING
1662 {
1663 Debug.InventoryMoveLog("STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1664 }
1665 #endif
1666
1667 switch (mode)
1668 {
1669 case InventoryMode.SERVER:
1670 if (RedirectToHandEvent(mode, src, dst))
1671 {
1672 #ifdef ENABLE_LOGGING
1674 {
1675 Debug.InventoryMoveLog("RedirectToHandEvent", "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1676 }
1677 #endif
1678
1679 return true;
1680 }
1681
1682
1683 if (GetDayZPlayerOwner().NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
1684 {
1685 if (GetGame().AddInventoryJunctureEx(GetDayZPlayerOwner(), src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
1686 {
1687#ifdef ENABLE_LOGGING
1689 {
1690 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " DZPI::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") got juncture");
1691 }
1692#endif
1693 }
1694 else
1695 {
1696#ifdef ENABLE_LOGGING
1698 {
1699 Debug.InventoryMoveLog("Juncture failed", "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1700 }
1701
1703 {
1704 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " DZPI::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") got juncture");
1705 }
1706#endif
1707
1708 return false;
1709 }
1710
1711 }
1712
1715
1717
1718#ifdef ENABLE_LOGGING
1720 {
1721 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " store input for remote - DZPI::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + " server sync move src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
1722 }
1723#endif
1724
1726 //GetDayZPlayerOwner().StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
1727 #ifdef ENABLE_LOGGING
1729 {
1730 Debug.InventoryMoveLog("Success - store input for remote mode - " + typename.EnumToString(InventoryMode, mode) + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1731 }
1732 #endif
1733 return true;
1734
1735 case InventoryMode.LOCAL:
1736 LocationSyncMoveEntity(src, dst);
1737 return true;
1738 }
1739 if (!super.TakeToDst(mode,src,dst))
1740 {
1741 return PostDeferredEventTakeToDst(mode,src,dst);
1742 }
1743 return true;
1744 }
void syncDebugPrint(string s)
Определения Debug.c:1
InventoryCommandType
Определения Inventory.c:3
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:168
override bool PostDeferredEventTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения DayZPlayerInventory.c:1746
proto string ToString()
static const int SJ_INVENTORY
Определения DayZPlayerSyncJunctures.c:11
static void InventoryMoveLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Определения Debug.c:137
Определения Debug.c:2
const int c_InventoryReservationTimeoutMS
reservations
Определения Inventory.c:712
script counterpart to engine's class Inventory
Определения Inventory.c:79
static void SerializeMove(ParamsWriteContext ctx, int type, notnull InventoryLocation src, notnull InventoryLocation dst)
move
Определения InventoryInputUserData.c:5
static string DumpToStringNullSafe(InventoryLocation loc)
Определения InventoryLocation.c:226
InventoryLocation.
Определения InventoryLocation.c:29
static bool IsSyncLogEnable()
Определения Debug.c:678
static bool IsInventoryMoveLogEnable()
Определения Debug.c:648
Определения Debug.c:594
Определения ObjectTyped.c:2
Определения gameplay.c:121
proto native CGame GetGame()

Перекрестные ссылки GameInventory::c_InventoryReservationTimeoutMS, InventoryLocation::DumpToStringNullSafe(), GetDayZPlayerOwner(), GetGame(), Debug::InventoryMoveLog(), LogManager::IsInventoryMoveLogEnable(), LogManager::IsSyncLogEnable(), PostDeferredEventTakeToDst(), InventoryInputUserData::SerializeMove(), DayZPlayerSyncJunctures::SJ_INVENTORY, syncDebugPrint() и ToString().

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