Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
7395ff04bf | |||
681870536b | |||
c7e9087f6e | |||
91e199a2e1 | |||
9f3153b43f | |||
e12c70bdbe | |||
90a69ef739 | |||
42cf263785 | |||
e1face5c04 | |||
35048c6fec | |||
088da70984 | |||
525ee1728e | |||
3dad5b10c7 | |||
3a42094ca2 | |||
a45ba21925 | |||
f681c7d40d | |||
0de9c0088c | |||
c06591d5a2 | |||
11c5490bd6 | |||
3fbf4e9c20 | |||
40c9546858 | |||
83286ea046 | |||
88fcd8b235 | |||
fd3c9116e4 |
@ -1,7 +1,76 @@
|
||||
[h1]ZedSpawner[/h1]
|
||||
[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/subscriptions/2811290931[/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]
|
||||
Work In Progress...
|
||||
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
|
||||
|
||||
[h1]Features[/h1]
|
||||
- spawn without increasing zed counter;
|
||||
- spawn depends on the number of players;
|
||||
- cyclic spawn (useful for endless mode);
|
||||
- separate spawn for special waves and boss waves;
|
||||
- spawn after a certain percentage of killed zeds.
|
||||
|
||||
[h1]Whitelisted?[/h1]
|
||||
No. This mod is not whitelisted and will de-rank your server. Any XP gained will not be saved.
|
||||
|
||||
[h1]Usage (single player)[/h1]
|
||||
[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)
|
||||
[*]<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]
|
||||
[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]
|
||||
[*]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.
|
||||
|
||||
[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]
|
||||
After the last wave in the spawn list ends, spawn will start again from the beginning of the list.
|
||||
Using the [b]SpawnTotalCycleMultiplier[/b] and [b]SingleSpawnLimitCycleMultiplier[/b] modifiers will allow you to adjust the difficulty of the following cycles.
|
||||
|
||||
[b]Shadow spawn[/b]
|
||||
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]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.
|
||||
|
||||
[b]Spawn lists[/b]
|
||||
Use the [b][ZedSpawner.SpawnListRegular][/b] section to set spawn on any wave.
|
||||
Use the [b][ZedSpawner.SpawnListBossWaves][/b] and [b][ZedSpawner.SpawnListSpecialWaves][/b] sections to set a separate spawn for the boss wave and special waves if needed. Use [b]bStopRegularSpawn=True[/b] if you want to stop spawning from the regular list during boss waves or special waves.
|
||||
|
||||
[b]Spawn entry parameters[/b]
|
||||
[list]
|
||||
[*][b]Wave / BossClass[/b] - what wave is the spawn for. Wave number for the regular list, wave type for the special list; boss class for the boss list.
|
||||
[*][b]ZedClass[/b] - the class of the zed you want to spawn (for example: ZedternalReborn.WMPawn_ZedScrake_Omega).
|
||||
[*][b]RelativeStart[/b] - allows you to start spawning a zed not on a timer, but after killing the specified percentage of zeds. If set to zero, spawn will start after [b]Delay[/b] seconds from the start of the wave. Note that [b]RelativeStart[/b] does not work on bosses.
|
||||
[*][b]Delay[/b] - time in seconds between spawns.
|
||||
[*][b]Probability[/b] - the chance (%) of each spawn (1-100).
|
||||
[*][b]SpawnCountBase[/b] - The base number of zeds to spawn, aka the number of zeds that will be spawned on the first cycle with one player. Can be adjusted by modifiers, number of players and cycle number.
|
||||
[*][b]SingleSpawnLimit[/b] - maximum number of zeds for one spawn. Can be adjusted by modifiers, number of players and cycle number.
|
||||
[/list]
|
||||
|
||||
[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.
|
||||
|
||||
[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]Sources[/h1]
|
||||
[url=https://github.com/GenZmeY/KF2-ZedSpawner]https://github.com/GenZmeY/KF2-ZedSpawner[/url]
|
||||
[url=https://github.com/GenZmeY/KF2-ZedSpawner]https://github.com/GenZmeY/KF2-ZedSpawner[/url] (GNU GPLv3)
|
BIN
PublicationContent/preview.gif
Normal file
BIN
PublicationContent/preview.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 879 KiB |
BIN
PublicationContent/previewFull.gif
Normal file
BIN
PublicationContent/previewFull.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 MiB |
54
README.md
54
README.md
@ -1 +1,53 @@
|
||||
# KF2-ZedSpawner
|
||||
# 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)
|
||||
[](LICENSE)
|
||||
|
||||
# Description
|
||||
Spawner for zeds. Started as a modification of the [this version](https://steamcommunity.com/sharedfiles/filedetails/?id=2488241348), but now there is almost nothing left of the previous mutator, lol
|
||||
|
||||
# Features
|
||||
- spawn without increasing zed counter;
|
||||
- spawn depends on the number of players;
|
||||
- cyclic spawn (useful for endless mode);
|
||||
- separate spawn for special waves and boss waves;
|
||||
- spawn after a certain percentage of killed zeds.
|
||||
|
||||
# Usage & Setup
|
||||
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
|
||||
|
||||
# Spawn calculator
|
||||
[Spawn Calculator](https://docs.google.com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=sharing)
|
||||
|
||||
# Build
|
||||
**Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here.
|
||||
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
|
||||
2. open git-bash and go to any folder where you want to store sources:
|
||||
`cd <ANY_FOLDER_YOU_WANT>`
|
||||
3. Clone this repository and go to the source folder:
|
||||
`git clone https://github.com/GenZmeY/KF2-ZedSpawner && cd KF2-ZedSpawner`
|
||||
4. Download dependencies:
|
||||
`git submodule init && git submodule update`
|
||||
5. Compile:
|
||||
`./tools/builder -c`
|
||||
5. The compiled files will be here:
|
||||
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
|
||||
|
||||
# Testing
|
||||
Open git-bash in the source folder and run command:
|
||||
`./tools/builder -t`
|
||||
(or `./tools/builder -ct` if you haven't compiled the mutator yet)
|
||||
|
||||
A local single-user test will be launched with parameters from `builder.cfg` (edit this file if you want to test mutator with different parameters).
|
||||
|
||||
# Bug reports
|
||||
If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ZedSpawner/issues) and check if there is a description of your bug. If not, create a new issue.
|
||||
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)
|
||||
|
@ -11,6 +11,7 @@ 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)
|
||||
{
|
||||
@ -19,6 +20,9 @@ public static function InitConfig(int Version, int LatestVersion)
|
||||
case `NO_CONFIG:
|
||||
ApplyDefault();
|
||||
|
||||
case 3:
|
||||
default.bSmoothSpawn = false;
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
@ -32,6 +36,7 @@ private static function ApplyDefault()
|
||||
{
|
||||
default.bCyclicalSpawn = true;
|
||||
default.bShadowSpawn = true;
|
||||
default.bSmoothSpawn = true;
|
||||
default.ZedTotalMultiplier = 1.0;
|
||||
default.SpawnTotalPlayerMultiplier = 0.75;
|
||||
default.SpawnTotalCycleMultiplier = 0.75;
|
||||
@ -47,37 +52,43 @@ public static function bool Load(E_LogLevel LogLevel)
|
||||
|
||||
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)
|
||||
{
|
||||
`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;
|
||||
}
|
||||
|
||||
|
74
ZedSpawner/Classes/SpawnAtPlayerStart.uc
Normal file
74
ZedSpawner/Classes/SpawnAtPlayerStart.uc
Normal file
@ -0,0 +1,74 @@
|
||||
class SpawnAtPlayerStart extends Object
|
||||
dependson(ZedSpawner)
|
||||
config(ZedSpawner);
|
||||
|
||||
var private config Array<String> ZedClass;
|
||||
var public config Array<String> Map;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion)
|
||||
{
|
||||
switch (Version)
|
||||
{
|
||||
case `NO_CONFIG:
|
||||
case 2:
|
||||
ApplyDefault();
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
if (LatestVersion != Version)
|
||||
{
|
||||
StaticSaveConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private static function ApplyDefault()
|
||||
{
|
||||
default.ZedClass.Length = 0;
|
||||
default.ZedClass.AddItem("HL2Monsters.Combine_Strider");
|
||||
default.ZedClass.AddItem("HL2Monsters.Combine_Gunship");
|
||||
default.ZedClass.AddItem("HL2Monsters.Hunter_Chopper");
|
||||
default.ZedClass.AddItem("SomePackage.SomeZedClassYouWantToSpawnAtPlayerStart");
|
||||
|
||||
default.Map.Length = 0;
|
||||
default.Map.AddItem("KF-SomeMapNameWhereYouWantSpawnZedsAtPlayerStart");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
`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)
|
||||
{
|
||||
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZedList.AddItem(KFPMC);
|
||||
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (ZedList.Length == default.ZedClass.Length)
|
||||
{
|
||||
`Log_Info("Spawn at player start list (Zeds) loaded successfully (" $ default.ZedClass.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Spawn at player start list (Zeds): loaded" @ ZedList.Length @ "of" @ default.ZedClass.Length @ "entries");
|
||||
}
|
||||
|
||||
return ZedList;
|
||||
}
|
||||
|
||||
defaultproperties
|
||||
{
|
||||
|
||||
}
|
@ -10,10 +10,9 @@ struct S_SpawnEntryCfg
|
||||
var int Probability;
|
||||
var int SpawnCountBase;
|
||||
var int SingleSpawnLimit;
|
||||
var bool bSpawnAtPlayerStart;
|
||||
};
|
||||
|
||||
var public config bool bStopRegularSpawn;
|
||||
var public config bool bStopRegularSpawn;
|
||||
var private config Array<S_SpawnEntryCfg> Spawn;
|
||||
|
||||
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA)
|
||||
@ -34,9 +33,11 @@ public static function InitConfig(int Version, int LatestVersion, KFGI_Access KF
|
||||
|
||||
private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local Array<class<KFPawn_Monster> > KFPM_Bosses;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
default.Spawn.Length = 0;
|
||||
|
||||
default.bStopRegularSpawn = true;
|
||||
default.Spawn.Length = 0;
|
||||
@ -45,7 +46,6 @@ private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
SpawnEntry.SingleSpawnLimit = 1;
|
||||
SpawnEntry.Delay = 30;
|
||||
SpawnEntry.Probability = 100;
|
||||
SpawnEntry.bSpawnAtPlayerStart = false;
|
||||
KFPM_Bosses = KFGIA.GetAIBossClassList();
|
||||
foreach KFPM_Bosses(KFPMC)
|
||||
{
|
||||
@ -62,7 +62,7 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
|
||||
local int Line;
|
||||
local bool Errors;
|
||||
|
||||
`ZS_Info("Load boss waves spawn list:");
|
||||
`Log_Info("Load boss waves spawn list:");
|
||||
foreach default.Spawn(SpawnEntryCfg, Line)
|
||||
{
|
||||
Errors = false;
|
||||
@ -70,14 +70,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;
|
||||
}
|
||||
|
||||
@ -86,40 +86,47 @@ 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;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Info("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ SpawnEntryCfg.BossClass @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.BossClass $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
}
|
||||
}
|
||||
|
||||
if (SpawnList.Length == default.Spawn.Length)
|
||||
{
|
||||
`Log_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Boss spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
}
|
||||
|
||||
|
@ -11,11 +11,15 @@ struct S_SpawnEntryCfg
|
||||
var int Probability;
|
||||
var int SpawnCountBase;
|
||||
var int SingleSpawnLimit;
|
||||
var bool bSpawnAtPlayerStart;
|
||||
};
|
||||
|
||||
var public config Array<S_SpawnEntryCfg> Spawn;
|
||||
|
||||
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)
|
||||
{
|
||||
switch (Version)
|
||||
@ -34,9 +38,9 @@ public static function InitConfig(int Version, int LatestVersion, KFGI_Access KF
|
||||
|
||||
private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local Array<class<KFPawn_Monster> > KFPM_Zeds;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
local class<KFPawn_Monster> KFPMC;
|
||||
|
||||
default.Spawn.Length = 0;
|
||||
|
||||
@ -46,8 +50,7 @@ private static function ApplyDefault(KFGI_Access KFGIA)
|
||||
SpawnEntry.RelativeStart = 25;
|
||||
SpawnEntry.Delay = 60;
|
||||
SpawnEntry.Probability = 100;
|
||||
SpawnEntry.bSpawnAtPlayerStart = false;
|
||||
|
||||
|
||||
KFPM_Zeds = KFGIA.GetAIClassList();
|
||||
foreach KFPM_Zeds(KFPMC)
|
||||
{
|
||||
@ -65,7 +68,7 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
|
||||
local int Line;
|
||||
local bool Errors;
|
||||
|
||||
`ZS_Info("Load spawn list:");
|
||||
`Log_Info("Load spawn list:");
|
||||
foreach default.Spawn(SpawnEntryCfg, Line)
|
||||
{
|
||||
Errors = false;
|
||||
@ -73,61 +76,70 @@ 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;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Info("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ SpawnEntryCfg.Wave @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
}
|
||||
}
|
||||
|
||||
default.Spawn.Sort(SpawnListSort);
|
||||
|
||||
if (SpawnList.Length == default.Spawn.Length)
|
||||
{
|
||||
`Log_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Regular spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@ struct S_SpawnEntryCfg
|
||||
var int Probability;
|
||||
var int SpawnCountBase;
|
||||
var int SingleSpawnLimit;
|
||||
var bool bSpawnAtPlayerStart;
|
||||
};
|
||||
|
||||
var public config bool bStopRegularSpawn;
|
||||
@ -36,7 +35,7 @@ public static function InitConfig(int Version, int LatestVersion)
|
||||
private static function ApplyDefault()
|
||||
{
|
||||
local S_SpawnEntryCfg SpawnEntry;
|
||||
local EAIType AIType;
|
||||
local EAIType AIType;
|
||||
|
||||
default.bStopRegularSpawn = true;
|
||||
default.Spawn.Length = 0;
|
||||
@ -46,7 +45,6 @@ private static function ApplyDefault()
|
||||
SpawnEntry.RelativeStart = 0;
|
||||
SpawnEntry.Delay = 60;
|
||||
SpawnEntry.Probability = 100;
|
||||
SpawnEntry.bSpawnAtPlayerStart = false;
|
||||
foreach class'KFGameInfo_Endless'.default.SpecialWaveTypes(AIType)
|
||||
{
|
||||
SpawnEntry.Wave = AIType;
|
||||
@ -64,11 +62,11 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
|
||||
|
||||
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;
|
||||
@ -76,61 +74,68 @@ 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;
|
||||
}
|
||||
|
||||
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
|
||||
|
||||
if (!Errors)
|
||||
{
|
||||
SpawnList.AddItem(SpawnEntry);
|
||||
`ZS_Info("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ SpawnEntryCfg.Wave @ SpawnEntryCfg.ZedClass);
|
||||
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
|
||||
}
|
||||
}
|
||||
|
||||
if (SpawnList.Length == default.Spawn.Length)
|
||||
{
|
||||
`Log_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
|
||||
}
|
||||
else
|
||||
{
|
||||
`Log_Info("Special spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
|
||||
}
|
||||
|
||||
return SpawnList;
|
||||
}
|
||||
|
||||
|
@ -1,47 +1,39 @@
|
||||
class ZedSpawner extends Info
|
||||
config(ZedSpawner);
|
||||
|
||||
const LatestVersion = 1;
|
||||
const LatestVersion = 4;
|
||||
|
||||
const dt = 1;
|
||||
|
||||
const CfgSpawn = class'Spawn';
|
||||
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
|
||||
};
|
||||
const CfgSpawn = class'Spawn';
|
||||
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
|
||||
const CfgSpawnListRW = class'SpawnListRegular';
|
||||
const CfgSpawnListBW = class'SpawnListBossWaves';
|
||||
const CfgSpawnListSW = class'SpawnListSpecialWaves';
|
||||
|
||||
struct S_SpawnEntry
|
||||
{
|
||||
var class<KFPawn_Monster> BossClass;
|
||||
var class<KFPawn_Monster> ZedClass;
|
||||
var byte Wave;
|
||||
var int SpawnCountBase;
|
||||
var int SingleSpawnLimitDefault;
|
||||
var int SingleSpawnLimit;
|
||||
var float Probability;
|
||||
var float RelativeStartDefault;
|
||||
var float RelativeStart;
|
||||
var int DelayDefault;
|
||||
var int Delay;
|
||||
var int SpawnsLeft;
|
||||
var int SpawnsTotal;
|
||||
var bool SpawnAtPlayerStart;
|
||||
var byte Wave;
|
||||
var int SpawnCountBase;
|
||||
var int SingleSpawnLimitDefault;
|
||||
var int SingleSpawnLimit;
|
||||
var float Probability;
|
||||
var float RelativeStartDefault;
|
||||
var float RelativeStart;
|
||||
var int DelayDefault;
|
||||
var float Delay;
|
||||
var int PawnsLeft;
|
||||
var int PawnsTotal;
|
||||
var bool ForceSpawn;
|
||||
var String ZedNameFiller;
|
||||
var int SmoothPawnPool;
|
||||
};
|
||||
|
||||
var private config int Version;
|
||||
var private config E_LogLevel LogLevel;
|
||||
var private config float Tickrate;
|
||||
|
||||
var private float dt;
|
||||
|
||||
var private Array<S_SpawnEntry> SpawnListRW;
|
||||
var private Array<S_SpawnEntry> SpawnListBW;
|
||||
@ -52,6 +44,7 @@ var private bool NoFreeSpawnSlots;
|
||||
var private bool UseRegularSpawnList;
|
||||
var private bool UseBossSpawnList;
|
||||
var private bool UseSpecialSpawnList;
|
||||
var private bool GlobalSpawnAtPlayerStart;
|
||||
|
||||
var private KFGameInfo_Survival KFGIS;
|
||||
var private KFGameInfo_Endless KFGIE;
|
||||
@ -65,22 +58,27 @@ var private int CycleWaveSize;
|
||||
var private int WaveTotalAI;
|
||||
|
||||
var private class<KFPawn_Monster> CurrentBossClass;
|
||||
var private Array<class<KFPawn_Monster> > BossClassCache;
|
||||
var private Array<class<KFPawn_Monster> > CustomZeds;
|
||||
var private Array<class<KFPawn_Monster> > SpawnAtPlayerStartZeds;
|
||||
|
||||
var private String SpawnTimerLastMessage;
|
||||
var private bool SpawnActive;
|
||||
var private String SpawnListsComment;
|
||||
|
||||
delegate bool WaveCondition(S_SpawnEntry SE);
|
||||
var private Array<ZedSpawnerRepLink> RepLinks;
|
||||
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (WorldInfo.NetMode == NM_Client)
|
||||
{
|
||||
`ZS_Fatal("NetMode == NM_Client, Destroy...");
|
||||
Destroy();
|
||||
`Log_Fatal("NetMode == NM_Client, Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -89,9 +87,9 @@ public event PreBeginPlay()
|
||||
|
||||
public event PostBeginPlay()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (bPendingDelete) return;
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
Super.PostBeginPlay();
|
||||
|
||||
@ -107,6 +105,7 @@ private function InitConfig()
|
||||
}
|
||||
|
||||
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);
|
||||
@ -114,20 +113,26 @@ private function InitConfig()
|
||||
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;
|
||||
}
|
||||
|
||||
@ -141,14 +146,15 @@ private function InitConfig()
|
||||
private function Init()
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local String CurrentMap;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
KFGIS = KFGameInfo_Survival(WorldInfo.Game);
|
||||
if (KFGIS == None)
|
||||
{
|
||||
`ZS_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
|
||||
Destroy();
|
||||
`Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -160,21 +166,34 @@ private function Init()
|
||||
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 (!CfgSpawn.static.Load(LogLevel))
|
||||
if (Tickrate <= 0)
|
||||
{
|
||||
`ZS_Fatal("Wrong settings, Destroy...");
|
||||
Destroy();
|
||||
`Log_Error("Spawner tickrate must be positive (current value:" @ Tickrate $ ")");
|
||||
}
|
||||
|
||||
if (!CfgSpawn.static.Load(LogLevel) || Tickrate <= 0)
|
||||
{
|
||||
`Log_Fatal("Wrong settings, Destroy...");
|
||||
SafeDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
dt = 1 / Tickrate;
|
||||
`Log_Info("Spawner tickrate:" @ Tickrate @ "(update every" @ dt $ "s)");
|
||||
|
||||
SpawnListRW = CfgSpawnListRW.static.Load(LogLevel);
|
||||
SpawnListBW = CfgSpawnListBW.static.Load(LogLevel);
|
||||
SpawnListSW = CfgSpawnListSW.static.Load(KFGIE, LogLevel);
|
||||
SpawnAtPlayerStartZeds = CfgSpawnAtPlayerStart.static.Load(LogLevel);
|
||||
|
||||
CurrentMap = String(WorldInfo.GetPackageName());
|
||||
GlobalSpawnAtPlayerStart = (CfgSpawnAtPlayerStart.default.Map.Find(CurrentMap) != INDEX_NONE);
|
||||
`Log_Info("GlobalSpawnAtPlayerStart:" @ GlobalSpawnAtPlayerStart $ GlobalSpawnAtPlayerStart ? "(" $ CurrentMap $ ")" : "");
|
||||
|
||||
CurrentWave = INDEX_NONE;
|
||||
SpecialWave = INDEX_NONE;
|
||||
@ -192,19 +211,9 @@ private function Init()
|
||||
CycleWaveSize = CycleWaveSize - CycleWaveShift + 1;
|
||||
}
|
||||
|
||||
CreateBossCache();
|
||||
PreloadContent();
|
||||
|
||||
SetTimer(float(dt), true, nameof(SpawnTimer));
|
||||
}
|
||||
|
||||
private function CreateBossCache()
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
|
||||
foreach SpawnListBW(SE)
|
||||
if (BossClassCache.Find(SE.BossClass) == INDEX_NONE)
|
||||
BossClassCache.AddItem(SE.BossClass);
|
||||
SetTimer(dt, true, nameof(SpawnTimer));
|
||||
}
|
||||
|
||||
private function PreloadContent()
|
||||
@ -217,7 +226,7 @@ private function PreloadContent()
|
||||
|
||||
foreach CustomZeds(PawnClass)
|
||||
{
|
||||
`ZS_Info("Preload content:" @ PawnClass);
|
||||
`Log_Info("Preload content:" @ PawnClass);
|
||||
PawnClass.static.PreloadContent();
|
||||
}
|
||||
}
|
||||
@ -236,31 +245,13 @@ private function ExtractCustomZedsFromSpawnList(Array<S_SpawnEntry> SpawnList, o
|
||||
}
|
||||
}
|
||||
|
||||
public function bool WaveConditionRegular(S_SpawnEntry SE)
|
||||
{
|
||||
return (SE.Wave == KFGIS.WaveNum - CycleWaveSize * (CurrentCycle - 1));
|
||||
}
|
||||
|
||||
public function bool WaveConditionBoss(S_SpawnEntry SE)
|
||||
{
|
||||
if (CurrentBossClass == None)
|
||||
return false;
|
||||
else
|
||||
return (SE.BossClass == CurrentBossClass);
|
||||
}
|
||||
|
||||
public function bool WaveConditionSpecial(S_SpawnEntry SE)
|
||||
{
|
||||
return (SE.Wave == SpecialWave);
|
||||
}
|
||||
|
||||
|
||||
private function SpawnTimer()
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local int Index;
|
||||
local int Index;
|
||||
local float Threshold;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (KFGIS.WaveNum != 0 && CurrentWave < KFGIS.WaveNum)
|
||||
{
|
||||
@ -273,6 +264,12 @@ private function SpawnTimer()
|
||||
return;
|
||||
}
|
||||
|
||||
if (SpawnListCurrent.Length == 0)
|
||||
{
|
||||
SpawnTimerLogger(true, "No spawn list for this wave");
|
||||
return;
|
||||
}
|
||||
|
||||
if (CfgSpawn.default.AliveSpawnLimit > 0 && KFGIS.AIAliveCount >= CfgSpawn.default.AliveSpawnLimit)
|
||||
{
|
||||
SpawnTimerLogger(true, "alive spawn limit reached");
|
||||
@ -291,20 +288,26 @@ private function SpawnTimer()
|
||||
|
||||
SpawnTimerLogger(false, SpawnListsComment);
|
||||
|
||||
Threshold = 1.0f - (float(KFGIS.MyKFGRI.AIRemaining) / float(WaveTotalAI));
|
||||
foreach SpawnListCurrent(SE, Index)
|
||||
{
|
||||
if (!ReadyToStart(SE))
|
||||
if (NoFreeSpawnSlots)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (SE.RelativeStart != 0.0f && SE.RelativeStart > Threshold)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SE.Delay > 0)
|
||||
if (SE.Delay > 0.0f)
|
||||
{
|
||||
SpawnListCurrent[Index].Delay -= dt;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SE.SpawnsLeft > 0)
|
||||
if (SE.PawnsLeft > 0)
|
||||
{
|
||||
SpawnEntry(SpawnListCurrent, Index);
|
||||
}
|
||||
@ -315,24 +318,33 @@ private function SetupWave()
|
||||
{
|
||||
local Array<String> SpawnListNames;
|
||||
local int WaveTotalAIDef;
|
||||
local byte BaseWave;
|
||||
local String WaveTypeInfo;
|
||||
local S_SpawnEntry SE;
|
||||
local EAIType SWType;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
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;
|
||||
|
||||
if (KFGIE != None)
|
||||
{
|
||||
if (KFGameReplicationInfo_Endless(KFGIE.GameReplicationInfo).CurrentWeeklyMode != INDEX_NONE)
|
||||
{
|
||||
WaveTypeInfo = "Weekly:" @ KFGameReplicationInfo_Endless(KFGIE.GameReplicationInfo).CurrentWeeklyMode;
|
||||
}
|
||||
|
||||
SpecialWave = KFGameReplicationInfo_Endless(KFGIE.GameReplicationInfo).CurrentSpecialMode;
|
||||
if (SpecialWave != INDEX_NONE)
|
||||
{
|
||||
WaveTypeInfo = "Special:" @ EAIType(SpecialWave);
|
||||
SWType = EAIType(SpecialWave);
|
||||
WaveTypeInfo = "Special:" @ SWType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,7 +353,7 @@ private function SetupWave()
|
||||
CurrentBossClass = KFGIA.BossAITypePawn(EBossAIType(KFGIS.MyKFGRI.BossIndex));
|
||||
if (CurrentBossClass == None)
|
||||
{
|
||||
`ZS_Error("Can't determine boss class:" @ CurrentBossClass);
|
||||
`Log_Error("Can't determine boss class. Boss index:" @ KFGIS.MyKFGRI.BossIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -358,7 +370,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;
|
||||
@ -375,84 +387,99 @@ private function SetupWave()
|
||||
if (UseRegularSpawnList)
|
||||
{
|
||||
SpawnListNames.AddItem("regular");
|
||||
FillCurrentSpawnList(SpawnListRW, WaveConditionRegular);
|
||||
BaseWave = KFGIS.WaveNum - CycleWaveSize * (CurrentCycle - 1);
|
||||
foreach SpawnListRW(SE)
|
||||
if (SE.Wave == BaseWave)
|
||||
SpawnListCurrent.AddItem(SE);
|
||||
else if (SE.Wave > BaseWave)
|
||||
break;
|
||||
}
|
||||
|
||||
if (UseSpecialSpawnList)
|
||||
{
|
||||
SpawnListNames.AddItem("special");
|
||||
FillCurrentSpawnList(SpawnListSW, WaveConditionSpecial);
|
||||
foreach SpawnListSW(SE)
|
||||
if (SE.Wave == SpecialWave)
|
||||
SpawnListCurrent.AddItem(SE);
|
||||
}
|
||||
|
||||
if (UseBossSpawnList)
|
||||
{
|
||||
SpawnListNames.AddItem("boss");
|
||||
FillCurrentSpawnList(SpawnListBW, WaveConditionBoss);
|
||||
foreach SpawnListBW(SE)
|
||||
if (SE.BossClass == CurrentBossClass)
|
||||
SpawnListCurrent.AddItem(SE);
|
||||
}
|
||||
|
||||
JoinArray(SpawnListNames, SpawnListsComment, ", ");
|
||||
ResetSpawnList(SpawnListCurrent);
|
||||
AdjustSpawnList(SpawnListCurrent);
|
||||
|
||||
if (WaveTypeInfo != "")
|
||||
{
|
||||
WaveTypeInfo = "(" $ WaveTypeInfo $ ")";
|
||||
}
|
||||
|
||||
`ZS_Info("Wave" @ CurrentWave @ WaveTypeInfo);
|
||||
`Log_Info("Wave" @ CurrentWave @ WaveTypeInfo);
|
||||
}
|
||||
|
||||
private function FillCurrentSpawnList(Array<S_SpawnEntry> SpawnList, delegate<WaveCondition> Condition)
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
foreach SpawnList(SE)
|
||||
if (Condition(SE))
|
||||
SpawnListCurrent.AddItem(SE);
|
||||
}
|
||||
|
||||
private function ResetSpawnList(out Array<S_SpawnEntry> List)
|
||||
private function AdjustSpawnList(out Array<S_SpawnEntry> List)
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local int Index;
|
||||
local float Cycle, Players;
|
||||
local float MSB, MSC, MSP;
|
||||
local float MLB, MLC, MLP;
|
||||
local float B, TM, TCM, TPM;
|
||||
local float L, LM, LCM, LPM;
|
||||
local float PawnTotalF, PawnLimitF;
|
||||
local int ZedNameMaxLength;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
Cycle = float(CurrentCycle);
|
||||
Players = float(PlayerCount());
|
||||
|
||||
MSB = CfgSpawn.default.ZedTotalMultiplier;
|
||||
MSC = CfgSpawn.default.SpawnTotalCycleMultiplier;
|
||||
MSP = CfgSpawn.default.SpawnTotalPlayerMultiplier;
|
||||
TM = CfgSpawn.default.ZedTotalMultiplier;
|
||||
TCM = CfgSpawn.default.SpawnTotalCycleMultiplier;
|
||||
TPM = CfgSpawn.default.SpawnTotalPlayerMultiplier;
|
||||
|
||||
MLB = CfgSpawn.default.SingleSpawnLimitMultiplier;
|
||||
MLC = CfgSpawn.default.SingleSpawnLimitCycleMultiplier;
|
||||
MLP = CfgSpawn.default.SingleSpawnLimitPlayerMultiplier;
|
||||
|
||||
LM = CfgSpawn.default.SingleSpawnLimitMultiplier;
|
||||
LCM = CfgSpawn.default.SingleSpawnLimitCycleMultiplier;
|
||||
LPM = CfgSpawn.default.SingleSpawnLimitPlayerMultiplier;
|
||||
|
||||
ZedNameMaxLength = 0;
|
||||
foreach List(SE, Index)
|
||||
{
|
||||
ZedNameMaxLength = Max(ZedNameMaxLength, Len(String(SE.ZedClass)));
|
||||
if (KFGIS.MyKFGRI.IsBossWave())
|
||||
{
|
||||
List[Index].RelativeStart = 0.f;
|
||||
List[Index].Delay = SE.DelayDefault;
|
||||
List[Index].Delay = float(SE.DelayDefault);
|
||||
}
|
||||
else
|
||||
{
|
||||
List[Index].RelativeStart = SE.RelativeStartDefault;
|
||||
if (List[Index].RelativeStart == 0.f)
|
||||
List[Index].Delay = SE.DelayDefault;
|
||||
List[Index].Delay = float(SE.DelayDefault);
|
||||
else
|
||||
List[Index].Delay = 0;
|
||||
List[Index].Delay = 0.0f;
|
||||
}
|
||||
|
||||
List[Index].SpawnsTotal = Round(SE.SpawnCountBase * (MSB + MSC * (Cycle - 1.0f) + MSP * (Players - 1.0f)));
|
||||
List[Index].SpawnsLeft = List[Index].SpawnsTotal;
|
||||
|
||||
List[Index].SingleSpawnLimit = Round(SE.SingleSpawnLimitDefault * (MLB + MLC * (Cycle - 1.0f) + MLP * (Players - 1.0f)));
|
||||
B = float(SE.SpawnCountBase);
|
||||
L = float(SE.SingleSpawnLimitDefault);
|
||||
|
||||
PawnTotalF = B * (TM + TCM * (Cycle - 1.0f) + TPM * (Players - 1.0f));
|
||||
PawnLimitF = L * (LM + LCM * (Cycle - 1.0f) + LPM * (Players - 1.0f));
|
||||
|
||||
List[Index].ForceSpawn = false;
|
||||
List[Index].PawnsTotal = Max(Round(PawnTotalF), 1);
|
||||
List[Index].SingleSpawnLimit = Max(Round(PawnLimitF), 1);
|
||||
List[Index].PawnsLeft = List[Index].PawnsTotal;
|
||||
}
|
||||
|
||||
foreach List(SE, Index)
|
||||
{
|
||||
List[Index].ZedNameFiller = "";
|
||||
while (Len(String(SE.ZedClass)) + Len(List[Index].ZedNameFiller) < ZedNameMaxLength)
|
||||
List[Index].ZedNameFiller @= "";
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,7 +487,7 @@ private function SpawnTimerLogger(bool Stop, optional String Comment)
|
||||
{
|
||||
local String Message;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (Stop)
|
||||
Message = "Stop spawn";
|
||||
@ -470,44 +497,45 @@ private function SpawnTimerLogger(bool Stop, optional String Comment)
|
||||
if (Comment != "")
|
||||
Message @= "(" $ Comment $ ")";
|
||||
|
||||
if (Message != SpawnTimerLastMessage)
|
||||
if (SpawnActive == Stop)
|
||||
{
|
||||
`ZS_Info(Message);
|
||||
SpawnTimerLastMessage = Message;
|
||||
}
|
||||
}
|
||||
|
||||
private function bool ReadyToStart(S_SpawnEntry SE)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
if (SE.RelativeStart == 0.f)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (SE.RelativeStart <= 1.0f - (float(KFGIS.MyKFGRI.AIRemaining) / float(WaveTotalAI)));
|
||||
`Log_Info(Message);
|
||||
SpawnActive = !Stop;
|
||||
}
|
||||
}
|
||||
|
||||
private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
{
|
||||
local S_SpawnEntry SE;
|
||||
local int FreeSpawnSlots, SpawnCount, Spawned;
|
||||
local String Message;
|
||||
local int FreeSpawnSlots, PawnCount, Spawned;
|
||||
local String Action, Comment, NextSpawn;
|
||||
local bool SpawnAtPlayerStart;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
SE = SpawnList[Index];
|
||||
|
||||
SpawnList[Index].Delay = SE.DelayDefault;
|
||||
if (FRand() <= SE.Probability)
|
||||
SpawnList[Index].Delay = float(SE.DelayDefault);
|
||||
|
||||
if (FRand() <= SE.Probability || SE.ForceSpawn)
|
||||
{
|
||||
if (SE.SingleSpawnLimit == 0 || SE.SpawnsLeft < SE.SingleSpawnLimit)
|
||||
SpawnCount = SE.SpawnsLeft;
|
||||
if (SE.SingleSpawnLimit == 0 || SE.PawnsLeft < SE.SingleSpawnLimit)
|
||||
{
|
||||
PawnCount = SE.PawnsLeft;
|
||||
}
|
||||
else
|
||||
SpawnCount = SE.SingleSpawnLimit;
|
||||
{
|
||||
PawnCount = SE.SingleSpawnLimit;
|
||||
}
|
||||
|
||||
if (CfgSpawn.default.bSmoothSpawn)
|
||||
{
|
||||
if (SE.SmoothPawnPool <= 0)
|
||||
{
|
||||
SpawnList[Index].SmoothPawnPool = PawnCount;
|
||||
}
|
||||
PawnCount = 1;
|
||||
}
|
||||
|
||||
if (CfgSpawn.default.bShadowSpawn && !KFGIS.MyKFGRI.IsBossWave())
|
||||
{
|
||||
@ -515,31 +543,83 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
|
||||
if (FreeSpawnSlots == 0)
|
||||
{
|
||||
NoFreeSpawnSlots = true;
|
||||
SpawnList[Index].SpawnsLeft = 0;
|
||||
SpawnList[Index].PawnsLeft = 0;
|
||||
return;
|
||||
}
|
||||
else if (SpawnCount > FreeSpawnSlots)
|
||||
else if (PawnCount > FreeSpawnSlots)
|
||||
{
|
||||
`ZS_Info("Not enough free slots to spawn, will spawn" @ FreeSpawnSlots @ "instead of" @ SpawnCount);
|
||||
SpawnCount = FreeSpawnSlots;
|
||||
PawnCount = FreeSpawnSlots;
|
||||
}
|
||||
}
|
||||
|
||||
Spawned = SpawnZed(SE.ZedClass, SpawnCount, SE.SpawnAtPlayerStart);
|
||||
Message = "Spawned:" @ SE.ZedClass @ "x" $ Spawned;
|
||||
SpawnAtPlayerStart = (GlobalSpawnAtPlayerStart || (SpawnAtPlayerStartZeds.Find(SE.ZedClass) != INDEX_NONE));
|
||||
|
||||
Spawned = SpawnZed(SE.ZedClass, PawnCount, SpawnAtPlayerStart);
|
||||
if (Spawned == INDEX_NONE)
|
||||
{
|
||||
SpawnList[Index].Delay = 5.0f;
|
||||
SpawnList[Index].ForceSpawn = true;
|
||||
Action = "Skip spawn";
|
||||
Comment = "no free spawn volume, try to spawn it again in" @ Round(SpawnList[Index].Delay) @ "seconds...";
|
||||
SpawnLog(SE, Action, Comment);
|
||||
return;
|
||||
}
|
||||
else if (Spawned == 0)
|
||||
{
|
||||
Action = "Spawn failed";
|
||||
}
|
||||
else
|
||||
{
|
||||
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
|
||||
{
|
||||
Message = "Skip spawn" @ SE.ZedClass @ "due to probability:" @ SE.Probability * 100 $ "%";
|
||||
Action = "Skip spawn";
|
||||
Comment = "due to" @ Round(SE.Probability * 100) $ "%" @ "probability";
|
||||
Spawned = SE.SingleSpawnLimit;
|
||||
}
|
||||
|
||||
SpawnList[Index].SpawnsLeft -= Spawned;
|
||||
if (SpawnList[Index].SpawnsLeft > 0)
|
||||
SpawnList[Index].PawnsLeft -= Spawned;
|
||||
if (SpawnList[Index].PawnsLeft > 0)
|
||||
{
|
||||
Message @= "(Next spawn after" @ SE.DelayDefault $ "sec," @ "spawns left:" @ SpawnList[Index].SpawnsLeft $ ")";
|
||||
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;
|
||||
}
|
||||
}
|
||||
`ZS_Info(Message);
|
||||
SpawnLog(SE, Action, Comment, NextSpawn);
|
||||
}
|
||||
|
||||
private function SpawnLog(S_SpawnEntry SE, String Action, optional String Comment, optional String NextSpawn)
|
||||
{
|
||||
if (Comment != "") Comment = ":" @ Comment;
|
||||
if (NextSpawn != "") NextSpawn = "(" $ NextSpawn $ ")";
|
||||
|
||||
`Log_Info(String(SE.ZedClass) $ SE.ZedNameFiller @ ">" @ Action $ Comment @ NextSpawn);
|
||||
}
|
||||
|
||||
private function int PlayerCount()
|
||||
@ -548,7 +628,7 @@ private function int PlayerCount()
|
||||
local int HumanPlayers;
|
||||
local KFOnlineGameSettings KFGameSettings;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (KFGIS.PlayfabInter != None && KFGIS.PlayfabInter.GetGameSettings() != None)
|
||||
{
|
||||
@ -573,7 +653,7 @@ private function Vector PlayerStartLocation()
|
||||
{
|
||||
local PlayerController PC;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
foreach WorldInfo.AllControllers(class'PlayerController', PC)
|
||||
return KFGIS.FindPlayerStart(PC, 0).Location;
|
||||
@ -581,60 +661,86 @@ private function Vector PlayerStartLocation()
|
||||
return KFGIS.FindPlayerStart(None, 0).Location;
|
||||
}
|
||||
|
||||
private function int SpawnZed(class<KFPawn_Monster> ZedClass, int SpawnCount, bool SpawnAtPlayerStart)
|
||||
private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, optional bool SpawnAtPlayerStart = false)
|
||||
{
|
||||
local Array<class<KFPawn_Monster> > CustomSquad;
|
||||
local Vector SpawnLocation;
|
||||
local ESquadType PrevDesiredSquadType;
|
||||
local Vector SpawnLocation, PlayerStart;
|
||||
local KFSpawnVolume SpawnVolume;
|
||||
local KFPawn_Monster KFPM;
|
||||
local Controller C;
|
||||
local int SpawnFailed, Spawned;
|
||||
local int Failed, Spawned;
|
||||
local int Index;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
for (Index = 0; Index < SpawnCount; Index++)
|
||||
CustomSquad.AddItem(ZedClass);
|
||||
|
||||
PlayerStart = PlayerStartLocation();
|
||||
if (SpawnAtPlayerStart)
|
||||
{
|
||||
SpawnLocation = PlayerStartLocation();
|
||||
SpawnLocation = PlayerStart;
|
||||
SpawnLocation.Y += 64;
|
||||
SpawnLocation.Z += 64;
|
||||
}
|
||||
else
|
||||
{
|
||||
SpawnLocation = KFGIS.SpawnManager.GetBestSpawnVolume(CustomSquad).Location;
|
||||
for (Index = 0; Index < PawnCount; Index++)
|
||||
{
|
||||
CustomSquad.AddItem(ZedClass);
|
||||
}
|
||||
|
||||
PrevDesiredSquadType = KFGIS.SpawnManager.DesiredSquadType;
|
||||
KFGIS.SpawnManager.SetDesiredSquadTypeForZedList(CustomSquad);
|
||||
SpawnVolume = KFGIS.SpawnManager.GetBestSpawnVolume(CustomSquad);
|
||||
KFGIS.SpawnManager.DesiredSquadType = PrevDesiredSquadType;
|
||||
|
||||
if (SpawnVolume == None)
|
||||
{
|
||||
return INDEX_NONE;
|
||||
}
|
||||
|
||||
SpawnVolume.VolumeChosenCount++;
|
||||
|
||||
SpawnLocation = SpawnVolume.Location;
|
||||
if (SpawnLocation == PlayerStart)
|
||||
{
|
||||
return INDEX_NONE;
|
||||
}
|
||||
|
||||
SpawnLocation.Z += 10;
|
||||
}
|
||||
|
||||
SpawnFailed = 0;
|
||||
for (Index = 0; Index < SpawnCount; Index++)
|
||||
Spawned = 0; Failed = 0;
|
||||
while (Failed + Spawned < PawnCount)
|
||||
{
|
||||
KFPM = Spawn(ZedClass,,, SpawnLocation, rot(0,0,1),, true);
|
||||
if (KFPM == None)
|
||||
{
|
||||
`ZS_Error("Can't spawn" @ ZedClass);
|
||||
SpawnFailed++;
|
||||
`Log_Error("Can't spawn" @ ZedClass);
|
||||
Failed++;
|
||||
continue;
|
||||
}
|
||||
|
||||
C = KFPM.Spawn(KFPM.ControllerClass);
|
||||
if (C == None)
|
||||
{
|
||||
`ZS_Error("Can't spawn controller for" @ ZedClass $ ". Destroy this KFPawn...");
|
||||
`Log_Error("Can't spawn controller for" @ ZedClass $ ". Destroy this" @ KFPM $ "...");
|
||||
KFPM.Destroy();
|
||||
SpawnFailed++;
|
||||
Failed++;
|
||||
continue;
|
||||
}
|
||||
C.Possess(KFPM, false);
|
||||
Spawned++;
|
||||
}
|
||||
|
||||
if (Spawned > 0)
|
||||
{
|
||||
KFGIS.SpawnManager.LastAISpawnVolume = SpawnVolume;
|
||||
}
|
||||
|
||||
Spawned = (SpawnCount - SpawnFailed);
|
||||
|
||||
if (CfgSpawn.default.bShadowSpawn && !KFGIS.MyKFGRI.IsBossWave())
|
||||
{
|
||||
KFGIS.NumAIFinishedSpawning += Spawned;
|
||||
KFGIS.NumAISpawnsQueued += Spawned;
|
||||
KFGIS.NumAISpawnsQueued += Spawned;
|
||||
}
|
||||
|
||||
KFGIS.UpdateAIRemaining();
|
||||
@ -644,21 +750,60 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int SpawnCount, bo
|
||||
|
||||
public function NotifyLogin(Controller C)
|
||||
{
|
||||
local ZedSpawnerRepLink RepLink;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
|
||||
RepLink = Spawn(class'ZedSpawnerRepLink', C);
|
||||
RepLink.LogLevel = LogLevel;
|
||||
RepLink.CustomZeds = CustomZeds;
|
||||
RepLink.ServerSync();
|
||||
`Log_Trace(`Location);
|
||||
|
||||
CreateRepLink(C);
|
||||
}
|
||||
|
||||
public function NotifyLogout(Controller C)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
DestroyRepLink(C);
|
||||
}
|
||||
|
||||
public function bool CreateRepLink(Controller C)
|
||||
{
|
||||
local ZedSpawnerRepLink RepLink;
|
||||
|
||||
return;
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (C == None) return false;
|
||||
|
||||
RepLink = Spawn(class'ZedSpawnerRepLink', C);
|
||||
|
||||
if (RepLink == None) return false;
|
||||
|
||||
RepLink.LogLevel = LogLevel;
|
||||
RepLink.CustomZeds = CustomZeds;
|
||||
RepLink.ZS = Self;
|
||||
|
||||
RepLinks.AddItem(RepLink);
|
||||
|
||||
RepLink.ServerSync();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function bool DestroyRepLink(Controller C)
|
||||
{
|
||||
local ZedSpawnerRepLink RepLink;
|
||||
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (C == None) return false;
|
||||
|
||||
foreach RepLinks(RepLink)
|
||||
{
|
||||
if (RepLink.Owner == C)
|
||||
{
|
||||
RepLink.SafeDestroy();
|
||||
RepLinks.RemoveItem(RepLink);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DefaultProperties
|
||||
|
@ -3,7 +3,7 @@ class ZedSpawnerMut extends KFMutator
|
||||
|
||||
var private ZedSpawner ZS;
|
||||
|
||||
event PreBeginPlay()
|
||||
public event PreBeginPlay()
|
||||
{
|
||||
Super.PreBeginPlay();
|
||||
|
||||
@ -11,19 +11,19 @@ event PreBeginPlay()
|
||||
|
||||
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
|
||||
{
|
||||
`ZS_Log("Found 'ZedSpawner'");
|
||||
`Log_Base("Found 'ZedSpawner'");
|
||||
break;
|
||||
}
|
||||
|
||||
if (ZS == None)
|
||||
{
|
||||
`ZS_Log("Spawn 'ZedSpawner'");
|
||||
`Log_Base("Spawn 'ZedSpawner'");
|
||||
ZS = WorldInfo.Spawn(class'ZedSpawner');
|
||||
}
|
||||
|
||||
if (ZS == None)
|
||||
{
|
||||
`ZS_Log("Can't Spawn 'ZedSpawner', Destroy...");
|
||||
`Log_Base("Can't Spawn 'ZedSpawner', Destroy...");
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
class ZedSpawnerRepLink extends ReplicationInfo;
|
||||
|
||||
var public E_LogLevel LogLevel;
|
||||
var public Array<class<KFPawn_Monster> > CustomZeds;
|
||||
var private int Recieved;
|
||||
var public ZedSpawner ZS;
|
||||
var public E_LogLevel LogLevel;
|
||||
var public Array<class<KFPawn_Monster> > CustomZeds;
|
||||
var private int Recieved;
|
||||
|
||||
replication
|
||||
{
|
||||
@ -10,13 +11,16 @@ replication
|
||||
LogLevel;
|
||||
}
|
||||
|
||||
public simulated function bool SafeDestroy() { if (!bPendingDelete) return Destroy(); else return true; }
|
||||
public simulated function bool SafeDestroy()
|
||||
{
|
||||
return (bPendingDelete || bDeleteMe || Destroy());
|
||||
}
|
||||
|
||||
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
`ZS_Debug("Received:" @ CustomZed);
|
||||
`Log_Debug("Received:" @ CustomZed);
|
||||
CustomZeds.AddItem(CustomZed);
|
||||
ServerSync();
|
||||
}
|
||||
@ -25,11 +29,11 @@ public reliable client function SyncFinished()
|
||||
{
|
||||
local class<KFPawn_Monster> CustomZed;
|
||||
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
foreach CustomZeds(CustomZed)
|
||||
{
|
||||
`ZS_Debug("Preload Content for" @ CustomZed);
|
||||
`Log_Debug("Preload Content for" @ CustomZed);
|
||||
CustomZed.static.PreloadContent();
|
||||
}
|
||||
|
||||
@ -38,17 +42,22 @@ public reliable client function SyncFinished()
|
||||
|
||||
public reliable server function ServerSync()
|
||||
{
|
||||
`ZS_Trace(`Location);
|
||||
`Log_Trace(`Location);
|
||||
|
||||
if (bPendingDelete || bDeleteMe) return;
|
||||
|
||||
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
|
||||
{
|
||||
`ZS_Debug("Sync finished");
|
||||
`Log_Debug("Sync finished");
|
||||
SyncFinished();
|
||||
SafeDestroy();
|
||||
if (!ZS.DestroyRepLink(Controller(Owner)))
|
||||
{
|
||||
SafeDestroy();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
`ZS_Debug("Sync:" @ CustomZeds[Recieved]);
|
||||
`Log_Debug("Sync:" @ CustomZeds[Recieved]);
|
||||
ClientSync(CustomZeds[Recieved++]);
|
||||
}
|
||||
}
|
||||
|
19
ZedSpawner/Classes/_Logger.uc
Normal file
19
ZedSpawner/Classes/_Logger.uc
Normal file
@ -0,0 +1,19 @@
|
||||
class _Logger extends Object
|
||||
abstract;
|
||||
|
||||
enum E_LogLevel
|
||||
{
|
||||
LL_WrongLevel,
|
||||
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)
|
||||
|
11
ZedSpawner/Logger.uci
Normal file
11
ZedSpawner/Logger.uci
Normal file
@ -0,0 +1,11 @@
|
||||
// Logger
|
||||
`define Log_Tag 'ZedSpawner'
|
||||
|
||||
`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:" @ `msg, (LogLevel >= LL_Trace), `Log_Tag)
|
2
tools
2
tools
Submodule tools updated: 49fcaf67a2...2f173aad7a
Reference in New Issue
Block a user