DayZ 1.29
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 строка 2376

2377 {
2378 if (g_Game.IsServer())
2379 {
2380 if (e.IsServerSideOnly())
2381 {
2382 Error("[syncinv] " + Object.GetDebugName(player) + " SendServerHandEventViaJuncture - called on server side event only, e=" + e.DumpToString());
2383 }
2384
2385 if (player.IsAlive())
2386 {
2387 InventoryLocation dst = e.GetDst();
2388 InventoryLocation src = e.GetSrc();
2389 if (src.IsValid() && dst.IsValid())
2390 {
2391 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
2392 {
2393#ifdef ENABLE_LOGGING
2395 {
2396 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") need juncture src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
2397 }
2398#endif
2399
2400 if (g_Game.AddInventoryJunctureEx(player, src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
2401 {
2402#ifdef ENABLE_LOGGING
2404 {
2405 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") got juncture");
2406 }
2407#endif
2408 }
2409 else
2410 {
2411#ifdef ENABLE_LOGGING
2413 {
2414 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") !got juncture");
2415 }
2416#endif
2417 }
2418 }
2419
2420#ifdef ENABLE_LOGGING
2422 {
2423 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));
2424 }
2425#endif
2426
2429 player.SendSyncJuncture(DayZPlayerSyncJunctures.SJ_INVENTORY, ctx);
2430
2431#ifdef ENABLE_LOGGING
2433 {
2434 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));
2435 }
2436#endif
2437
2439 //player.StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
2440 }
2441 }
2442 else
2443 {
2444 Error("[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
2445 }
2446 }
2447 }
void syncDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
DayZGame g_Game
Определения DayZGame.c:3942
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:215
override bool IsServerSideOnly()
Определения Hand_Events.c:771
override string DumpToString()
Определения Hand_Events.c:338
static void SerializeHandEvent(ParamsWriteContext ctx, HandEventBase e)
hand
Определения InventoryInputUserData.c:105
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:233
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:30
static bool IsSyncLogEnable()
Определения 3_Game/DayZ/tools/Debug.c:776
Определения ObjectTyped.c:2
Определения gameplay.c:121
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90

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

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