From e72a9ad77bd7c57be3f12db3cc918fd31e4919c1 Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 31 Dec 2023 23:26:19 +0300 Subject: [PATCH] add short alias for mutator --- DPL/Classes/DPLMut.uc | 60 +----------------------------- DPL/Classes/Mut.uc | 59 +++++++++++++++++++++++++++++ PublicationContent/description.txt | 4 +- 3 files changed, 62 insertions(+), 61 deletions(-) create mode 100644 DPL/Classes/Mut.uc diff --git a/DPL/Classes/DPLMut.uc b/DPL/Classes/DPLMut.uc index 7c1ce45..a6e68e4 100644 --- a/DPL/Classes/DPLMut.uc +++ b/DPL/Classes/DPLMut.uc @@ -1,59 +1 @@ -class DPLMut extends KFMutator; - -var private DPL DPL; - -public simulated function bool SafeDestroy() -{ - return (bPendingDelete || bDeleteMe || Destroy()); -} - -public event PreBeginPlay() -{ - Super.PreBeginPlay(); - - if (WorldInfo.NetMode == NM_Client) return; - - foreach WorldInfo.DynamicActors(class'DPL', DPL) - { - break; - } - - if (DPL == None) - { - DPL = WorldInfo.Spawn(class'DPL'); - } - - if (DPL == None) - { - `Log_Base("FATAL: Can't Spawn 'DPL'"); - SafeDestroy(); - } -} - -public function AddMutator(Mutator Mut) -{ - if (Mut == Self) return; - - if (Mut.Class == Class) - DPLMut(Mut).SafeDestroy(); - else - Super.AddMutator(Mut); -} - -public function bool CheckRelevance(Actor A) -{ - local bool Relevance; - - Relevance = Super.CheckRelevance(A); - if (Relevance) - { - DPL.ModifyLifespan(A); - } - - return Relevance; -} - -defaultproperties -{ - -} +class DPLMut extends Mut; // backward compatibility diff --git a/DPL/Classes/Mut.uc b/DPL/Classes/Mut.uc new file mode 100644 index 0000000..71b63c5 --- /dev/null +++ b/DPL/Classes/Mut.uc @@ -0,0 +1,59 @@ +class Mut extends KFMutator; + +var private DPL DPL; + +public simulated function bool SafeDestroy() +{ + return (bPendingDelete || bDeleteMe || Destroy()); +} + +public event PreBeginPlay() +{ + Super.PreBeginPlay(); + + if (WorldInfo.NetMode == NM_Client) return; + + foreach WorldInfo.DynamicActors(class'DPL', DPL) + { + break; + } + + if (DPL == None) + { + DPL = WorldInfo.Spawn(class'DPL'); + } + + if (DPL == None) + { + `Log_Base("FATAL: Can't Spawn 'DPL'"); + SafeDestroy(); + } +} + +public function AddMutator(Mutator M) +{ + if (M == Self) return; + + if (M.Class == Class) + Mut(M).SafeDestroy(); + else + Super.AddMutator(M); +} + +public function bool CheckRelevance(Actor A) +{ + local bool Relevance; + + Relevance = Super.CheckRelevance(A); + if (Relevance) + { + DPL.ModifyLifespan(A); + } + + return Relevance; +} + +defaultproperties +{ + +} diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 8e3e1ab..55e28a4 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -14,7 +14,7 @@ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-m [*]Subscribe to this mutator; [*]Start KF2; [*]Open console (~) and input: -[b]open KF-BioticsLab?Mutator=DPL.DPLMut[/b] +[b]open KF-BioticsLab?Mutator=DPL.Mut[/b] (replace the map and add the parameters you need) [*]. [/olist] @@ -28,7 +28,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=2864944858[/b] [*]Start the server and wait while the mutator is downloading; -[*]Add mutator to server start parameters: [b]?Mutator=DPL.DPLMut[/b] and restart the server. +[*]Add mutator to server start parameters: [b]?Mutator=DPL.Mut[/b] and restart the server. [/olist] [h1]Important setup information[/h1]