DayZ 1.28
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 строка 1665

1666 {
1667 if (GetManOwner().IsAlive() == false)
1668 return super.TakeToDst(mode, src, dst);
1669
1670 #ifdef ENABLE_LOGGING
1672 {
1673 Debug.InventoryMoveLog("STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1674 }
1675 #endif
1676
1677 switch (mode)
1678 {
1679 case InventoryMode.SERVER:
1680 if (RedirectToHandEvent(mode, src, dst))
1681 {
1682 #ifdef ENABLE_LOGGING
1684 {
1685 Debug.InventoryMoveLog("RedirectToHandEvent", "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1686 }
1687 #endif
1688
1689 return true;
1690 }
1691
1692
1693 if (GetDayZPlayerOwner().NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
1694 {
1695 if (GetGame().AddInventoryJunctureEx(GetDayZPlayerOwner(), src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
1696 {
1697#ifdef ENABLE_LOGGING
1699 {
1700 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " DZPI::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") got juncture");
1701 }
1702#endif
1703 }
1704 else
1705 {
1706#ifdef ENABLE_LOGGING
1708 {
1709 Debug.InventoryMoveLog("Juncture failed", "n/a" , "n/a", "TakeToDst", GetDayZPlayerOwner().ToString() );
1710 }
1711
1713 {
1714 syncDebugPrint("[syncinv] " + Object.GetDebugName(GetDayZPlayerOwner()) + " STS = " + GetDayZPlayerOwner().GetSimulationTimeStamp() + " DZPI::Take2Dst(" + typename.EnumToString(InventoryMode, mode) + ") got juncture");
1715 }
1716#endif
1717
1718 return false;
1719 }
1720
1721 }
1722
1725
1727
1728#ifdef ENABLE_LOGGING
1730 {
1731 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));
1732 }
1733#endif
1734
1736 //GetDayZPlayerOwner().StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
1737 #ifdef ENABLE_LOGGING
1739 {
1740 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() );
1741 }
1742 #endif
1743 return true;
1744
1745 case InventoryMode.LOCAL:
1746 LocationSyncMoveEntity(src, dst);
1747 return true;
1748 }
1749 if (!super.TakeToDst(mode,src,dst))
1750 {
1751 return PostDeferredEventTakeToDst(mode,src,dst);
1752 }
1753 return true;
1754 }
void syncDebugPrint(string s)
Определения 3_Game/Systems/Inventory/Debug.c:1
InventoryCommandType
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
DayZPlayer GetDayZPlayerOwner()
Определения DayZPlayerInventory.c:168
override bool PostDeferredEventTakeToDst(InventoryMode mode, notnull InventoryLocation src, notnull InventoryLocation dst)
Определения DayZPlayerInventory.c:1756
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)
Определения 3_Game/tools/Debug.c:137
Определения 3_Game/tools/Debug.c:2
const int c_InventoryReservationTimeoutMS
reservations
script counterpart to engine's class Inventory
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()
Определения 3_Game/tools/Debug.c:678
static bool IsInventoryMoveLogEnable()
Определения 3_Game/tools/Debug.c:648
Определения 3_Game/tools/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().