add short alias for mutator

This commit is contained in:
GenZmeY 2023-12-31 23:36:23 +03:00
parent 98604ab176
commit dde4c9aa93
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39
3 changed files with 56 additions and 55 deletions

View File

@ -21,7 +21,7 @@ No. This mod is not whitelisted and will unrank your server. Any XP gained will
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (`) and input: [*]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) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
[/olist] [/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): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2521731447[/b] [b]ServerSubscribedWorkshopItems=2521731447[/b]
[*]Start the server and wait while the mutator is downloading; [*]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] [/olist]
[h1]Mutator setup[/h1] [h1]Mutator setup[/h1]

53
StartWave/Classes/Mut.uc Normal file
View File

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

View File

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