diff --git a/ZedSpawner/Classes/SpawnAtPlayerStart.uc b/ZedSpawner/Classes/SpawnAtPlayerStart.uc index 5bff413..acb7e28 100644 --- a/ZedSpawner/Classes/SpawnAtPlayerStart.uc +++ b/ZedSpawner/Classes/SpawnAtPlayerStart.uc @@ -39,9 +39,7 @@ public static function Array > Load(E_LogLevel LogLevel) local Array > ZedList; local class 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 > 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; diff --git a/ZedSpawner/Classes/SpawnListBossWaves.uc b/ZedSpawner/Classes/SpawnListBossWaves.uc index e981544..a456b1c 100644 --- a/ZedSpawner/Classes/SpawnListBossWaves.uc +++ b/ZedSpawner/Classes/SpawnListBossWaves.uc @@ -61,7 +61,6 @@ public static function Array 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 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; diff --git a/ZedSpawner/Classes/SpawnListRegular.uc b/ZedSpawner/Classes/SpawnListRegular.uc index dc028b8..b332c36 100644 --- a/ZedSpawner/Classes/SpawnListRegular.uc +++ b/ZedSpawner/Classes/SpawnListRegular.uc @@ -67,7 +67,6 @@ public static function Array 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 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 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; diff --git a/ZedSpawner/Classes/SpawnListSpecialWaves.uc b/ZedSpawner/Classes/SpawnListSpecialWaves.uc index 941f1c4..9f4105f 100644 --- a/ZedSpawner/Classes/SpawnListSpecialWaves.uc +++ b/ZedSpawner/Classes/SpawnListSpecialWaves.uc @@ -59,7 +59,6 @@ public static function Array 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 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; diff --git a/ZedSpawner/Classes/ZedSpawner.uc b/ZedSpawner/Classes/ZedSpawner.uc index a283f5d..3aea662 100644 --- a/ZedSpawner/Classes/ZedSpawner.uc +++ b/ZedSpawner/Classes/ZedSpawner.uc @@ -727,7 +727,7 @@ private function int SpawnZed(class 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; } } diff --git a/ZedSpawner/Classes/ZedSpawnerMut.uc b/ZedSpawner/Classes/ZedSpawnerMut.uc index 2c4d513..9ecebc6 100644 --- a/ZedSpawner/Classes/ZedSpawnerMut.uc +++ b/ZedSpawner/Classes/ZedSpawnerMut.uc @@ -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);