Skip to content

Commit

Permalink
add short alias for mutator
Browse files Browse the repository at this point in the history
  • Loading branch information
GenZmeY committed Dec 31, 2023
1 parent 24911df commit f125573
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 62 deletions.
61 changes: 1 addition & 60 deletions CTI/Classes/CTIMut.uc
Original file line number Diff line number Diff line change
@@ -1,60 +1 @@
class CTIMut extends KFMutator;

var private CTI CTI;

public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}

public event PreBeginPlay()
{
Super.PreBeginPlay();

if (WorldInfo.NetMode == NM_Client) return;

foreach WorldInfo.DynamicActors(class'CTI', CTI)
{
break;
}

if (CTI == None)
{
CTI = WorldInfo.Spawn(class'CTI');
}

if (CTI == None)
{
`Log_Base("FATAL: Can't Spawn 'CTI'");
SafeDestroy();
}
}

public function AddMutator(Mutator Mut)
{
if (Mut == Self) return;

if (Mut.Class == Class)
CTIMut(Mut).SafeDestroy();
else
Super.AddMutator(Mut);
}

public function NotifyLogin(Controller C)
{
CTI.NotifyLogin(C);

Super.NotifyLogin(C);
}

public function NotifyLogout(Controller C)
{
CTI.NotifyLogout(C);

Super.NotifyLogout(C);
}

DefaultProperties
{
GroupNames.Add("TraderItems")
}
class CTIMut extends Mut; // backward compatibility
60 changes: 60 additions & 0 deletions CTI/Classes/Mut.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
class Mut extends KFMutator;

var private CTI CTI;

public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}

public event PreBeginPlay()
{
Super.PreBeginPlay();

if (WorldInfo.NetMode == NM_Client) return;

foreach WorldInfo.DynamicActors(class'CTI', CTI)
{
break;
}

if (CTI == None)
{
CTI = WorldInfo.Spawn(class'CTI');
}

if (CTI == None)
{
`Log_Base("FATAL: Can't Spawn 'CTI'");
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)
{
CTI.NotifyLogin(C);

Super.NotifyLogin(C);
}

public function NotifyLogout(Controller C)
{
CTI.NotifyLogout(C);

Super.NotifyLogout(C);
}

DefaultProperties
{
GroupNames.Add("TraderItems")
}
4 changes: 2 additions & 2 deletions PublicationContent/description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[*]Subscribe to this mutator;
[*]Start KF2;
[*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=CTI.CTIMut[/b]
[b]open KF-BioticsLab?Mutator=CTI.Mut[/b]
(replace the map and add the parameters you need)
[*]<Enter>.
[/olist]
Expand All @@ -31,7 +31,7 @@ No. This mod is not whitelisted and will de-rank 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=2830826239[/b]
[*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=CTI.CTIMut[/b] and restart the server.
[*]Add mutator to server start parameters: [b]?Mutator=CTI.Mut[/b] and restart the server.
[/olist]

[h1]Important setup information[/h1]
Expand Down

0 comments on commit f125573

Please sign in to comment.