From ea148e9b1493fb06fdcd7ec15fb3bad0171475d7 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Fri, 15 Jul 2022 04:37:05 +0700 Subject: [PATCH] Change to use `UnrealAPI` from `_server` --- .../FixAmmoSelling/FixAmmoSelling_Feature.uc | 8 ++--- sources/FixDoshSpam/FixDoshSpam_Feature.uc | 14 ++++----- .../FixDualiesCost/FixDualiesCost_Feature.uc | 22 +++++++------- sources/FixFFHack/FixFFHack_Feature.uc | 6 ++-- .../FixInfiniteNades_Feature.uc | 12 ++++---- .../FixInventoryAbuse_Feature.uc | 2 +- sources/FixLogSpam/SpamPickup/HelperPickup.uc | 29 +++++++++++-------- sources/FixLogSpam/SpamTrader/HelperTrader.uc | 8 ++--- sources/FixPipes/FixPipes_Feature.uc | 12 ++++---- .../FixProjectileFF_Feature.uc | 6 ++-- .../FixSpectatorCrash_Feature.uc | 14 ++++----- .../FixZedTimeLags/FixZedTimeLags_Feature.uc | 10 +++---- 12 files changed, 74 insertions(+), 69 deletions(-) diff --git a/sources/FixAmmoSelling/FixAmmoSelling_Feature.uc b/sources/FixAmmoSelling/FixAmmoSelling_Feature.uc index 4d0f4e7..043f066 100644 --- a/sources/FixAmmoSelling/FixAmmoSelling_Feature.uc +++ b/sources/FixAmmoSelling/FixAmmoSelling_Feature.uc @@ -135,8 +135,8 @@ protected function OnEnabled() local LevelInfo level; local KFWeapon nextWeapon; local KFAmmoPickup nextPickup; - level = _.unreal.GetLevel(); - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + level = _server.unreal.GetLevel(); + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; // Find all abusable weapons foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon) { FixWeapon(nextWeapon); @@ -154,8 +154,8 @@ protected function OnDisabled() local AmmoPickupStalker nextStalker; local array stalkers; local array registeredWeapons; - level = _.unreal.GetLevel(); - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); + level = _server.unreal.GetLevel(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); registeredWeapons = FixAmmoSellingService(GetService()).registeredWeapons; // Restore all the `pickupClass` variables we've changed. for (i = 0; i < registeredWeapons.length; i += 1) diff --git a/sources/FixDoshSpam/FixDoshSpam_Feature.uc b/sources/FixDoshSpam/FixDoshSpam_Feature.uc index fc12266..782e804 100644 --- a/sources/FixDoshSpam/FixDoshSpam_Feature.uc +++ b/sources/FixDoshSpam/FixDoshSpam_Feature.uc @@ -100,14 +100,14 @@ protected function OnEnabled() { local LevelInfo level; local CashPickup nextCash; - checkTimer = _.time.StartRealTimer(checkInterval, true); + checkTimer = _server.time.StartRealTimer(checkInterval, true); checkTimer.OnElapsed(self).connect = Tick; - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; - level = _.unreal.GetLevel(); + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + level = _server.unreal.GetLevel(); // Find all wads of cash laying around on the map, // so that we could accordingly limit the cash spam. foreach level.DynamicActors(class'KFMod.CashPickup', nextCash) { - wads[wads.length] = _.unreal.ActorRef(nextCash); + wads[wads.length] = _server.unreal.ActorRef(nextCash); } } @@ -120,7 +120,7 @@ protected function OnDisabled() } wads.length = 0; currentContributors.length = 0; - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); checkTimer.FreeSelf(); } @@ -220,7 +220,7 @@ public final function AddContribution(PlayerController player, CashPickup cash) { local int playerIndex; local DoshStreamPerPlayer newStreamRecord; - wads[wads.length] = _.unreal.ActorRef(cash); + wads[wads.length] = _server.unreal.ActorRef(cash); // Add contribution to player playerIndex = GetContributorIndex(player); if (playerIndex >= 0) @@ -228,7 +228,7 @@ public final function AddContribution(PlayerController player, CashPickup cash) currentContributors[playerIndex].contribution += 1.0; return; } - newStreamRecord.player = _.unreal.ActorRef(player); + newStreamRecord.player = _server.unreal.ActorRef(player); newStreamRecord.contribution = 1.0; currentContributors[currentContributors.length] = newStreamRecord; } diff --git a/sources/FixDualiesCost/FixDualiesCost_Feature.uc b/sources/FixDualiesCost/FixDualiesCost_Feature.uc index 8dc0cb1..3335ae6 100644 --- a/sources/FixDualiesCost/FixDualiesCost_Feature.uc +++ b/sources/FixDualiesCost/FixDualiesCost_Feature.uc @@ -153,10 +153,10 @@ protected function OnEnabled() { local LevelInfo level; local KFWeapon nextWeapon; - _.unreal.OnTick(self).connect = Tick; - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; - _.unreal.gameRules.OnOverridePickupQuery(self).connect = PickupQuery; - level = _.unreal.GetLevel(); + _server.unreal.OnTick(self).connect = Tick; + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + _server.unreal.gameRules.OnOverridePickupQuery(self).connect = PickupQuery; + level = _server.unreal.GetLevel(); // Find all weapons, that spawned when this fix wasn't running. foreach level.DynamicActors(class'KFMod.KFWeapon', nextWeapon) { RegisterSinglePistol(nextWeapon, false); @@ -166,9 +166,9 @@ protected function OnEnabled() protected function OnDisabled() { local int i; - _.unreal.OnTick(self).Disconnect(); - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); - _.unreal.gameRules.OnOverridePickupQuery(self).Disconnect(); + _server.unreal.OnTick(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.gameRules.OnOverridePickupQuery(self).Disconnect(); for (i = 0; i < storedValues.length; i += 1) { storedValues[i].reference.FreeSelf(); @@ -302,9 +302,9 @@ public final function RegisterSinglePistol( if (singlePistol == none) return; if (GetIndexAs(singlePistol, true) < 0) return; - newRecord.reference = _.unreal.ActorRef(singlePistol); + newRecord.reference = _server.unreal.ActorRef(singlePistol); newRecord.class = singlePistol.class; - newRecord.owner = _.unreal.ActorRef(singlePistol.instigator); + newRecord.owner = _server.unreal.ActorRef(singlePistol.instigator); if (justSpawned) { newRecord.value = nextSellValue; } @@ -362,7 +362,7 @@ public final function FixCostAfterBuying(KFWeapon dualPistols) // `dualPistols` will be the new pair of pistols, but it's value will // get overwritten by vanilla's code after this function. // So we must add it to pending values to be changed later. - newPendingValue.weapon = _.unreal.ActorRef(dualPistols); + newPendingValue.weapon = _server.unreal.ActorRef(dualPistols); if (dualPistols.class == class'KFMod.Dualies') { // 9mm is an exception. @@ -417,7 +417,7 @@ public final function FixCostAfterPickUp(KFWeapon dualPistols) if (storedValues[i].class != dualiesClasses[index].single) continue; if (storedValues[i].owner.Get() != dualPistols.instigator) continue; - newPendingValue.weapon = _.unreal.ActorRef(dualPistols); + newPendingValue.weapon = _server.unreal.ActorRef(dualPistols); newPendingValue.value = storedValues[i].value + nextSellValue; pendingValues[pendingValues.length] = newPendingValue; break; diff --git a/sources/FixFFHack/FixFFHack_Feature.uc b/sources/FixFFHack/FixFFHack_Feature.uc index 608acea..38f55b2 100644 --- a/sources/FixFFHack/FixFFHack_Feature.uc +++ b/sources/FixFFHack/FixFFHack_Feature.uc @@ -59,12 +59,12 @@ var private /*config*/ array< class > neverScale; protected function OnEnabled() { - _.unreal.gameRules.OnNetDamage(self).connect = NetDamage; + _server.unreal.gameRules.OnNetDamage(self).connect = NetDamage; } protected function OnDisabled() { - _.unreal.gameRules.OnNetDamage(self).Disconnect(); + _server.unreal.gameRules.OnNetDamage(self).Disconnect(); } protected function SwapConfig(FeatureConfig config) @@ -99,7 +99,7 @@ function int NetDamage( { // Remove pushback to avoid environmental kills momentum = Vect(0.0, 0.0, 0.0); - damage *= _.unreal.GetKFGameType().friendlyFireScale; + damage *= _server.unreal.GetKFGameType().friendlyFireScale; } } return damage; diff --git a/sources/FixInfiniteNades/FixInfiniteNades_Feature.uc b/sources/FixInfiniteNades/FixInfiniteNades_Feature.uc index af90ebb..8e1a92e 100644 --- a/sources/FixInfiniteNades/FixInfiniteNades_Feature.uc +++ b/sources/FixInfiniteNades/FixInfiniteNades_Feature.uc @@ -67,9 +67,9 @@ protected function OnEnabled() { local Frag nextFrag; local LevelInfo level; - level = _.unreal.GetLevel(); - _.unreal.OnTick(self).connect = Tick; - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + level = _server.unreal.GetLevel(); + _server.unreal.OnTick(self).connect = Tick; + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; shuttingDown = false; // Find all frags, that spawned when this fix wasn't running. foreach level.DynamicActors(class'KFMod.Frag', nextFrag) { @@ -80,8 +80,8 @@ protected function OnEnabled() protected function OnDisabled() { - _.unreal.OnTick(self).Disconnect(); - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.OnTick(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); shuttingDown = true; RecreateFrags(); ammoRecords.length = 0; @@ -198,7 +198,7 @@ public final function RegisterFrag(Frag newFrag) index = GetAmmoIndex(newFrag); if (index >= 0) return; - newRecord.fragReference = _.unreal.ActorRef(newFrag); + newRecord.fragReference = _server.unreal.ActorRef(newFrag); newRecord.amount = GetFragAmmo(newFrag); ammoRecords[ammoRecords.length] = newRecord; } diff --git a/sources/FixInventoryAbuse/FixInventoryAbuse_Feature.uc b/sources/FixInventoryAbuse/FixInventoryAbuse_Feature.uc index b277302..a8f5ca5 100644 --- a/sources/FixInventoryAbuse/FixInventoryAbuse_Feature.uc +++ b/sources/FixInventoryAbuse/FixInventoryAbuse_Feature.uc @@ -53,7 +53,7 @@ protected function OnEnabled() if (actualInterval <= 0) { actualInterval = 0.25; } - checkTimer = _.time.StartTimer(actualInterval, true); + checkTimer = _server.time.StartTimer(actualInterval, true); checkTimer.OnElapsed(self).connect = Timer; } diff --git a/sources/FixLogSpam/SpamPickup/HelperPickup.uc b/sources/FixLogSpam/SpamPickup/HelperPickup.uc index 82e84b9..77c9998 100644 --- a/sources/FixLogSpam/SpamPickup/HelperPickup.uc +++ b/sources/FixLogSpam/SpamPickup/HelperPickup.uc @@ -87,20 +87,22 @@ protected function Constructor() } // To detect when player tries to pick something up // (and force additional pickup fix update) - _.unreal.gameRules.OnOverridePickupQuery(self).connect = PickupQuery; + _server.unreal.gameRules.OnOverridePickupQuery(self).connect = PickupQuery; // To detect newly spawned pickups - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; // For updating pickups as soon as possible - _.unreal.OnTick(self).connect = Tick; + _server.unreal.OnTick(self).connect = Tick; // Find all `KFWeaponPickup`s laying around on the map, // so that we can fix preexisting ones too. // But add them to pending list in a freaky case this `HealperPickup` // was created during one's initialization. This will give it time to // set up variables that distinguish dropped pickup from another // kind of pickup. - level = _.unreal.GetLevel(); - foreach level.DynamicActors(class'KFMod.KFWeaponPickup', nextPickup) { - pendingPickups[pendingPickups.length] = _.unreal.ActorRef(nextPickup); + level = _server.unreal.GetLevel(); + foreach level.DynamicActors(class'KFMod.KFWeaponPickup', nextPickup) + { + pendingPickups[pendingPickups.length] = + _server.unreal.ActorRef(nextPickup); } } @@ -119,9 +121,9 @@ protected function Finalizer() _.memory.FreeMany(pendingPickups); recordedPickups.length = 0; pendingPickups.length = 0; - _.unreal.gameRules.OnOverridePickupQuery(self).Disconnect(); - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); - _.unreal.OnTick(self).Disconnect(); + _server.unreal.gameRules.OnOverridePickupQuery(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.OnTick(self).Disconnect(); } function bool PickupQuery( @@ -209,10 +211,13 @@ public final function HandlePickup(KFWeaponPickup newPickup) if (newPickup.instigator != none) { newPickup.Disable('Destroyed'); - recordedPickups[recordedPickups.length] = _.unreal.ActorRef(newPickup); + recordedPickups[recordedPickups.length] = + _server.unreal.ActorRef(newPickup); } - else { - pendingPickups[pendingPickups.length] = _.unreal.ActorRef(newPickup); + else + { + pendingPickups[pendingPickups.length] = + _server.unreal.ActorRef(newPickup); } } diff --git a/sources/FixLogSpam/SpamTrader/HelperTrader.uc b/sources/FixLogSpam/SpamTrader/HelperTrader.uc index b95e3cf..0171df0 100644 --- a/sources/FixLogSpam/SpamTrader/HelperTrader.uc +++ b/sources/FixLogSpam/SpamTrader/HelperTrader.uc @@ -63,7 +63,7 @@ protected function Constructor() local LevelInfo level; local ShopVolume nextShop; local WeaponLocker replacementLocker; - level = _.unreal.GetLevel(); + level = _server.unreal.GetLevel(); // Get locker replacementLocker = SpawnDummyWeaponLocker(); if (replacementLocker == none) { @@ -81,7 +81,7 @@ protected function Constructor() if (nextShop == none) continue; if (nextShop.myTrader != none) continue; nextShop.myTrader = replacementLocker; - fixedShops[fixedShops.length] = _.unreal.ActorRef(nextShop); + fixedShops[fixedShops.length] = _server.unreal.ActorRef(nextShop); } } @@ -133,7 +133,7 @@ private final function WeaponLocker SpawnDummyWeaponLocker() lockerInstance.SetDrawType(DT_None); lockerInstance.SetCollision(false); } - dummyLocker = _.unreal.ActorRef(lockerInstance); + dummyLocker = _server.unreal.ActorRef(lockerInstance); return lockerInstance; } @@ -141,7 +141,7 @@ private final function WeaponLocker FindExistingWeaponLocker() { local LevelInfo level; local WeaponLocker nextLocker; - level = _.unreal.GetLevel(); + level = _server.unreal.GetLevel(); foreach level.DynamicActors(class'KFMod.WeaponLocker', nextLocker) { if (nextLocker != none) { diff --git a/sources/FixPipes/FixPipes_Feature.uc b/sources/FixPipes/FixPipes_Feature.uc index 2a3212a..268f22d 100644 --- a/sources/FixPipes/FixPipes_Feature.uc +++ b/sources/FixPipes/FixPipes_Feature.uc @@ -130,13 +130,13 @@ protected function OnEnabled() local PipeBombProjectile nextPipe; pipesRelevancyFlag = class'PipeBombProjectile'.default.bAlwaysRelevant; class'PipeBombProjectile'.default.bGameRelevant = false; - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; // Set cleanup timer, there is little point to making // clean up interval configurable. - cleanupTimer = _.time.StartTimer(5.0, true); + cleanupTimer = _server.time.StartTimer(5.0, true); cleanupTimer.OnElapsed(self).connect = CleanPipeRecords; // Fix pipes that are already lying about on the map - level = _.unreal.GetLevel(); + level = _server.unreal.GetLevel(); foreach level.DynamicActors(class'KFMod.PipeBombProjectile', nextPipe) { RegisterPipe(nextPipe); } @@ -146,7 +146,7 @@ protected function OnDisabled() { local int i; class'PipeBombProjectile'.default.bGameRelevant = pipesRelevancyFlag; - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); cleanupTimer.FreeSelf(); for (i = 0; i < pipeRecords.length; i += 1) { ReleasePipe(pipeRecords[i]); @@ -200,12 +200,12 @@ public final function RegisterPipe(PipeBombProjectile newPipe) return; } } - newRecord.pipe = _.unreal.ActorRef(newPipe); + newRecord.pipe = _server.unreal.ActorRef(newPipe); // Setup `PipesSafetyCollision` for catching `TakeDamage()` events // (only if we need to according to settings) if (NeedSafetyCollision()) { - newRecord.safetyCollision = _.unreal.ActorRef( + newRecord.safetyCollision = _server.unreal.ActorRef( class'PipesSafetyCollision'.static.ProtectPipes(newPipe)); } pipeRecords[pipeRecords.length] = newRecord; diff --git a/sources/FixProjectileFF/FixProjectileFF_Feature.uc b/sources/FixProjectileFF/FixProjectileFF_Feature.uc index b9bf80f..684d822 100644 --- a/sources/FixProjectileFF/FixProjectileFF_Feature.uc +++ b/sources/FixProjectileFF/FixProjectileFF_Feature.uc @@ -97,7 +97,7 @@ protected function OnEnabled() rules[i].relevancyFlag = rules[i].vulnerableClass.default.bGameRelevant; rules[i].vulnerableClass.default.bGameRelevant = false; } - _.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; + _server.unreal.mutator.OnCheckReplacement(self).connect = CheckReplacement; } protected function OnDisabled() @@ -109,7 +109,7 @@ protected function OnDisabled() if (rules[i].protectedClass == none) continue; rules[i].vulnerableClass.default.bGameRelevant = rules[i].relevancyFlag; } - _.unreal.mutator.OnCheckReplacement(self).Disconnect(); + _server.unreal.mutator.OnCheckReplacement(self).Disconnect(); } protected function SwapConfig(FeatureConfig config) @@ -291,7 +291,7 @@ public static final function bool IsFriendlyFireAcceptable() if (default.ignoreFriendlyFire) { return false; } - return __().unreal.GetKFGameType().friendlyFireScale > 0; + return __server().unreal.GetKFGameType().friendlyFireScale > 0; } defaultproperties diff --git a/sources/FixSpectatorCrash/FixSpectatorCrash_Feature.uc b/sources/FixSpectatorCrash/FixSpectatorCrash_Feature.uc index e253958..1f82915 100644 --- a/sources/FixSpectatorCrash/FixSpectatorCrash_Feature.uc +++ b/sources/FixSpectatorCrash/FixSpectatorCrash_Feature.uc @@ -102,14 +102,14 @@ var private const int becomeSpectatorID; protected function OnEnabled() { - _.unreal.OnTick(self).connect = Tick; - _.unreal.broadcasts.OnHandleLocalized(self).connect = HandleLocalized; + _server.unreal.OnTick(self).connect = Tick; + _server.unreal.broadcasts.OnHandleLocalized(self).connect = HandleLocalized; } protected function OnDisabled() { - _.unreal.OnTick(self).Disconnect(); - _.unreal.broadcasts.OnHandleLocalized(self).Disconnect(); + _server.unreal.OnTick(self).Disconnect(); + _server.unreal.broadcasts.OnHandleLocalized(self).Disconnect(); } protected function SwapConfig(FeatureConfig config) @@ -207,7 +207,7 @@ public final function NotifyStatusChange(PlayerController player) // or didn't recently change their status (put them on cooldown). else if (!IsViolator(player)) { - newRecord.player = _.unreal.ActorRef(player); + newRecord.player = _server.unreal.ActorRef(player); newRecord.cooldown = spectatorChangeTimeout; currentCooldowns[currentCooldowns.length] = newRecord; } @@ -223,7 +223,7 @@ private final function SetBlock(bool activateBlock) if (activateBlock == becomingActiveBlocked) return; // Actually block/unblock - kfGameType = _.unreal.GetKFGameType(); + kfGameType = _server.unreal.GetKFGameType(); becomingActiveBlocked = activateBlock; if (activateBlock) { @@ -296,7 +296,7 @@ private final function int GetRealPlayers() // (difference will be equal to the amount of faked players). private final function int GetNumPlayersMod() { - return _.unreal.GetKFGameType().numPlayers - GetRealPlayers(); + return _server.unreal.GetKFGameType().numPlayers - GetRealPlayers(); } private final function ReduceCooldowns(float timePassed) diff --git a/sources/FixZedTimeLags/FixZedTimeLags_Feature.uc b/sources/FixZedTimeLags/FixZedTimeLags_Feature.uc index c0ada7b..c4cb062 100644 --- a/sources/FixZedTimeLags/FixZedTimeLags_Feature.uc +++ b/sources/FixZedTimeLags/FixZedTimeLags_Feature.uc @@ -66,17 +66,17 @@ var private float updateCooldown; protected function OnEnabled() { if (disableTick) { - _.unreal.GetGameType().Disable('Tick'); + _server.unreal.GetGameType().Disable('Tick'); } - _.unreal.OnTick(self).connect = Tick; + _server.unreal.OnTick(self).connect = Tick; } protected function OnDisabled() { if (disableTick) { - _.unreal.GetGameType().Enable('Tick'); + _server.unreal.GetGameType().Enable('Tick'); } - _.unreal.OnTick(self).Disconnect(); + _server.unreal.OnTick(self).Disconnect(); } protected function SwapConfig(FeatureConfig config) @@ -94,7 +94,7 @@ private function Tick(float delta, float timeDilationCoefficient) { local KFGameType gameType; local float trueTimePassed; - gameType = _.unreal.GetKFGameType(); + gameType = _server.unreal.GetKFGameType(); if (!gameType.bZEDTimeActive) return; // Unfortunately we need to keep disabling `Tick()` probe function, // because it constantly gets enabled back and I don't know where