add short alias for mutator

This commit is contained in:
GenZmeY 2023-12-31 23:26:19 +03:00
parent c83ab7055d
commit e72a9ad77b
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39
3 changed files with 62 additions and 61 deletions

View File

@ -1,59 +1 @@
class DPLMut extends KFMutator; class DPLMut extends Mut; // backward compatibility
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
{
}

59
DPL/Classes/Mut.uc Normal file
View File

@ -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
{
}

View File

@ -14,7 +14,7 @@ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-m
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (~) and input: [*]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) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
[/olist] [/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): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2864944858[/b] [b]ServerSubscribedWorkshopItems=2864944858[/b]
[*]Start the server and wait while the mutator is downloading; [*]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] [/olist]
[h1]Important setup information[/h1] [h1]Important setup information[/h1]