add short alias for mutator

This commit is contained in:
GenZmeY 2023-12-31 23:17:21 +03:00
parent 24911dfdec
commit f125573acb
Signed by: GenZmeY
GPG Key ID: 424DA4BC3CB2CF39
3 changed files with 63 additions and 62 deletions

View File

@ -1,60 +1 @@
class CTIMut extends KFMutator; class CTIMut extends Mut; // backward compatibility
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")
}

60
CTI/Classes/Mut.uc Normal file
View File

@ -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")
}

View File

@ -17,7 +17,7 @@ No. This mod is not whitelisted and will de-rank 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?Mutator=CTI.CTIMut[/b] [b]open KF-BioticsLab?Mutator=CTI.Mut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
[/olist] [/olist]
@ -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): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2830826239[/b] [b]ServerSubscribedWorkshopItems=2830826239[/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=CTI.CTIMut[/b] and restart the server. [*]Add mutator to server start parameters: [b]?Mutator=CTI.Mut[/b] and restart the server.
[/olist] [/olist]
[h1]Important setup information[/h1] [h1]Important setup information[/h1]