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

◆ SendServerHandEventViaJuncture()

static void SendServerHandEventViaJuncture ( notnull DayZPlayer player,
HandEventBase e )
staticprotected

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 строка 2061

2062 {
2063 if (GetGame().IsServer())
2064 {
2065 if (e.IsServerSideOnly())
2066 {
2067 Error("[syncinv] " + Object.GetDebugName(player) + " SendServerHandEventViaJuncture - called on server side event only, e=" + e.DumpToString());
2068 }
2069
2070 if (player.IsAlive())
2071 {
2072 InventoryLocation dst = e.GetDst();
2073 InventoryLocation src = e.GetSrc();
2074 if (src.IsValid() && dst.IsValid())
2075 {
2076 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
2077 {
2078#ifdef ENABLE_LOGGING
2080 {
2081 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") need juncture src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
2082 }
2083#endif
2084
2085 if (GetGame().AddInventoryJunctureEx(player, src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
2086 {
2087#ifdef ENABLE_LOGGING
2089 {
2090 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") got juncture");
2091 }
2092#endif
2093 }
2094 else
2095 {
2096#ifdef ENABLE_LOGGING
2098 {
2099 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") !got juncture");
2100 }
2101#endif
2102 }
2103 }
2104
2105#ifdef ENABLE_LOGGING
2107 {
2108 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + " server hand event src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
2109 }
2110#endif
2111
2114 player.SendSyncJuncture(DayZPlayerSyncJunctures.SJ_INVENTORY, ctx);
2115
2116#ifdef ENABLE_LOGGING
2118 {
2119 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " store input for remote - SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + " server hand event src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
2120 }
2121#endif
2122
2124 //player.StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
2125 }
2126 }
2127 else
2128 {
2129 Error("[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
2130 }
2131 }
2132 }
void syncDebugPrint(string s)
Определения Debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
static const int SJ_INVENTORY
Определения DayZPlayerSyncJunctures.c:11
const int c_InventoryReservationTimeoutMS
reservations
Определения Inventory.c:712
script counterpart to engine's class Inventory
Определения Inventory.c:79
override InventoryLocation GetDst()
Определения Hand_Events.c:212
override bool IsServerSideOnly()
Определения Hand_Events.c:718
override string DumpToString()
Определения Hand_Events.c:332
static void SerializeHandEvent(ParamsWriteContext ctx, HandEventBase e)
hand
Определения InventoryInputUserData.c:72
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
static string DumpToStringNullSafe(InventoryLocation loc)
Определения InventoryLocation.c:226
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
static bool IsSyncLogEnable()
Определения Debug.c:678
Определения Debug.c:594
Определения ObjectTyped.c:2
Определения gameplay.c:121
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

Перекрестные ссылки GameInventory::c_InventoryReservationTimeoutMS, HandEventBase::DumpToString(), InventoryLocation::DumpToStringNullSafe(), Error(), HandEventBase::GetDst(), GetGame(), InventoryLocation::GetItem(), InventoryLocation::GetParent(), HandEventBase::IsServerSideOnly(), LogManager::IsSyncLogEnable(), InventoryLocation::IsValid(), InventoryInputUserData::SerializeHandEvent(), DayZPlayerSyncJunctures::SJ_INVENTORY и syncDebugPrint().

Используется в HandleHandEvent().