fix style

This commit is contained in:
GenZmeY 2023-05-14 04:10:08 +03:00
parent 176e2b7fd8
commit 762499ace1
10 changed files with 167 additions and 167 deletions

View File

@ -19,58 +19,58 @@ var private config E_LogLevel LogLevel;
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
{ {
`Log_Trace(); `Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy()); return (bPendingDelete || bDeleteMe || Destroy());
} }
public event PreBeginPlay() public event PreBeginPlay()
{ {
`Log_Trace(); `Log_Trace();
if (WorldInfo.NetMode == NM_Client) if (WorldInfo.NetMode == NM_Client)
{ {
`Log_Fatal("NetMode:" @ WorldInfo.NetMode); `Log_Fatal("NetMode:" @ WorldInfo.NetMode);
SafeDestroy(); SafeDestroy();
return; return;
} }
Super.PreBeginPlay(); Super.PreBeginPlay();
Init(); Init();
} }
private function Init() private function Init()
{ {
`Log_Trace(); `Log_Trace();
if (Version == `NO_CONFIG) if (Version == `NO_CONFIG)
{ {
LogLevel = LL_Info; LogLevel = LL_Info;
SaveConfig(); SaveConfig();
} }
CfgLifespan.static.InitConfig(Version, LatestVersion, LogLevel); CfgLifespan.static.InitConfig(Version, LatestVersion, LogLevel);
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
`Log_Info("Config created"); `Log_Info("Config created");
case MaxInt: case MaxInt:
`Log_Info("Config updated to version" @ LatestVersion); `Log_Info("Config updated to version" @ LatestVersion);
break; break;
case LatestVersion: case LatestVersion:
`Log_Info("Config is up-to-date"); `Log_Info("Config is up-to-date");
break; break;
default: default:
`Log_Warn("The config version is higher than the current version (are you using an old mutator?)"); `Log_Warn("The config version is higher than the current version (are you using an old mutator?)");
`Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion); `Log_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
`Log_Warn("The config version will be changed to" @ LatestVersion); `Log_Warn("The config version will be changed to" @ LatestVersion);
break; break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
Version = LatestVersion; Version = LatestVersion;
@ -84,16 +84,16 @@ private function Init()
SaveConfig(); SaveConfig();
} }
`Log_Base("LogLevel:" @ LogLevel); `Log_Base("LogLevel:" @ LogLevel);
CfgLifespan.static.Load(LogLevel); CfgLifespan.static.Load(LogLevel);
`Log_Info("Initialized"); `Log_Info("Initialized");
} }
public function ModifyLifespan(Actor A) public function ModifyLifespan(Actor A)
{ {
`Log_Trace(); `Log_Trace();
switch (PickupType(A)) switch (PickupType(A))
{ {
case PT_Dosh: case PT_Dosh:
@ -107,7 +107,7 @@ public function ModifyLifespan(Actor A)
`Log_Debug("Skip modify dosh lifespan"); `Log_Debug("Skip modify dosh lifespan");
} }
break; break;
case PT_Weapon: case PT_Weapon:
if (CfgLifespan.default.Weap > 0) if (CfgLifespan.default.Weap > 0)
{ {
@ -119,7 +119,7 @@ public function ModifyLifespan(Actor A)
`Log_Debug("Skip modify weapon lifespan"); `Log_Debug("Skip modify weapon lifespan");
} }
break; break;
case PT_Carryable: case PT_Carryable:
case PT_NotPickup: case PT_NotPickup:
default: default:
@ -130,7 +130,7 @@ public function ModifyLifespan(Actor A)
private function E_PickupType PickupType(Actor A) private function E_PickupType PickupType(Actor A)
{ {
`Log_Trace(); `Log_Trace();
if (KFDroppedPickup_Cash(A) != None) if (KFDroppedPickup_Cash(A) != None)
{ {
return PT_Dosh; return PT_Dosh;
@ -143,7 +143,7 @@ private function E_PickupType PickupType(Actor A)
{ {
return PT_Weapon; return PT_Weapon;
} }
return PT_NotPickup; return PT_NotPickup;
} }

View File

@ -1,4 +1,4 @@
[Flags] [Flags]
AllowDownload=False AllowDownload=False
ClientOptional=False ClientOptional=False
ServerSideOnly=True ServerSideOnly=True

View File

@ -1,59 +1,59 @@
class DPLMut extends KFMutator; class DPLMut extends KFMutator;
var private DPL DPL; var private DPL DPL;
public simulated function bool SafeDestroy() public simulated function bool SafeDestroy()
{ {
return (bPendingDelete || bDeleteMe || Destroy()); return (bPendingDelete || bDeleteMe || Destroy());
} }
public event PreBeginPlay() public event PreBeginPlay()
{ {
Super.PreBeginPlay(); Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return; if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'DPL', DPL) foreach WorldInfo.DynamicActors(class'DPL', DPL)
{ {
break; break;
} }
if (DPL == None) if (DPL == None)
{ {
DPL = WorldInfo.Spawn(class'DPL'); DPL = WorldInfo.Spawn(class'DPL');
} }
if (DPL == None) if (DPL == None)
{ {
`Log_Base("FATAL: Can't Spawn 'DPL'"); `Log_Base("FATAL: Can't Spawn 'DPL'");
SafeDestroy(); SafeDestroy();
} }
} }
public function AddMutator(Mutator Mut) public function AddMutator(Mutator Mut)
{ {
if (Mut == Self) return; if (Mut == Self) return;
if (Mut.Class == Class) if (Mut.Class == Class)
Mut.Destroy(); Mut.Destroy();
else else
Super.AddMutator(Mut); Super.AddMutator(Mut);
} }
public function bool CheckRelevance(Actor A) public function bool CheckRelevance(Actor A)
{ {
local bool Relevance; local bool Relevance;
Relevance = Super.CheckRelevance(A); Relevance = Super.CheckRelevance(A);
if (Relevance) if (Relevance)
{ {
DPL.ModifyLifespan(A); DPL.ModifyLifespan(A);
} }
return Relevance; return Relevance;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,42 +1,42 @@
class Lifespan extends Object class Lifespan extends Object
config(DPL) config(DPL)
abstract; abstract;
var public config int Weap; var public config int Weap;
var public config int Dosh; var public config int Dosh;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
public static function Load(E_LogLevel LogLevel) public static function Load(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
} }
protected static function ApplyDefault(E_LogLevel LogLevel) protected static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.Weap = int(class'KFDroppedPickup'.default.Lifespan); default.Weap = int(class'KFDroppedPickup'.default.Lifespan);
default.Dosh = int(class'KFDroppedPickup_Cash'.default.Lifespan); default.Dosh = int(class'KFDroppedPickup_Cash'.default.Lifespan);
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,20 +1,20 @@
class _Logger extends Object class _Logger extends Object
abstract; abstract;
enum E_LogLevel enum E_LogLevel
{ {
LL_WrongLevel, LL_WrongLevel,
LL_None, LL_None,
LL_Fatal, LL_Fatal,
LL_Error, LL_Error,
LL_Warning, LL_Warning,
LL_Info, LL_Info,
LL_Debug, LL_Debug,
LL_Trace, LL_Trace,
LL_All LL_All
}; };
defaultproperties defaultproperties
{ {
} }

View File

@ -1,2 +1,2 @@
// Constants // Constants
`define NO_CONFIG 0 `define NO_CONFIG 0

View File

@ -1,3 +1,3 @@
// Imports // Imports
`include(Logger.uci) `include(Logger.uci)
`include(Constants.uci) `include(Constants.uci)

View File

@ -1,15 +1,15 @@
// Logger // Logger
`define Log_Tag 'DPL' `define Log_Tag 'DPL'
`define LocationStatic "`{ClassName}::" $ GetFuncName() `define LocationStatic "`{ClassName}::" $ GetFuncName()
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag) `define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag) `define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag)
`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag) `define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag) `define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag)
`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag) `define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag)
`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag) `define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag)
`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)

View File

@ -12,7 +12,7 @@ https://forums.tripwireinteractive.com/index.php?threads/whitelisting-mods-and-m
[h1]Usage (single player)[/h1] [h1]Usage (single player)[/h1]
[olist] [olist]
[*]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=DPL.DPLMut[/b] [b]open KF-BioticsLab?Mutator=DPL.DPLMut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)

View File

@ -7,7 +7,7 @@ StripSource="True"
# Mutators to be compiled # Mutators to be compiled
# Specify them with a space as a separator, # Specify them with a space as a separator,
# Mutators will be compiled in the specified order # Mutators will be compiled in the specified order
PackageBuildOrder="DPL" PackageBuildOrder="DPL"
@ -16,7 +16,7 @@ PackageBuildOrder="DPL"
# Packages you want to brew using @peelz's patched KFEditor. # Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package. # Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackagePeelzBrew="" PackagePeelzBrew=""
@ -24,7 +24,7 @@ PackagePeelzBrew=""
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackageUpload="DPL" PackageUpload="DPL"