From e7c3820b0956118cf7774844ca293610ee24c94f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eke=20P=C3=A9ter?= Date: Wed, 7 Aug 2024 20:52:26 +0200 Subject: [PATCH] Move lag query fix to delayed init --- MVES/Classes/MapVote.uc | 20 ++------------------ MVES/Classes/MapVoteDelayedInit.uc | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/MVES/Classes/MapVote.uc b/MVES/Classes/MapVote.uc index 600554f..bc569a3 100644 --- a/MVES/Classes/MapVote.uc +++ b/MVES/Classes/MapVote.uc @@ -124,7 +124,7 @@ var MV_Result CurrentMap; var Music SongOverride; //XC_GameEngine and Unreal 227 interface -native(1718) final function bool AddToPackageMap( optional string PkgName); +//native(1718) final function bool AddToPackageMap( optional string PkgName); state Voting { @@ -210,7 +210,7 @@ Begin: event PostBeginPlay() { local class ExtensionC; - local string Cmd, NextParm, aStr, Settings; + local string Cmd, NextParm, Settings; local Actor A; local class ActorClass; local int MapIdx; @@ -219,7 +219,6 @@ event PostBeginPlay() local string CurrentPackages; local bool bGotoSuccess; local bool bNeedToRestorePackages, bNeedToRestoreMap; - local MV_IdleTimer MV_IdleTimer; Log("[MVE] Map Vote Extended version: "$ClientPackageInternal); @@ -472,10 +471,6 @@ event PostBeginPlay() PlayerDetector = Spawn(class'MV_PlayerDetector'); PlayerDetector.Initialize(Self); - if ( bFixMutatorsQueryLagSpikes ) - { - ApplyFixForMutatorsQueryLagSpikes(); - } // finally done! Log("[MVE] Finished loading map: `"$TravelMap$"` idx: "$TravelInfo.TravelIdx$" mode: "$CurrentMode); @@ -1729,17 +1724,6 @@ final function LoadAliases() } } -function ApplyFixForMutatorsQueryLagSpikes() -{ - // fixes common issue of server query DDOS-ing the game engine - // https://ut99.org/viewtopic.php?p=142091 - Level.Game.GetRules(); - if ( Level.Game.EnabledMutators == "" ) - { - Level.Game.EnabledMutators = "MapVote "$ClientPackageInternal; - } -} - //*************************************** //*************** TRIGGERS ************* //*************************************** diff --git a/MVES/Classes/MapVoteDelayedInit.uc b/MVES/Classes/MapVoteDelayedInit.uc index 5c53e5f..0d0e87c 100644 --- a/MVES/Classes/MapVoteDelayedInit.uc +++ b/MVES/Classes/MapVoteDelayedInit.uc @@ -11,6 +11,7 @@ event InitializeDelayedInit(MapVote mutator) event Timer() { + ApplyFixForMutatorsQueryLagSpikes(); EnsureMutatorRegistered(); EnsureScoreboardUpdated(); Destroy(); @@ -36,6 +37,21 @@ function EnsureScoreboardUpdated() Level.Game.InitGameReplicationInfo(); } +function ApplyFixForMutatorsQueryLagSpikes() +{ + if ( !MapVote.bFixMutatorsQueryLagSpikes ) + { + return; // fix is disabled + } + // fixes common issue of server query DDOS-ing the game engine + // https://ut99.org/viewtopic.php?p=142091 + Level.Game.GetRules(); + if ( Level.Game.EnabledMutators == "" ) + { + Level.Game.EnabledMutators = "MapVote "$MapVote.ClientPackageInternal; + } +} + static function Err(coerce string message) { class'MV_Util'.static.Err(message);