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

2072 {
2073 if (GetGame().IsServer())
2074 {
2075 if (e.IsServerSideOnly())
2076 {
2077 Error("[syncinv] " + Object.GetDebugName(player) + " SendServerHandEventViaJuncture - called on server side event only, e=" + e.DumpToString());
2078 }
2079
2080 if (player.IsAlive())
2081 {
2082 InventoryLocation dst = e.GetDst();
2083 InventoryLocation src = e.GetSrc();
2084 if (src.IsValid() && dst.IsValid())
2085 {
2086 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
2087 {
2088#ifdef ENABLE_LOGGING
2090 {
2091 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") need juncture src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
2092 }
2093#endif
2094
2095 if (GetGame().AddInventoryJunctureEx(player, src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
2096 {
2097#ifdef ENABLE_LOGGING
2099 {
2100 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") got juncture");
2101 }
2102#endif
2103 }
2104 else
2105 {
2106#ifdef ENABLE_LOGGING
2108 {
2109 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") !got juncture");
2110 }
2111#endif
2112 }
2113 }
2114
2115#ifdef ENABLE_LOGGING
2117 {
2118 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));
2119 }
2120#endif
2121
2124 player.SendSyncJuncture(DayZPlayerSyncJunctures.SJ_INVENTORY, ctx);
2125
2126#ifdef ENABLE_LOGGING
2128 {
2129 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));
2130 }
2131#endif
2132
2134 //player.StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
2135 }
2136 }
2137 else
2138 {
2139 Error("[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
2140 }
2141 }
2142 }
void syncDebugPrint(string s)
Определения 3_Game/Systems/Inventory/Debug.c:1
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
static const int SJ_INVENTORY
Определения DayZPlayerSyncJunctures.c:11
const int c_InventoryReservationTimeoutMS
reservations
script counterpart to engine's class Inventory
override InventoryLocation GetDst()
Определения Hand_Events.c:212
override bool IsServerSideOnly()
Определения Hand_Events.c:744
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()
Определения 3_Game/tools/Debug.c:678
Определения 3_Game/tools/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().