refactoring

This commit is contained in:
GenZmeY 2022-07-13 09:56:35 +03:00
parent 91e199a2e1
commit c7e9087f6e
6 changed files with 25 additions and 29 deletions

View File

@ -39,9 +39,7 @@ public static function Array<class<KFPawn_Monster> > Load(E_LogLevel LogLevel)
local Array<class<KFPawn_Monster> > ZedList;
local class<KFPawn_Monster> KFPMC;
local String ZedClassTmp;
local int Line, Loaded;
Loaded = 0;
local int Line;
`ZS_Info("Load zeds to spawn at player start:");
foreach default.ZedClass(ZedClassTmp, Line)
@ -53,19 +51,18 @@ public static function Array<class<KFPawn_Monster> > Load(E_LogLevel LogLevel)
}
else
{
Loaded++;
ZedList.AddItem(KFPMC);
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp);
}
}
if (Loaded == default.ZedClass.Length)
if (ZedList.Length == default.ZedClass.Length)
{
`ZS_Info("Spawn at player start list (Zeds) loaded successfully (" $ default.ZedClass.Length @ "entries)");
}
else
{
`ZS_Info("Spawn at player start list (Zeds): loaded" @ Loaded @ "of" @ default.ZedClass.Length @ "entries");
`ZS_Info("Spawn at player start list (Zeds): loaded" @ ZedList.Length @ "of" @ default.ZedClass.Length @ "entries");
}
return ZedList;

View File

@ -61,7 +61,6 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
local S_SpawnEntry SpawnEntry;
local int Line;
local bool Errors;
local int Loaded;
`ZS_Info("Load boss waves spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line)
@ -114,19 +113,18 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
if (!Errors)
{
Loaded++;
SpawnList.AddItem(SpawnEntry);
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.BossClass $ ")" @ SpawnEntryCfg.ZedClass);
}
}
if (Loaded == default.Spawn.Length)
if (SpawnList.Length == default.Spawn.Length)
{
`ZS_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{
`ZS_Info("Boss spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
`ZS_Info("Boss spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
}
return SpawnList;

View File

@ -67,7 +67,6 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
local S_SpawnEntry SpawnEntry;
local int Line;
local bool Errors;
local int Loaded;
`ZS_Info("Load spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line)
@ -125,7 +124,6 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
if (!Errors)
{
Loaded++;
SpawnList.AddItem(SpawnEntry);
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
}
@ -133,13 +131,13 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
default.Spawn.Sort(SpawnListSort);
if (Loaded == default.Spawn.Length)
if (SpawnList.Length == default.Spawn.Length)
{
`ZS_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{
`ZS_Info("Regular spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
`ZS_Info("Regular spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
}
return SpawnList;

View File

@ -59,7 +59,6 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
local S_SpawnEntry SpawnEntry;
local int Line;
local bool Errors;
local int Loaded;
if (KFGIE == None)
{
@ -123,19 +122,18 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
if (!Errors)
{
Loaded++;
SpawnList.AddItem(SpawnEntry);
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
}
}
if (Loaded == default.Spawn.Length)
if (SpawnList.Length == default.Spawn.Length)
{
`ZS_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{
`ZS_Info("Special spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
`ZS_Info("Special spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
}
return SpawnList;

View File

@ -727,7 +727,7 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
public function NotifyLogin(Controller C)
{
`ZS_Trace(`Location);
`ZS_Info(`Location);
CreateRepLink(C);
}
@ -738,15 +738,18 @@ public function NotifyLogout(Controller C)
DestroyRepLink(C);
}
public function CreateRepLink(Controller C)
public function bool CreateRepLink(Controller C)
{
local ZedSpawnerRepLink RepLink;
`ZS_Trace(`Location);
if (C == None) return;
if (C == None) return false;
RepLink = Spawn(class'ZedSpawnerRepLink', C);
if (RepLink == None) return false;
RepLink.LogLevel = LogLevel;
RepLink.CustomZeds = CustomZeds;
RepLink.ZS = Self;
@ -754,22 +757,24 @@ public function CreateRepLink(Controller C)
RepLinks.AddItem(RepLink);
RepLink.ServerSync();
return true;
}
public function bool DestroyRepLink(Controller C)
{
local int i;
local ZedSpawnerRepLink RepLink;
`ZS_Trace(`Location);
if (C == None) return false;
for (i = RepLinks.Length - 1; i >= 0; --i)
foreach RepLinks(RepLink)
{
if (RepLinks[i].Owner == C)
if (RepLink.Owner == C)
{
RepLinks[i].SafeDestroy();
RepLinks.Remove(i, 1);
RepLink.SafeDestroy();
RepLinks.RemoveItem(RepLink);
return true;
}
}

View File

@ -3,7 +3,7 @@ class ZedSpawnerMut extends KFMutator
var private ZedSpawner ZS;
event PreBeginPlay()
public event PreBeginPlay()
{
Super.PreBeginPlay();
@ -38,14 +38,14 @@ public function AddMutator(Mutator Mut)
Super.AddMutator(Mut);
}
function NotifyLogin(Controller C)
public function NotifyLogin(Controller C)
{
Super.NotifyLogin(C);
ZS.NotifyLogin(C);
}
function NotifyLogout(Controller C)
public function NotifyLogout(Controller C)
{
Super.NotifyLogout(C);