From 1f6de98e2fb46a9535752cafd1c0dab4d89e5437 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 31 Dec 2023 23:13:28 +0300 Subject: [PATCH] add short alias for mutator --- CVC/Classes/CVCMut.uc | 61 +----------------------------- CVC/Classes/Mut.uc | 60 +++++++++++++++++++++++++++++ PublicationContent/description.txt | 2 +- 3 files changed, 62 insertions(+), 61 deletions(-) create mode 100644 CVC/Classes/Mut.uc diff --git a/CVC/Classes/CVCMut.uc b/CVC/Classes/CVCMut.uc index fee7a24..05ab16a 100644 --- a/CVC/Classes/CVCMut.uc +++ b/CVC/Classes/CVCMut.uc @@ -1,60 +1 @@ -class CVCMut extends KFMutator; - -var private CVC CVC; - -public simulated function bool SafeDestroy() -{ - return (bPendingDelete || bDeleteMe || Destroy()); -} - -public event PreBeginPlay() -{ - Super.PreBeginPlay(); - - if (WorldInfo.NetMode == NM_Client) return; - - foreach WorldInfo.DynamicActors(class'CVC', CVC) - { - break; - } - - if (CVC == None) - { - CVC = WorldInfo.Spawn(class'CVC'); - } - - if (CVC == None) - { - `Log_Base("FATAL: Can't Spawn 'CVC'"); - SafeDestroy(); - } -} - -public function AddMutator(Mutator Mut) -{ - if (Mut == Self) return; - - if (Mut.Class == Class) - CVCMut(Mut).SafeDestroy(); - else - Super.AddMutator(Mut); -} - -public function NotifyLogin(Controller C) -{ - Super.NotifyLogin(C); - - CVC.NotifyLogin(C); -} - -public function NotifyLogout(Controller C) -{ - Super.NotifyLogout(C); - - CVC.NotifyLogout(C); -} - -defaultproperties -{ - GroupNames.Add("VoteCollector") -} \ No newline at end of file +class CVCMut extends Mut; // backward compatibility diff --git a/CVC/Classes/Mut.uc b/CVC/Classes/Mut.uc new file mode 100644 index 0000000..5f7a925 --- /dev/null +++ b/CVC/Classes/Mut.uc @@ -0,0 +1,60 @@ +class Mut extends KFMutator; + +var private CVC CVC; + +public simulated function bool SafeDestroy() +{ + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public event PreBeginPlay() +{ + Super.PreBeginPlay(); + + if (WorldInfo.NetMode == NM_Client) return; + + foreach WorldInfo.DynamicActors(class'CVC', CVC) + { + break; + } + + if (CVC == None) + { + CVC = WorldInfo.Spawn(class'CVC'); + } + + if (CVC == None) + { + `Log_Base("FATAL: Can't Spawn 'CVC'"); + SafeDestroy(); + } +} + +public function AddMutator(Mutator M) +{ + if (M == Self) return; + + if (M.Class == Class) + Mut(M).SafeDestroy(); + else + Super.AddMutator(M); +} + +public function NotifyLogin(Controller C) +{ + Super.NotifyLogin(C); + + CVC.NotifyLogin(C); +} + +public function NotifyLogout(Controller C) +{ + Super.NotifyLogout(C); + + CVC.NotifyLogout(C); +} + +defaultproperties +{ + GroupNames.Add("VoteCollector") +} \ No newline at end of file diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index bbe22ab..2a52722 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -31,7 +31,7 @@ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-m [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist): [b]ServerSubscribedWorkshopItems=2847465899[/b] [*]Start the server and wait until the mutator is downloading; -[*]Add mutator to server start parameters: [b]?Mutator=CVC.CVCMut[/b] and restart the server. +[*]Add mutator to server start parameters: [b]?Mutator=CVC.Mut[/b] and restart the server. [/olist] [h1]Setup (KFCVC.ini)[/h1]