From dde4c9aa93ba65105ac175425ed15eca518c1d27 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 31 Dec 2023 23:36:23 +0300 Subject: [PATCH] add short alias for mutator --- PublicationContent/description.txt | 4 +-- StartWave/Classes/Mut.uc | 53 +++++++++++++++++++++++++++++ StartWave/Classes/StartWaveMut.uc | 54 +----------------------------- 3 files changed, 56 insertions(+), 55 deletions(-) create mode 100644 StartWave/Classes/Mut.uc diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 29d83dd..88ee980 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -21,7 +21,7 @@ No. This mod is not whitelisted and will unrank your server. Any XP gained will [*]Subscribe to this mutator; [*]Start KF2; [*]Open console (`) and input: -[b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWaveMut[/b] +[b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.Mut[/b] (replace the map and add the parameters you need) [*]. [/olist] @@ -36,7 +36,7 @@ No. This mod is not whitelisted and will unrank your server. Any XP gained will [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist): [b]ServerSubscribedWorkshopItems=2521731447[/b] [*]Start the server and wait while the mutator is downloading; -[*]Add mutator (with parameters you need) to server start parameters: [b]?Mutator=StartWave.StartWaveMut[/b] and restart the server. +[*]Add mutator (with parameters you need) to server start parameters: [b]?Mutator=StartWave.Mut[/b] and restart the server. [/olist] [h1]Mutator setup[/h1] diff --git a/StartWave/Classes/Mut.uc b/StartWave/Classes/Mut.uc new file mode 100644 index 0000000..ad4493e --- /dev/null +++ b/StartWave/Classes/Mut.uc @@ -0,0 +1,53 @@ +class Mut extends KFMutator; + +var private StartWave StartWave; + +public simulated function bool SafeDestroy() +{ + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public event PreBeginPlay() +{ + Super.PreBeginPlay(); + + if (WorldInfo.NetMode == NM_Client) return; + + foreach WorldInfo.DynamicActors(class'StartWave', StartWave) + { + break; + } + + if (StartWave == None) + { + StartWave = WorldInfo.Spawn(class'StartWave'); + } + + if (StartWave == None) + { + `Log_Base("FATAL: Can't Spawn 'StartWave'"); + SafeDestroy(); + } +} + +public function AddMutator(Mutator M) +{ + if (M == Self) return; + + if (M.Class == Class) + Mut(M).SafeDestroy(); + else + Super.AddMutator(M); +} + +public function Mutate(String MutateString, PlayerController Sender) +{ + StartWave.Mutate(MutateString, Sender); + + Super.Mutate(MutateString, Sender); +} + +defaultproperties +{ + +} \ No newline at end of file diff --git a/StartWave/Classes/StartWaveMut.uc b/StartWave/Classes/StartWaveMut.uc index 420b5d2..a159235 100644 --- a/StartWave/Classes/StartWaveMut.uc +++ b/StartWave/Classes/StartWaveMut.uc @@ -1,53 +1 @@ -class StartWaveMut extends KFMutator; - -var private StartWave StartWave; - -public simulated function bool SafeDestroy() -{ - return (bPendingDelete || bDeleteMe || Destroy()); -} - -public event PreBeginPlay() -{ - Super.PreBeginPlay(); - - if (WorldInfo.NetMode == NM_Client) return; - - foreach WorldInfo.DynamicActors(class'StartWave', StartWave) - { - break; - } - - if (StartWave == None) - { - StartWave = WorldInfo.Spawn(class'StartWave'); - } - - if (StartWave == None) - { - `Log_Base("FATAL: Can't Spawn 'StartWave'"); - SafeDestroy(); - } -} - -public function AddMutator(Mutator Mut) -{ - if (Mut == Self) return; - - if (Mut.Class == Class) - StartWaveMut(Mut).SafeDestroy(); - else - Super.AddMutator(Mut); -} - -public function Mutate(String MutateString, PlayerController Sender) -{ - StartWave.Mutate(MutateString, Sender); - - Super.Mutate(MutateString, Sender); -} - -defaultproperties -{ - -} \ No newline at end of file +class StartWaveMut extends Mut; // backward compatibility