Skip to content

Commit

Permalink
Merge pull request #5 from GenZmeY/short-name
Browse files Browse the repository at this point in the history
add short alias for mutator
  • Loading branch information
GenZmeY authored Mar 8, 2024
2 parents 98604ab + dde4c9a commit 0e5701b
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 55 deletions.
4 changes: 2 additions & 2 deletions PublicationContent/description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
[*]<Enter>.
[/olist]
Expand All @@ -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]
Expand Down
53 changes: 53 additions & 0 deletions StartWave/Classes/Mut.uc
Original file line number Diff line number Diff line change
@@ -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
{

}
54 changes: 1 addition & 53 deletions StartWave/Classes/StartWaveMut.uc
Original file line number Diff line number Diff line change
@@ -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
{

}
class StartWaveMut extends Mut; // backward compatibility

0 comments on commit 0e5701b

Please sign in to comment.