Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add short alias for mutator #14

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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