Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
eda17af2bb | |||
b38412819e | |||
de44bfe00f | |||
a390cffbb8 | |||
7395ff04bf | |||
681870536b | |||
c7e9087f6e | |||
91e199a2e1 | |||
9f3153b43f | |||
e12c70bdbe | |||
42cf263785 |
@ -1,3 +1,5 @@
|
||||
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner[/img] [img]https://img.shields.io/steam/favorites/2811290931[/img] [img]https://img.shields.io/steam/update-date/2811290931[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2811290931][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner[/img][/url]
|
||||
|
||||
[h1]Description[/h1]
|
||||
Spawner for zeds. Started as a modification of [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2488241348]this version[/url], but now there is almost nothing left of the previous mutator, lol xD
|
||||
|
||||
@ -9,27 +11,33 @@ Spawner for zeds. Started as a modification of [url=https://steamcommunity.com/s
|
||||
- spawn after a certain percentage of killed zeds.
|
||||
|
||||
[h1]Whitelisted?[/h1]
|
||||
No. This mod is not whitelisted and will unrank your server. Any XP gained will not be saved.
|
||||
No. This mod is not whitelisted and will de-rank your server. Any XP gained will not be saved.
|
||||
|
||||
[h1]Usage (single player)[/h1]
|
||||
1. Subscribe to this mutator;
|
||||
2. Start KF2;
|
||||
3. Open console (`) and input:
|
||||
[olist]
|
||||
[*]Subscribe to this mutator;
|
||||
[*]Start KF2;
|
||||
[*]Open console (`) and input:
|
||||
[b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b]
|
||||
(replace the map and add the parameters you need)
|
||||
4. <Enter>.
|
||||
[*]<Enter>.
|
||||
[/olist]
|
||||
|
||||
[h1]Usage (server)[/h1]
|
||||
[b]Note:[/b] [i]If you don't understand what is written here, read the article [url=https://wiki.killingfloor2.com/index.php?title=Dedicated_Server_(Killing_Floor_2)][u]Dedicated Server (KF2 wiki)[/u][/url] before following these instructions.[/i]
|
||||
|
||||
1. Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
|
||||
2. Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
|
||||
[olist]
|
||||
[*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
|
||||
[*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
|
||||
[b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
|
||||
❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
|
||||
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
|
||||
[b]ServerSubscribedWorkshopItems=2811290931[/b]
|
||||
3. Start the server and wait while the mutator is downloading;
|
||||
4. Add mutator to server start parameters: [b]?Mutator=ZedSpawner.ZedSpawnerMut[/b] and restart the server.
|
||||
[*]Start the server and wait while the mutator is downloading;
|
||||
[*]Add mutator to server start parameters: [b]?Mutator=ZedSpawner.ZedSpawnerMut[/b] and restart the server.
|
||||
[/olist]
|
||||
|
||||
[h1]Setup[/h1]
|
||||
At the first start, the [b]KFZedSpawner.ini[/b] config will be created. There are already default settings and spawn lists, but you still need to change them because this is just an example.
|
||||
At the first start, the [b]KFZedSpawner.ini[/b] config will be created(*). There are already default settings and spawn lists, but you still need to change them because this is just an example.
|
||||
|
||||
[b]Cyclic spawn[/b]
|
||||
If you don't want to write an endless spawn list for the endless mode (lol) use a cyclic spawn. Set parameter [b]bCyclicalSpawn=True[/b]
|
||||
@ -40,6 +48,9 @@ Using the [b]SpawnTotalCycleMultiplier[/b] and [b]SingleSpawnLimitCycleMultiplie
|
||||
With [b]bShadowSpawn=True[/b], the zeds from the list will replace the original zeds that haven't spawned yet, so the counter of the remaining zeds won't grow. Spawning will stop when there are no unspawned zeds left.
|
||||
With [b]bShadowSpawn=False[/b] zeds from the spawn list will not replace the original ones. The counter of remaining zeds will increase when spawning. Spawn will continue until the end of the wave.
|
||||
|
||||
[b]Smooth spawn[/b]
|
||||
With [b]bSmoothSpawn=True[/b] a group of zeds will spawn gradually (1 zed per second);
|
||||
|
||||
[b]AliveSpawnLimit[/b]
|
||||
If you have a server crash with a large number of zeds, set [b]AliveSpawnLimit[/b]. If the number of live zeds reaches the specified limit, spawning will be stopped until there are fewer zeds. At zero there is no limit.
|
||||
|
||||
@ -61,8 +72,22 @@ Use the [b][ZedSpawner.SpawnListBossWaves][/b] and [b][ZedSpawner.SpawnListSpeci
|
||||
[h1]Spawn logic[/h1]
|
||||
I really tried to describe in text how it works, but every time I got some kind of crap. Therefore, I decided to explain it a little differently and made a small calculator for this. It is interactive, you can change the parameters and see what happens. It has all the necessary explanations, so I think you will quickly figure out how the spawner works.
|
||||
|
||||
[h1]📌[url=https://redirect.genzmey.su/kf2-zedspawner-calc]Spawn calculator[/url][/h1]
|
||||
[url=https://redirect.genzmey.su/kf2-zedspawner-calc][img]https://img.shields.io/static/v1?message=Spawn%20Calculator&logo=Google%20Sheets&labelColor=34A853&color=gray&logoColor=white&label=Google%20Sheets%20[/img][/url]
|
||||
[i]Just please try not to interfere with each other if you see that someone is already using a calculator.[/i]
|
||||
|
||||
[h1]Notes[/h1]
|
||||
📌 Mutator does not contain custom zeds. You must have the required zeds in your subscriptions to be able to spawn them.
|
||||
📌 If you are using this mutator to add zeds, you should [b]not[/b] use mutators from zed packs (just having them in subscriptions is enough).
|
||||
|
||||
[h1]Troubleshooting[/h1]
|
||||
📌 [b](*)[/b] If your config is not created for some reason, create it manually with the following content:
|
||||
[b][ZedSpawner.ZedSpawner]
|
||||
Version=0
|
||||
[/b]
|
||||
|
||||
Then start the server and check the file again - config content should be generated.
|
||||
|
||||
📌 If the spawner's behavior differs from what you expect, check the server logs first. ZedSpawner writes in the logs everything he does (and describes why), most likely you will find an explanation of what is happening there. If not, feel free to report bugs :)
|
||||
|
||||
[h1]Sources[/h1]
|
||||
[url=https://github.com/GenZmeY/KF2-ZedSpawner]https://github.com/GenZmeY/KF2-ZedSpawner[/url] (GNU GPLv3)
|
||||
[url=https://github.com/GenZmeY/KF2-ZedSpawner]https://github.com/GenZmeY/KF2-ZedSpawner[/url] (GNU GPLv3)
|
@ -1,7 +1,6 @@
|
||||
# ZedSpawner
|
||||
|
||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
|
||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
|
||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
|
||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
|
||||
[](https://github.com/GenZmeY/KF2-ZedSpawner/tags)
|
||||
@ -50,4 +49,4 @@ Describe what the bug looks like and how reproduce it.
|
||||
Attaching your KFZedSpawner.ini and Launch.log can also be helpful.
|
||||
|
||||
# License
|
||||
[GNU GPLv3](LICENSE)
|
||||
[GNU GPLv3](LICENSE)
|
||||
|
@ -1,40 +1,46 @@
|
||||
class KFGI_Access extends Object
|
||||
within KFGameInfo;
|
||||
|
||||
public function Array<class<KFPawn_Monster> > GetAIClassList()
|
||||
public function Array<class<KFPawn_Monster> > GetAIClassList(E_LogLevel LogLevel)
|
||||
{
|
||||
local Array<class<KFPawn_Monster> > RV;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
foreach AIClassList(KFPMC)
|
||||
RV.AddItem(KFPMC);
|
||||
|
||||
return RV;
|
||||
}
|
||||
|
||||
public function Array<class<KFPawn_Monster> > GetNonSpawnAIClassList()
|
||||
public function Array<class<KFPawn_Monster> > GetNonSpawnAIClassList(E_LogLevel LogLevel)
|
||||
{
|
||||
local Array<class<KFPawn_Monster> > RV;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
foreach NonSpawnAIClassList(KFPMC)
|
||||
RV.AddItem(KFPMC);
|
||||
|
||||
return RV;
|
||||
}
|
||||
|
||||
public function Array<class<KFPawn_Monster> > GetAIBossClassList()
|
||||
public function Array<class<KFPawn_Monster> > GetAIBossClassList(E_LogLevel LogLevel)
|
||||
{
|
||||
local Array<class<KFPawn_Monster> > RV;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
foreach AIBossClassList(KFPMC)
|
||||
RV.AddItem(KFPMC);
|
||||
|
||||
return RV;
|
||||
}
|
||||
|
||||
public function bool IsCustomZed(class<KFPawn_Monster> KFPM)
|
||||
public function bool IsCustomZed(class<KFPawn_Monster> KFPM, E_LogLevel LogLevel)
|
||||
{
|
||||
if (AIClassList.Find(KFPM) != INDEX_NONE) return false;
|
||||
if (NonSpawnAIClassList.Find(KFPM) != INDEX_NONE) return false;
|
||||
@ -42,10 +48,12 @@ public function bool IsCustomZed(class<KFPawn_Monster> KFPM)
|
||||
return true;
|
||||
}
|
||||
|
||||
public function bool IsOriginalAI(class<KFPawn_Monster> KFPM, optional out EAIType AIType)
|
||||
public function bool IsOriginalAI(class<KFPawn_Monster> KFPM, optional out EAIType AIType, optional E_LogLevel LogLevel = LL_None)
|
||||
{
|
||||
local int Type;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
Type = AIClassList.Find(KFPM);
|
||||
if (Type != INDEX_NONE)
|
||||
{
|
||||
@ -56,10 +64,12 @@ public function bool IsOriginalAI(class<KFPawn_Monster> KFPM, optional out EAITy
|
||||
return false;
|
||||
}
|
||||
|
||||
public function bool IsOriginalAIBoss(class<KFPawn_Monster> KFPM, optional out EBossAIType AIType)
|
||||
public function bool IsOriginalAIBoss(class<KFPawn_Monster> KFPM, optional out EBossAIType AIType, optional E_LogLevel LogLevel = LL_None)
|
||||
{
|
||||
local int Type;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
Type = AIBossClassList.Find(KFPM);
|
||||
if (Type != INDEX_NONE)
|
||||
{
|
||||
@ -70,16 +80,20 @@ public function bool IsOriginalAIBoss(class<KFPawn_Monster> KFPM, optional out E
|
||||
return false;
|
||||
}
|
||||
|
||||
public function class<KFPawn_Monster> AITypePawn(EAIType AIType)
|
||||
public function class<KFPawn_Monster> AITypePawn(EAIType AIType, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (AIType < AIClassList.Length)
|
||||
return AIClassList[AIType];
|
||||
else
|
||||
return None;
|
||||
}
|
||||
|
||||
public function class<KFPawn_Monster> BossAITypePawn(EBossAIType AIType)
|
||||
public function class<KFPawn_Monster> BossAITypePawn(EBossAIType AIType, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (AIType < AIBossClassList.Length)
|
||||
return AIBossClassList[AIType];
|
||||
else
|
||||
|
@ -11,13 +11,19 @@ var public config float SingleSpawnLimitMultiplier;
|
||||
var public config float SingleSpawnLimitPlayerMultiplier;
|
||||
var public config float SingleSpawnLimitCycleMultiplier;
|
||||
var public config int AliveSpawnLimit;
|
||||
var public config bool bSmoothSpawn;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion)
|
||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault();
|
||||
ApplyDefault(LogLevel);
|
||||
|
||||
case 3:
|
||||
default.bSmoothSpawn = false;
|
||||
|
||||
default: break;
|
||||
}
|
||||
@ -28,10 +34,13 @@ public static function InitConfig(int Version, int LatestVersion)
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault()
|
||||
private static function ApplyDefault(E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.bCyclicalSpawn = true;
|
||||
default.bShadowSpawn = true;
|
||||
default.bSmoothSpawn = true;
|
||||
default.ZedTotalMultiplier = 1.0;
|
||||
default.SpawnTotalPlayerMultiplier = 0.75;
|
||||
default.SpawnTotalCycleMultiplier = 0.75;
|
||||
@ -45,45 +54,47 @@ public static function bool Load(E_LogLevel LogLevel)
|
||||
{
|
||||
local bool Errors;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
if (default.ZedTotalMultiplier <= 0.f)
|
||||
{
|
||||
`ZS_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0");
|
||||
`Log_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.SpawnTotalPlayerMultiplier < 0.f)
|
||||
{
|
||||
`ZS_Error("SpawnTotalPlayerMultiplier" @ "(" $ default.SpawnTotalPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
`Log_Error("SpawnTotalPlayerMultiplier" @ "(" $ default.SpawnTotalPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.SpawnTotalCycleMultiplier < 0.f)
|
||||
{
|
||||
`ZS_Error("SpawnTotalCycleMultiplier" @ "(" $ default.SpawnTotalCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
`Log_Error("SpawnTotalCycleMultiplier" @ "(" $ default.SpawnTotalCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.SingleSpawnLimitMultiplier <= 0.f)
|
||||
{
|
||||
`ZS_Error("SingleSpawnLimitMultiplier" @ "(" $ default.SingleSpawnLimitMultiplier $ ")" @ "must be greater than 0.0");
|
||||
`Log_Error("SingleSpawnLimitMultiplier" @ "(" $ default.SingleSpawnLimitMultiplier $ ")" @ "must be greater than 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.SingleSpawnLimitPlayerMultiplier < 0.f)
|
||||
{
|
||||
`ZS_Error("SingleSpawnLimitPlayerMultiplier" @ "(" $ default.SingleSpawnLimitPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
`Log_Error("SingleSpawnLimitPlayerMultiplier" @ "(" $ default.SingleSpawnLimitPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.SingleSpawnLimitCycleMultiplier < 0.f)
|
||||
{
|
||||
`ZS_Error("SingleSpawnLimitCycleMultiplier" @ "(" $ default.SingleSpawnLimitCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
`Log_Error("SingleSpawnLimitCycleMultiplier" @ "(" $ default.SingleSpawnLimitCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (default.AliveSpawnLimit < 0)
|
||||
{
|
||||
`ZS_Error("AliveSpawnLimit" @ "(" $ default.AliveSpawnLimit $ ")" @ "must be greater than or equal 0");
|
||||
`Log_Error("AliveSpawnLimit" @ "(" $ default.AliveSpawnLimit $ ")" @ "must be greater than or equal 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,15 @@ class SpawnAtPlayerStart extends Object
|
||||
var private config Array<String> ZedClass;
|
||||
var public config Array<String> Map;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion)
|
||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
case 2:
|
||||
ApplyDefault();
|
||||
ApplyDefault(LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
@ -22,8 +24,10 @@ public static function InitConfig(int Version, int LatestVersion)
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault()
|
||||
private static function ApplyDefault(E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.ZedClass.Length = 0;
|
||||
default.ZedClass.AddItem("HL2Monsters.Combine_Strider");
|
||||
default.ZedClass.AddItem("HL2Monsters.Combine_Gunship");
|
||||
@ -39,33 +43,32 @@ 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;
|
||||
local int Line;
|
||||
|
||||
Loaded = 0;
|
||||
`Log_TraceStatic();
|
||||
|
||||
`ZS_Info("Load zeds to spawn at player start:");
|
||||
`Log_Info("Load zeds to spawn at player start:");
|
||||
foreach default.ZedClass(ZedClassTmp, Line)
|
||||
{
|
||||
KFPMC = class<KFPawn_Monster>(DynamicLoadObject(ZedClassTmp, class'Class'));
|
||||
if (KFPMC == None)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
Loaded++;
|
||||
ZedList.AddItem(KFPMC);
|
||||
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp);
|
||||
`Log_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)");
|
||||
`Log_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");
|
||||
`Log_Info("Spawn at player start list (Zeds): loaded" @ ZedList.Length @ "of" @ default.ZedClass.Length @ "entries");
|
||||
}
|
||||
|
||||
return ZedList;
|
||||
|
@ -15,12 +15,14 @@ struct S_SpawnEntryCfg
|
||||
var public config bool bStopRegularSpawn;
|
||||
var private config Array<S_SpawnEntryCfg> Spawn;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA)
|
||||
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault(KFGIA);
|
||||
ApplyDefault(KFGIA, LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
@ -31,12 +33,14 @@ public static function InitConfig(int Version, int LatestVersion, KFGI_Access KF
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel)
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local Array<class<KFPawn_Monster> > KFPM_Bosses;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.Spawn.Length = 0;
|
||||
|
||||
default.bStopRegularSpawn = true;
|
||||
@ -46,7 +50,7 @@ private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
SpawnEntry.SingleSpawnLimit = 1;
|
||||
SpawnEntry.Delay = 30;
|
||||
SpawnEntry.Probability = 100;
|
||||
KFPM_Bosses = KFGIA.GetAIBossClassList();
|
||||
KFPM_Bosses = KFGIA.GetAIBossClassList(LogLevel);
|
||||
foreach KFPM_Bosses(KFPMC)
|
||||
{
|
||||
SpawnEntry.BossClass = "KFGameContent." $ String(KFPMC);
|
||||
@ -61,9 +65,10 @@ 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:");
|
||||
`Log_TraceStatic();
|
||||
|
||||
`Log_Info("Load boss waves spawn list:");
|
||||
foreach default.Spawn(SpawnEntryCfg, Line)
|
||||
{
|
||||
Errors = false;
|
||||
@ -71,14 +76,14 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
|
||||
SpawnEntry.BossClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.BossClass, class'Class'));
|
||||
if (SpawnEntry.BossClass == None)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load boss class:" @ SpawnEntryCfg.BossClass);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load boss class:" @ SpawnEntryCfg.BossClass);
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
|
||||
if (SpawnEntry.ZedClass == None)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
@ -87,46 +92,45 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
|
||||
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
|
||||
if (SpawnEntryCfg.Delay <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
|
||||
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
|
||||
if (SpawnEntry.SpawnCountBase <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
|
||||
if (SpawnEntry.SingleSpawnLimit < 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
Loaded++;
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.BossClass $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_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)");
|
||||
`Log_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`ZS_Info("Boss spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
|
||||
`Log_Info("Boss spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
|
@ -20,12 +20,14 @@ delegate int SpawnListSort(S_SpawnEntryCfg A, S_SpawnEntryCfg B)
|
||||
return A.Wave > B.Wave ? -1 : 0;
|
||||
}
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA)
|
||||
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault(KFGIA);
|
||||
ApplyDefault(KFGIA, LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
@ -36,12 +38,14 @@ public static function InitConfig(int Version, int LatestVersion, KFGI_Access KF
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel)
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local Array<class<KFPawn_Monster> > KFPM_Zeds;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.Spawn.Length = 0;
|
||||
|
||||
SpawnEntry.Wave = 0;
|
||||
@ -51,7 +55,7 @@ private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
SpawnEntry.Delay = 60;
|
||||
SpawnEntry.Probability = 100;
|
||||
|
||||
KFPM_Zeds = KFGIA.GetAIClassList();
|
||||
KFPM_Zeds = KFGIA.GetAIClassList(LogLevel);
|
||||
foreach KFPM_Zeds(KFPMC)
|
||||
{
|
||||
++SpawnEntry.Wave;
|
||||
@ -67,9 +71,10 @@ 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:");
|
||||
`Log_TraceStatic();
|
||||
|
||||
`Log_Info("Load spawn list:");
|
||||
foreach default.Spawn(SpawnEntryCfg, Line)
|
||||
{
|
||||
Errors = false;
|
||||
@ -77,69 +82,68 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
|
||||
SpawnEntry.Wave = SpawnEntryCfg.Wave;
|
||||
if (SpawnEntryCfg.Wave <= 0 || SpawnEntryCfg.Wave > 255)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Wave" @ "(" $ SpawnEntryCfg.ZedClass $ ")" @ "must be greater than 0 and less than 256");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Wave" @ "(" $ SpawnEntryCfg.ZedClass $ ")" @ "must be greater than 0 and less than 256");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
|
||||
if (SpawnEntry.ZedClass == None)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f;
|
||||
if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
|
||||
if (SpawnEntryCfg.Delay <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
|
||||
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
|
||||
if (SpawnEntry.SpawnCountBase <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
|
||||
if (SpawnEntry.SingleSpawnLimit < 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
Loaded++;
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
}
|
||||
}
|
||||
|
||||
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)");
|
||||
`Log_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`ZS_Info("Regular spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
|
||||
`Log_Info("Regular spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
|
@ -16,12 +16,14 @@ struct S_SpawnEntryCfg
|
||||
var public config bool bStopRegularSpawn;
|
||||
var private config Array<S_SpawnEntryCfg> Spawn;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion)
|
||||
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
|
||||
{
|
||||
`Log_TraceStatic();
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault();
|
||||
ApplyDefault(LogLevel);
|
||||
|
||||
default: break;
|
||||
}
|
||||
@ -32,11 +34,13 @@ public static function InitConfig(int Version, int LatestVersion)
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault()
|
||||
private static function ApplyDefault(E_LogLevel LogLevel)
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local EAIType AIType;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
default.bStopRegularSpawn = true;
|
||||
default.Spawn.Length = 0;
|
||||
SpawnEntry.ZedClass = "SomePackage.SomeClass";
|
||||
@ -59,15 +63,16 @@ 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;
|
||||
|
||||
`Log_TraceStatic();
|
||||
|
||||
if (KFGIE == None)
|
||||
{
|
||||
`ZS_Info("Not Endless mode, skip loading special waves");
|
||||
`Log_Info("Not Endless mode, skip loading special waves");
|
||||
return SpawnList;
|
||||
}
|
||||
|
||||
`ZS_Info("Load special waves spawn list:");
|
||||
`Log_Info("Load special waves spawn list:");
|
||||
foreach default.Spawn(SpawnEntryCfg, Line)
|
||||
{
|
||||
Errors = false;
|
||||
@ -75,67 +80,66 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
|
||||
SpawnEntry.Wave = SpawnEntryCfg.Wave;
|
||||
if (KFGIE.SpecialWaveTypes.Find(EAIType(SpawnEntryCfg.Wave)) == INDEX_NONE)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Unknown special wave:" @ SpawnEntryCfg.Wave);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Unknown special wave:" @ SpawnEntryCfg.Wave);
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
|
||||
if (SpawnEntry.ZedClass == None)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f;
|
||||
if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
|
||||
if (SpawnEntryCfg.Delay <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
|
||||
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
|
||||
if (SpawnEntry.SpawnCountBase <= 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
|
||||
if (SpawnEntry.SingleSpawnLimit < 0)
|
||||
{
|
||||
`ZS_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
|
||||
Errors = true;
|
||||
}
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
Loaded++;
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
`Log_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)");
|
||||
`Log_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`ZS_Info("Special spawn list: loaded" @ Loaded @ "of" @ default.Spawn.Length @ "entries");
|
||||
`Log_Info("Special spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
|
@ -1,7 +1,7 @@
|
||||
class ZedSpawner extends Info
|
||||
config(ZedSpawner);
|
||||
|
||||
const LatestVersion = 3;
|
||||
const LatestVersion = 4;
|
||||
|
||||
const CfgSpawn = class'Spawn';
|
||||
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
|
||||
@ -9,18 +9,6 @@ const CfgSpawnListRW = class'SpawnListRegular';
|
||||
const CfgSpawnListBW = class'SpawnListBossWaves';
|
||||
const CfgSpawnListSW = class'SpawnListSpecialWaves';
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
LL_Fatal,
|
||||
LL_Error,
|
||||
LL_Warning,
|
||||
LL_Info,
|
||||
LL_Debug,
|
||||
LL_Trace,
|
||||
LL_All
|
||||
};
|
||||
|
||||
struct S_SpawnEntry
|
||||
{
|
||||
var class<KFPawn_Monster> BossClass;
|
||||
@ -38,6 +26,7 @@ struct S_SpawnEntry
|
||||
var int PawnsTotal;
|
||||
var bool ForceSpawn;
|
||||
var String ZedNameFiller;
|
||||
var int SmoothPawnPool;
|
||||
};
|
||||
|
||||
var private config int Version;
|
||||
@ -75,7 +64,7 @@ var private Array<class<KFPawn_Monster> > SpawnAtPlayerStartZeds;
|
||||
var private bool SpawnActive;
|
||||
var private String SpawnListsComment;
|
||||
|
||||
var private Array<ZedSpawnerRepLink> RepLinks;
|
||||
var private Array<ZedSpawnerRepInfo> RepInfos;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
@ -84,30 +73,21 @@ public simulated function bool SafeDestroy()
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client)
|
||||
{
|
||||
`ZS_Fatal("NetMode == NM_Client, Destroy...");
|
||||
`Log_Fatal("NetMode == NM_Client, Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
Super.PreBeginPlay();
|
||||
|
||||
PreInit();
|
||||
}
|
||||
|
||||
public event PostBeginPlay()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
Super.PostBeginPlay();
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
private function InitConfig()
|
||||
private function PreInit()
|
||||
{
|
||||
if (Version == `NO_CONFIG)
|
||||
{
|
||||
@ -115,34 +95,35 @@ private function InitConfig()
|
||||
SaveConfig();
|
||||
}
|
||||
|
||||
CfgSpawn.static.InitConfig(Version, LatestVersion);
|
||||
CfgSpawnAtPlayerStart.static.InitConfig(Version, LatestVersion);
|
||||
CfgSpawnListRW.static.InitConfig(Version, LatestVersion, KFGIA);
|
||||
CfgSpawnListBW.static.InitConfig(Version, LatestVersion, KFGIA);
|
||||
CfgSpawnListSW.static.InitConfig(Version, LatestVersion);
|
||||
CfgSpawn.static.InitConfig(Version, LatestVersion, LogLevel);
|
||||
CfgSpawnAtPlayerStart.static.InitConfig(Version, LatestVersion, LogLevel);
|
||||
CfgSpawnListRW.static.InitConfig(Version, LatestVersion, KFGIA, LogLevel);
|
||||
CfgSpawnListBW.static.InitConfig(Version, LatestVersion, KFGIA, LogLevel);
|
||||
CfgSpawnListSW.static.InitConfig(Version, LatestVersion, LogLevel);
|
||||
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
`ZS_Info("Config created");
|
||||
`Log_Info("Config created");
|
||||
|
||||
case 1:
|
||||
Tickrate = 1.0f;
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
|
||||
case MaxInt:
|
||||
`ZS_Info("Config updated to version"@LatestVersion);
|
||||
`Log_Info("Config updated to version"@LatestVersion);
|
||||
break;
|
||||
|
||||
case LatestVersion:
|
||||
`ZS_Info("Config is up-to-date");
|
||||
`Log_Info("Config is up-to-date");
|
||||
break;
|
||||
|
||||
default:
|
||||
`ZS_Warn("The config version is higher than the current version (are you using an old mutator?)");
|
||||
`ZS_Warn("Config version is" @ Version @ "but current version is" @ LatestVersion);
|
||||
`ZS_Warn("The config version will be changed to" @ LatestVersion);
|
||||
`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("The config version will be changed to" @ LatestVersion);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -151,59 +132,79 @@ private function InitConfig()
|
||||
Version = LatestVersion;
|
||||
SaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private function Init()
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local String CurrentMap;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
KFGIS = KFGameInfo_Survival(WorldInfo.Game);
|
||||
if (KFGIS == None)
|
||||
{
|
||||
`ZS_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
KFGIA = new(KFGIS) class'KFGI_Access';
|
||||
KFGIE = KFGameInfo_Endless(KFGIS);
|
||||
|
||||
InitConfig();
|
||||
|
||||
if (LogLevel == LL_WrongLevel)
|
||||
{
|
||||
LogLevel = LL_Info;
|
||||
`ZS_Warn("Wrong 'LogLevel', return to default value");
|
||||
`Log_Warn("Wrong 'LogLevel', return to default value");
|
||||
SaveConfig();
|
||||
}
|
||||
`ZS_Log("LogLevel:" @ LogLevel);
|
||||
`Log_Base("LogLevel:" @ LogLevel);
|
||||
|
||||
if (Tickrate <= 0)
|
||||
{
|
||||
`ZS_Error("Spawner tickrate must be positive (current value:" @ Tickrate $ ")");
|
||||
}
|
||||
|
||||
if (!CfgSpawn.static.Load(LogLevel) || Tickrate <= 0)
|
||||
{
|
||||
`ZS_Fatal("Wrong settings, Destroy...");
|
||||
`Log_Error("Spawner tickrate must be positive (current value:" @ Tickrate $ ")");
|
||||
`Log_Fatal("Wrong settings, Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
dt = 1 / Tickrate;
|
||||
`ZS_Info("Spawner tickrate:" @ Tickrate @ "(update every" @ dt $ "s)");
|
||||
`Log_Info("Spawner tickrate:" @ Tickrate @ "(update every" @ dt $ "s)");
|
||||
|
||||
if (!CfgSpawn.static.Load(LogLevel))
|
||||
{
|
||||
`Log_Fatal("Wrong settings, Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnListRW = CfgSpawnListRW.static.Load(LogLevel);
|
||||
SpawnListBW = CfgSpawnListBW.static.Load(LogLevel);
|
||||
SpawnListSW = CfgSpawnListSW.static.Load(KFGIE, LogLevel);
|
||||
SpawnAtPlayerStartZeds = CfgSpawnAtPlayerStart.static.Load(LogLevel);
|
||||
}
|
||||
|
||||
public event PostBeginPlay()
|
||||
{
|
||||
`Log_Trace();
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
Super.PostBeginPlay();
|
||||
|
||||
PostInit();
|
||||
}
|
||||
|
||||
private function PostInit()
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local String CurrentMap;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
KFGIS = KFGameInfo_Survival(WorldInfo.Game);
|
||||
if (KFGIS == None)
|
||||
{
|
||||
`Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
KFGIA = new(KFGIS) class'KFGI_Access';
|
||||
if (KFGIA == None)
|
||||
{
|
||||
`Log_Fatal("Can't create KFGI_Access object");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
KFGIE = KFGameInfo_Endless(KFGIS);
|
||||
|
||||
SpawnListSW = CfgSpawnListSW.static.Load(KFGIE, LogLevel);
|
||||
|
||||
CurrentMap = String(WorldInfo.GetPackageName());
|
||||
GlobalSpawnAtPlayerStart = (CfgSpawnAtPlayerStart.default.Map.Find(CurrentMap) != INDEX_NONE);
|
||||
`ZS_Info("GlobalSpawnAtPlayerStart:" @ GlobalSpawnAtPlayerStart $ GlobalSpawnAtPlayerStart ? "(" $ CurrentMap $ ")" : "");
|
||||
`Log_Info("GlobalSpawnAtPlayerStart:" @ GlobalSpawnAtPlayerStart $ GlobalSpawnAtPlayerStart ? "(" $ CurrentMap $ ")" : "");
|
||||
|
||||
CurrentWave = INDEX_NONE;
|
||||
SpecialWave = INDEX_NONE;
|
||||
@ -230,13 +231,15 @@ private function PreloadContent()
|
||||
{
|
||||
local class<KFPawn_Monster> PawnClass;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
|
||||
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
|
||||
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
|
||||
|
||||
foreach CustomZeds(PawnClass)
|
||||
{
|
||||
`ZS_Info("Preload content:" @ PawnClass);
|
||||
`Log_Info("Preload content:" @ PawnClass);
|
||||
PawnClass.static.PreloadContent();
|
||||
}
|
||||
}
|
||||
@ -245,10 +248,12 @@ private function ExtractCustomZedsFromSpawnList(Array<S_SpawnEntry> SpawnList, o
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
foreach SpawnList(SE)
|
||||
{
|
||||
if (Out.Find(SE.ZedClass) == INDEX_NONE
|
||||
&& KFGIA.IsCustomZed(SE.ZedClass))
|
||||
&& KFGIA.IsCustomZed(SE.ZedClass, LogLevel))
|
||||
{
|
||||
Out.AddItem(SE.ZedClass);
|
||||
}
|
||||
@ -261,7 +266,7 @@ private function SpawnTimer()
|
||||
local int Index;
|
||||
local float Threshold;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (KFGIS.WaveNum != 0 && CurrentWave < KFGIS.WaveNum)
|
||||
{
|
||||
@ -333,12 +338,12 @@ private function SetupWave()
|
||||
local S_SpawnEntry SE;
|
||||
local EAIType SWType;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (CfgSpawn.default.bCyclicalSpawn && KFGIS.WaveNum > 1 && KFGIS.WaveNum == CycleWaveShift + CycleWaveSize * CurrentCycle)
|
||||
{
|
||||
CurrentCycle++;
|
||||
`ZS_Info("Spawn cycle started:" @ CurrentCycle);
|
||||
`Log_Info("Spawn cycle started:" @ CurrentCycle);
|
||||
}
|
||||
|
||||
CurrentWave = KFGIS.WaveNum;
|
||||
@ -360,10 +365,10 @@ private function SetupWave()
|
||||
|
||||
if (KFGIS.MyKFGRI.IsBossWave())
|
||||
{
|
||||
CurrentBossClass = KFGIA.BossAITypePawn(EBossAIType(KFGIS.MyKFGRI.BossIndex));
|
||||
CurrentBossClass = KFGIA.BossAITypePawn(EBossAIType(KFGIS.MyKFGRI.BossIndex), LogLevel);
|
||||
if (CurrentBossClass == None)
|
||||
{
|
||||
`ZS_Error("Can't determine boss class. Boss index:" @ KFGIS.MyKFGRI.BossIndex);
|
||||
`Log_Error("Can't determine boss class. Boss index:" @ KFGIS.MyKFGRI.BossIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -380,7 +385,7 @@ private function SetupWave()
|
||||
|
||||
if (WaveTotalAIDef != KFGIS.SpawnManager.WaveTotalAI)
|
||||
{
|
||||
`ZS_Info("increase WaveTotalAI from" @ WaveTotalAIDef @ "to" @ WaveTotalAI @ "due to ZedTotalMultiplier" @ "(" $ CfgSpawn.default.ZedTotalMultiplier $ ")");
|
||||
`Log_Info("increase WaveTotalAI from" @ WaveTotalAIDef @ "to" @ WaveTotalAI @ "due to ZedTotalMultiplier" @ "(" $ CfgSpawn.default.ZedTotalMultiplier $ ")");
|
||||
}
|
||||
|
||||
CurrentBossClass = None;
|
||||
@ -429,7 +434,7 @@ private function SetupWave()
|
||||
WaveTypeInfo = "(" $ WaveTypeInfo $ ")";
|
||||
}
|
||||
|
||||
`ZS_Info("Wave" @ CurrentWave @ WaveTypeInfo);
|
||||
`Log_Info("Wave" @ CurrentWave @ WaveTypeInfo);
|
||||
}
|
||||
|
||||
private function AdjustSpawnList(out Array<S_SpawnEntry> List)
|
||||
@ -442,7 +447,7 @@ private function AdjustSpawnList(out Array<S_SpawnEntry> List)
|
||||
local float PawnTotalF, PawnLimitF;
|
||||
local int ZedNameMaxLength;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
Cycle = float(CurrentCycle);
|
||||
Players = float(PlayerCount());
|
||||
@ -497,7 +502,7 @@ private function SpawnTimerLogger(bool Stop, optional String Comment)
|
||||
{
|
||||
local String Message;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (Stop)
|
||||
Message = "Stop spawn";
|
||||
@ -509,7 +514,7 @@ private function SpawnTimerLogger(bool Stop, optional String Comment)
|
||||
|
||||
if (SpawnActive == Stop)
|
||||
{
|
||||
`ZS_Info(Message);
|
||||
`Log_Info(Message);
|
||||
SpawnActive = !Stop;
|
||||
}
|
||||
}
|
||||
@ -521,11 +526,12 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
local String Action, Comment, NextSpawn;
|
||||
local bool SpawnAtPlayerStart;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
SE = SpawnList[Index];
|
||||
|
||||
SpawnList[Index].Delay = float(SE.DelayDefault);
|
||||
|
||||
if (FRand() <= SE.Probability || SE.ForceSpawn)
|
||||
{
|
||||
if (SE.SingleSpawnLimit == 0 || SE.PawnsLeft < SE.SingleSpawnLimit)
|
||||
@ -537,6 +543,15 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
PawnCount = SE.SingleSpawnLimit;
|
||||
}
|
||||
|
||||
if (CfgSpawn.default.bSmoothSpawn)
|
||||
{
|
||||
if (SE.SmoothPawnPool <= 0)
|
||||
{
|
||||
SpawnList[Index].SmoothPawnPool = PawnCount;
|
||||
}
|
||||
PawnCount = 1;
|
||||
}
|
||||
|
||||
if (CfgSpawn.default.bShadowSpawn && !KFGIS.MyKFGRI.IsBossWave())
|
||||
{
|
||||
FreeSpawnSlots = KFGIS.MyKFGRI.AIRemaining - KFGIS.AIAliveCount;
|
||||
@ -570,9 +585,26 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnList[Index].ForceSpawn = false;
|
||||
Action = "Spawned";
|
||||
Comment = "x" $ Spawned;
|
||||
if (CfgSpawn.default.bSmoothSpawn)
|
||||
{
|
||||
SpawnList[Index].SmoothPawnPool -= Spawned;
|
||||
if (SpawnList[Index].SmoothPawnPool > 0)
|
||||
{
|
||||
SpawnList[Index].Delay = 1.0f;
|
||||
SpawnList[Index].ForceSpawn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnList[Index].Delay = float(SE.DelayDefault);
|
||||
SpawnList[Index].ForceSpawn = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnList[Index].ForceSpawn = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -585,7 +617,14 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
SpawnList[Index].PawnsLeft -= Spawned;
|
||||
if (SpawnList[Index].PawnsLeft > 0)
|
||||
{
|
||||
NextSpawn = "next after" @ SE.DelayDefault $ "sec," @ "pawns left:" @ SpawnList[Index].PawnsLeft;
|
||||
if (CfgSpawn.default.bSmoothSpawn && SpawnList[Index].SmoothPawnPool > 0)
|
||||
{
|
||||
NextSpawn = "next after" @ Round(SpawnList[Index].Delay) $ "sec," @ "pawns left:" @ SpawnList[Index].SmoothPawnPool @ "(" $ SpawnList[Index].PawnsLeft $ ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
NextSpawn = "next after" @ SE.DelayDefault $ "sec," @ "pawns left:" @ SpawnList[Index].PawnsLeft;
|
||||
}
|
||||
}
|
||||
SpawnLog(SE, Action, Comment, NextSpawn);
|
||||
}
|
||||
@ -595,7 +634,7 @@ private function SpawnLog(S_SpawnEntry SE, String Action, optional String Commen
|
||||
if (Comment != "") Comment = ":" @ Comment;
|
||||
if (NextSpawn != "") NextSpawn = "(" $ NextSpawn $ ")";
|
||||
|
||||
`ZS_Info(String(SE.ZedClass) $ SE.ZedNameFiller @ ">" @ Action $ Comment @ NextSpawn);
|
||||
`Log_Info(String(SE.ZedClass) $ SE.ZedNameFiller @ ">" @ Action $ Comment @ NextSpawn);
|
||||
}
|
||||
|
||||
private function int PlayerCount()
|
||||
@ -604,7 +643,7 @@ private function int PlayerCount()
|
||||
local int HumanPlayers;
|
||||
local KFOnlineGameSettings KFGameSettings;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (KFGIS.PlayfabInter != None && KFGIS.PlayfabInter.GetGameSettings() != None)
|
||||
{
|
||||
@ -629,7 +668,7 @@ private function Vector PlayerStartLocation()
|
||||
{
|
||||
local PlayerController PC;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
foreach WorldInfo.AllControllers(class'PlayerController', PC)
|
||||
return KFGIS.FindPlayerStart(PC, 0).Location;
|
||||
@ -648,7 +687,7 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
|
||||
local int Failed, Spawned;
|
||||
local int Index;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
PlayerStart = PlayerStartLocation();
|
||||
if (SpawnAtPlayerStart)
|
||||
@ -691,7 +730,7 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
|
||||
KFPM = Spawn(ZedClass,,, SpawnLocation, rot(0,0,1),, true);
|
||||
if (KFPM == None)
|
||||
{
|
||||
`ZS_Error("Can't spawn" @ ZedClass);
|
||||
`Log_Error("Can't spawn" @ ZedClass);
|
||||
Failed++;
|
||||
continue;
|
||||
}
|
||||
@ -699,7 +738,7 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
|
||||
C = KFPM.Spawn(KFPM.ControllerClass);
|
||||
if (C == None)
|
||||
{
|
||||
`ZS_Error("Can't spawn controller for" @ ZedClass $ ". Destroy this" @ KFPM $ "...");
|
||||
`Log_Error("Can't spawn controller for" @ ZedClass $ ". Destroy this" @ KFPM $ "...");
|
||||
KFPM.Destroy();
|
||||
Failed++;
|
||||
continue;
|
||||
@ -726,50 +765,61 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
|
||||
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
CreateRepLink(C);
|
||||
if (!CreateRepInfo(C))
|
||||
{
|
||||
`Log_Error("Can't create RepInfo for:" @ C);
|
||||
}
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
DestroyRepLink(C);
|
||||
if (!DestroyRepInfo(C))
|
||||
{
|
||||
`Log_Error("Can't destroy RepInfo of:" @ C);
|
||||
}
|
||||
}
|
||||
|
||||
public function CreateRepLink(Controller C)
|
||||
public function bool CreateRepInfo(Controller C)
|
||||
{
|
||||
local ZedSpawnerRepLink RepLink;
|
||||
local ZedSpawnerRepInfo RepInfo;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
if (C == None) return;
|
||||
|
||||
RepLink = Spawn(class'ZedSpawnerRepLink', C);
|
||||
RepLink.LogLevel = LogLevel;
|
||||
RepLink.CustomZeds = CustomZeds;
|
||||
RepLink.ZS = Self;
|
||||
|
||||
RepLinks.AddItem(RepLink);
|
||||
|
||||
RepLink.ServerSync();
|
||||
}
|
||||
|
||||
public function bool DestroyRepLink(Controller C)
|
||||
{
|
||||
local int i;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None) return false;
|
||||
|
||||
for (i = RepLinks.Length - 1; i >= 0; --i)
|
||||
RepInfo = Spawn(class'ZedSpawnerRepInfo', C);
|
||||
|
||||
if (RepInfo == None) return false;
|
||||
|
||||
RepInfo.LogLevel = LogLevel;
|
||||
RepInfo.CustomZeds = CustomZeds;
|
||||
RepInfo.ZS = Self;
|
||||
|
||||
RepInfos.AddItem(RepInfo);
|
||||
|
||||
RepInfo.ServerSync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function bool DestroyRepInfo(Controller C)
|
||||
{
|
||||
local ZedSpawnerRepInfo RepInfo;
|
||||
|
||||
`Log_Trace();
|
||||
|
||||
if (C == None) return false;
|
||||
|
||||
foreach RepInfos(RepInfo)
|
||||
{
|
||||
if (RepLinks[i].Owner == C)
|
||||
if (RepInfo.Owner == C)
|
||||
{
|
||||
RepLinks[i].SafeDestroy();
|
||||
RepLinks.Remove(i, 1);
|
||||
RepInfo.SafeDestroy();
|
||||
RepInfos.RemoveItem(RepInfo);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -3,27 +3,25 @@ class ZedSpawnerMut extends KFMutator
|
||||
|
||||
var private ZedSpawner ZS;
|
||||
|
||||
event PreBeginPlay()
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
Super.PreBeginPlay();
|
||||
Super.PreBeginPlay();
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client) return;
|
||||
|
||||
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
|
||||
{
|
||||
`ZS_Log("Found 'ZedSpawner'");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ZS == None)
|
||||
{
|
||||
`ZS_Log("Spawn 'ZedSpawner'");
|
||||
ZS = WorldInfo.Spawn(class'ZedSpawner');
|
||||
}
|
||||
|
||||
if (ZS == None)
|
||||
{
|
||||
`ZS_Log("Can't Spawn 'ZedSpawner', Destroy...");
|
||||
`Log_Base("FATAL: Can't Spawn 'ZedSpawner'");
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
@ -38,18 +36,18 @@ public function AddMutator(Mutator Mut)
|
||||
Super.AddMutator(Mut);
|
||||
}
|
||||
|
||||
function NotifyLogin(Controller C)
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
Super.NotifyLogin(C);
|
||||
|
||||
ZS.NotifyLogin(C);
|
||||
|
||||
Super.NotifyLogin(C);
|
||||
}
|
||||
|
||||
function NotifyLogout(Controller C)
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
Super.NotifyLogout(C);
|
||||
|
||||
ZS.NotifyLogout(C);
|
||||
|
||||
Super.NotifyLogout(C);
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
|
@ -1,4 +1,4 @@
|
||||
class ZedSpawnerRepLink extends ReplicationInfo;
|
||||
class ZedSpawnerRepInfo extends ReplicationInfo;
|
||||
|
||||
var public ZedSpawner ZS;
|
||||
var public E_LogLevel LogLevel;
|
||||
@ -13,15 +13,14 @@ replication
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
`ZS_Debug(`Location @ "bPendingDelete:" @ bPendingDelete @ "bDeleteMe" @ bDeleteMe);
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
`ZS_Debug("Received:" @ CustomZed);
|
||||
`Log_Debug("Received:" @ CustomZed);
|
||||
CustomZeds.AddItem(CustomZed);
|
||||
ServerSync();
|
||||
}
|
||||
@ -30,11 +29,11 @@ public reliable client function SyncFinished()
|
||||
{
|
||||
local class<KFPawn_Monster> CustomZed;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
foreach CustomZeds(CustomZed)
|
||||
{
|
||||
`ZS_Debug("Preload Content for" @ CustomZed);
|
||||
`Log_Debug("Preload Content for" @ CustomZed);
|
||||
CustomZed.static.PreloadContent();
|
||||
}
|
||||
|
||||
@ -43,22 +42,22 @@ public reliable client function SyncFinished()
|
||||
|
||||
public reliable server function ServerSync()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace();
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
|
||||
{
|
||||
`ZS_Debug("Sync finished");
|
||||
`Log_Debug("Sync finished");
|
||||
SyncFinished();
|
||||
if (!ZS.DestroyRepLink(Controller(Owner)))
|
||||
if (!ZS.DestroyRepInfo(Controller(Owner)))
|
||||
{
|
||||
SafeDestroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
`ZS_Debug("Sync:" @ CustomZeds[Recieved]);
|
||||
`Log_Debug("Sync:" @ CustomZeds[Recieved]);
|
||||
ClientSync(CustomZeds[Recieved++]);
|
||||
}
|
||||
}
|
20
ZedSpawner/Classes/_Logger.uc
Normal file
20
ZedSpawner/Classes/_Logger.uc
Normal file
@ -0,0 +1,20 @@
|
||||
class _Logger extends Object
|
||||
abstract;
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
LL_None,
|
||||
LL_Fatal,
|
||||
LL_Error,
|
||||
LL_Warning,
|
||||
LL_Info,
|
||||
LL_Debug,
|
||||
LL_Trace,
|
||||
LL_All
|
||||
};
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
2
ZedSpawner/Constants.uci
Normal file
2
ZedSpawner/Constants.uci
Normal file
@ -0,0 +1,2 @@
|
||||
// Constants
|
||||
`define NO_CONFIG 0
|
@ -1,12 +1,3 @@
|
||||
`define ZS_Tag 'ZedSpawner'
|
||||
|
||||
`define ZS_Log(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `ZS_Tag)
|
||||
|
||||
`define ZS_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `ZS_Tag)
|
||||
`define ZS_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `ZS_Tag)
|
||||
`define ZS_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `ZS_Tag)
|
||||
`define ZS_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `ZS_Tag)
|
||||
`define ZS_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `ZS_Tag)
|
||||
`define ZS_Trace(msg) `log("TRACE:" @ `msg, (LogLevel >= LL_Trace), `ZS_Tag)
|
||||
|
||||
`define NO_CONFIG 0
|
||||
// Imports
|
||||
`include(Logger.uci)
|
||||
`include(Constants.uci)
|
||||
|
15
ZedSpawner/Logger.uci
Normal file
15
ZedSpawner/Logger.uci
Normal file
@ -0,0 +1,15 @@
|
||||
// Logger
|
||||
`define Log_Tag 'ZedSpawner'
|
||||
|
||||
`define LocationStatic "`{ClassName}::" $ GetFuncName()
|
||||
|
||||
`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_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `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_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_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
|
2
tools
2
tools
Submodule tools updated: 02222cf453...2f173aad7a
Reference in New Issue
Block a user