DayZ 1.30
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 строка 4206

4207 {
4208 if (g_Game.IsServer())
4209 {
4210 if (e.IsServerSideOnly())
4211 {
4212 Error("[syncinv] " + Object.GetDebugName(player) + " SendServerHandEventViaJuncture - called on server side event only, e=" + e.DumpToString());
4213 }
4214
4215 if (player.IsAlive())
4216 {
4217 InventoryLocation dst = e.GetDst();
4218 InventoryLocation src = e.GetSrc();
4219 if (src.IsValid() && dst.IsValid())
4220 {
4221 if (player.NeedInventoryJunctureFromServer(src.GetItem(), src.GetParent(), dst.GetParent()))
4222 {
4223#ifdef ENABLE_LOGGING
4225 {
4226 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") need juncture src=" + InventoryLocation.DumpToStringNullSafe(src) + " dst=" + InventoryLocation.DumpToStringNullSafe(dst));
4227 }
4228#endif
4229
4230 if (g_Game.AddInventoryJunctureEx(player, src.GetItem(), dst, true, GameInventory.c_InventoryReservationTimeoutMS))
4231 {
4232#ifdef ENABLE_LOGGING
4234 {
4235 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") got juncture");
4236 }
4237#endif
4238 }
4239 else
4240 {
4241#ifdef ENABLE_LOGGING
4243 {
4244 syncDebugPrint("[syncinv] " + Object.GetDebugName(player) + " STS = " + player.GetSimulationTimeStamp() + " SendServerHandEventViaJuncture(" + typename.EnumToString(InventoryMode, InventoryMode.SERVER) + ") !got juncture");
4245 }
4246#endif
4247 }
4248 }
4249
4250#ifdef ENABLE_LOGGING
4252 {
4253 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));
4254 }
4255#endif
4256
4259 player.SendSyncJuncture(DayZPlayerSyncJunctures.SJ_INVENTORY, ctx);
4260
4261#ifdef ENABLE_LOGGING
4263 {
4264 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));
4265 }
4266#endif
4267
4269 //player.StoreInputForRemotes(ctx); // @TODO: is this right place? maybe in HandleInputData(server=true, ...)
4270 }
4271 }
4272 else
4273 {
4274 Error("[syncinv] SendServerHandEventViaJuncture - called on dead player, juncture is for living only");
4275 }
4276 }
4277 }
void syncDebugPrint(string s)
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
DayZGame g_Game
Определения DayZGame.c:4074
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:777
override string DumpToString()
Определения Hand_Events.c:333
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:789
Определения 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().