15 Commits

Author SHA1 Message Date
f0aa54121e update build tools 2022-10-13 23:12:32 +03:00
9486cbe1f1 preload content setup description 2022-10-01 22:06:26 +03:00
d7c87d4b9b update description 2022-10-01 21:59:49 +03:00
86e785b122 add PreloadContent config options 2022-09-15 11:13:16 +03:00
88e78d678d rename workshop item 2022-09-13 05:05:45 +03:00
efd5c3d49f update build tools 2022-09-13 05:03:25 +03:00
f335c3932d update build tools 2022-09-02 16:18:19 +03:00
fc87924a4d fix destroy player repinfo 2022-09-02 16:17:55 +03:00
bf06206445 fix false "error": "Cant destroy RepInfo" 2022-08-30 09:56:09 +03:00
9cbe05edfe Merge branch 'master' of https://github.com/GenZmeY/KF2-ZedSpawner 2022-08-30 08:40:07 +03:00
eda17af2bb update code arch a little 2022-08-30 08:39:34 +03:00
47e03c9218 Update description.txt 2022-08-22 18:02:28 +03:00
b38412819e update description and readme 2022-08-22 18:00:24 +03:00
de44bfe00f update logger 2022-07-19 13:28:43 +03:00
a390cffbb8 update description 2022-07-13 18:21:22 +03:00
17 changed files with 248 additions and 136 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.psd
/ignore

View File

@ -1,4 +1,4 @@
[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]
[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
@ -17,7 +17,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[olist]
[*]Subscribe to this mutator;
[*]Start KF2;
[*]Open console (`) and input:
[*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b]
(replace the map and add the parameters you need)
[*]<Enter>.
@ -36,8 +36,22 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[*]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.
[h1]Important setup information[/h1]
The config should be created on first start, but now the game contains a bug that initializes the config values randomly if they are not explicitly set. Thus, the config may have incorrect values or not be created at all.
So if you are using this mutator for the first time, I highly recommend doing the following:
[olist]
[*]Create (modify) [b]KFZedSpawner.ini[/b] manually. Put the following content there:
[b][ZedSpawner.ZedSpawner]
Version=0[/b]
[*]Start the game/server with ZedSpawner to generate the contents of the config.
[*]Close the game/server.
[/olist]
[b]Right now this is the only way to correctly create the default config.[/b]
Unfortunately I can't do anything about it because it's a game problem (not mutator). I hope TWI fixes this someday.
[h1]Setup (KFZedSpawner.ini)[/h1]
[b]bPreloadContentServer[/b] - enable/disable server-side preload content;
[b]bPreloadContentClient[/b] - enable/disable client-side preload content;
[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]
@ -48,6 +62,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.
@ -72,5 +89,10 @@ I really tried to describe in text how it works, but every time I got some kind
[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).
📌 If the spawner's behavior differs from what you expect, check the server logs first. ZedSpawner writes in the logs everything it 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)

View File

@ -1 +1 @@
ZedSpawner
Zed Spawner

View File

@ -1,7 +1,6 @@
# ZedSpawner
[![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Subscriptions](https://img.shields.io/steam/subscriptions/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Favorites](https://img.shields.io/steam/favorites/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Update Date](https://img.shields.io/steam/update-date/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner)](https://github.com/GenZmeY/KF2-ZedSpawner/tags)

View File

@ -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

View File

@ -13,12 +13,14 @@ 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;
@ -32,8 +34,10 @@ 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;
@ -50,6 +54,8 @@ public static function bool Load(E_LogLevel LogLevel)
{
local bool Errors;
`Log_TraceStatic();
if (default.ZedTotalMultiplier <= 0.f)
{
`Log_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0");

View File

@ -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");
@ -41,6 +45,8 @@ public static function Array<class<KFPawn_Monster> > Load(E_LogLevel LogLevel)
local String ZedClassTmp;
local int Line;
`Log_TraceStatic();
`Log_Info("Load zeds to spawn at player start:");
foreach default.ZedClass(ZedClassTmp, Line)
{

View File

@ -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);
@ -62,6 +66,8 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
local int Line;
local bool Errors;
`Log_TraceStatic();
`Log_Info("Load boss waves spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line)
{

View File

@ -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;
@ -68,6 +72,8 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
local int Line;
local bool Errors;
`Log_TraceStatic();
`Log_Info("Load spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line)
{

View File

@ -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";
@ -60,6 +64,8 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
local int Line;
local bool Errors;
`Log_TraceStatic();
if (KFGIE == None)
{
`Log_Info("Not Endless mode, skip loading special waves");

View File

@ -1,7 +1,7 @@
class ZedSpawner extends Info
config(ZedSpawner);
const LatestVersion = 4;
const LatestVersion = 5;
const CfgSpawn = class'Spawn';
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
@ -32,6 +32,8 @@ struct S_SpawnEntry
var private config int Version;
var private config E_LogLevel LogLevel;
var private config float Tickrate;
var private config bool bPreloadContentServer;
var private config bool bPreloadContentClient;
var private float dt;
@ -64,7 +66,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()
{
@ -73,7 +75,7 @@ public simulated function bool SafeDestroy()
public event PreBeginPlay()
{
`Log_Trace(`Location);
`Log_Trace();
if (WorldInfo.NetMode == NM_Client)
{
@ -83,20 +85,11 @@ public event PreBeginPlay()
}
Super.PreBeginPlay();
PreInit();
}
public event PostBeginPlay()
{
`Log_Trace(`Location);
if (bPendingDelete || bDeleteMe) return;
Super.PostBeginPlay();
Init();
}
private function InitConfig()
private function PreInit()
{
if (Version == `NO_CONFIG)
{
@ -104,11 +97,11 @@ 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)
{
@ -120,6 +113,9 @@ private function InitConfig()
case 2:
case 3:
case 4:
bPreloadContentServer = true;
bPreloadContentClient = true;
case MaxInt:
`Log_Info("Config updated to version"@LatestVersion);
@ -141,28 +137,7 @@ private function InitConfig()
Version = LatestVersion;
SaveConfig();
}
}
private function Init()
{
local S_SpawnEntry SE;
local String CurrentMap;
`Log_Trace(`Location);
KFGIS = KFGameInfo_Survival(WorldInfo.Game);
if (KFGIS == None)
{
`Log_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;
@ -174,10 +149,6 @@ private function Init()
if (Tickrate <= 0)
{
`Log_Error("Spawner tickrate must be positive (current value:" @ Tickrate $ ")");
}
if (!CfgSpawn.static.Load(LogLevel) || Tickrate <= 0)
{
`Log_Fatal("Wrong settings, Destroy...");
SafeDestroy();
return;
@ -185,11 +156,56 @@ private function Init()
dt = 1 / Tickrate;
`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);
@ -211,7 +227,17 @@ private function Init()
CycleWaveSize = CycleWaveSize - CycleWaveShift + 1;
}
PreloadContent();
if (bPreloadContentServer || bPreloadContentClient)
{
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
}
if (bPreloadContentServer)
{
PreloadContent();
}
SetTimer(dt, true, nameof(SpawnTimer));
}
@ -220,9 +246,7 @@ private function PreloadContent()
{
local class<KFPawn_Monster> PawnClass;
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
`Log_Trace();
foreach CustomZeds(PawnClass)
{
@ -235,10 +259,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);
}
@ -251,7 +277,7 @@ private function SpawnTimer()
local int Index;
local float Threshold;
`Log_Trace(`Location);
`Log_Trace();
if (KFGIS.WaveNum != 0 && CurrentWave < KFGIS.WaveNum)
{
@ -323,7 +349,7 @@ private function SetupWave()
local S_SpawnEntry SE;
local EAIType SWType;
`Log_Trace(`Location);
`Log_Trace();
if (CfgSpawn.default.bCyclicalSpawn && KFGIS.WaveNum > 1 && KFGIS.WaveNum == CycleWaveShift + CycleWaveSize * CurrentCycle)
{
@ -350,7 +376,7 @@ 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)
{
`Log_Error("Can't determine boss class. Boss index:" @ KFGIS.MyKFGRI.BossIndex);
@ -432,7 +458,7 @@ private function AdjustSpawnList(out Array<S_SpawnEntry> List)
local float PawnTotalF, PawnLimitF;
local int ZedNameMaxLength;
`Log_Trace(`Location);
`Log_Trace();
Cycle = float(CurrentCycle);
Players = float(PlayerCount());
@ -487,7 +513,7 @@ private function SpawnTimerLogger(bool Stop, optional String Comment)
{
local String Message;
`Log_Trace(`Location);
`Log_Trace();
if (Stop)
Message = "Stop spawn";
@ -511,7 +537,7 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
local String Action, Comment, NextSpawn;
local bool SpawnAtPlayerStart;
`Log_Trace(`Location);
`Log_Trace();
SE = SpawnList[Index];
@ -628,7 +654,7 @@ private function int PlayerCount()
local int HumanPlayers;
local KFOnlineGameSettings KFGameSettings;
`Log_Trace(`Location);
`Log_Trace();
if (KFGIS.PlayfabInter != None && KFGIS.PlayfabInter.GetGameSettings() != None)
{
@ -653,7 +679,7 @@ private function Vector PlayerStartLocation()
{
local PlayerController PC;
`Log_Trace(`Location);
`Log_Trace();
foreach WorldInfo.AllControllers(class'PlayerController', PC)
return KFGIS.FindPlayerStart(PC, 0).Location;
@ -672,7 +698,7 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
local int Failed, Spawned;
local int Index;
`Log_Trace(`Location);
`Log_Trace();
PlayerStart = PlayerStartLocation();
if (SpawnAtPlayerStart)
@ -750,55 +776,62 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
public function NotifyLogin(Controller C)
{
`Log_Trace(`Location);
`Log_Trace();
if (!bPreloadContentClient) return;
CreateRepLink(C);
if (!CreateRepInfo(C))
{
`Log_Error("Can't create RepInfo for:" @ C);
}
}
public function NotifyLogout(Controller C)
{
`Log_Trace(`Location);
`Log_Trace();
if (!bPreloadContentClient) return;
DestroyRepLink(C);
DestroyRepInfo(C);
}
public function bool CreateRepLink(Controller C)
public function bool CreateRepInfo(Controller C)
{
local ZedSpawnerRepLink RepLink;
local ZedSpawnerRepInfo RepInfo;
`Log_Trace(`Location);
`Log_Trace();
if (C == None) return false;
RepLink = Spawn(class'ZedSpawnerRepLink', C);
RepInfo = Spawn(class'ZedSpawnerRepInfo', C);
if (RepLink == None) return false;
if (RepInfo == None) return false;
RepLink.LogLevel = LogLevel;
RepLink.CustomZeds = CustomZeds;
RepLink.ZS = Self;
RepInfo.LogLevel = LogLevel;
RepInfo.CustomZeds = CustomZeds;
RepInfo.ZS = Self;
RepLinks.AddItem(RepLink);
RepInfos.AddItem(RepInfo);
RepLink.ServerSync();
RepInfo.ServerSync();
return true;
}
public function bool DestroyRepLink(Controller C)
public function bool DestroyRepInfo(Controller C)
{
local ZedSpawnerRepLink RepLink;
local ZedSpawnerRepInfo RepInfo;
`Log_Trace(`Location);
`Log_Trace();
if (C == None) return false;
foreach RepLinks(RepLink)
foreach RepInfos(RepInfo)
{
if (RepLink.Owner == C)
if (RepInfo.Owner == C)
{
RepLink.SafeDestroy();
RepLinks.RemoveItem(RepLink);
RepInfos.RemoveItem(RepInfo);
RepInfo.SafeDestroy();
return true;
}
}
@ -806,7 +839,7 @@ public function bool DestroyRepLink(Controller C)
return false;
}
DefaultProperties
defaultproperties
{
}

View File

@ -5,25 +5,23 @@ var private ZedSpawner ZS;
public event PreBeginPlay()
{
Super.PreBeginPlay();
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
{
`Log_Base("Found 'ZedSpawner'");
break;
}
if (ZS == None)
{
`Log_Base("Spawn 'ZedSpawner'");
ZS = WorldInfo.Spawn(class'ZedSpawner');
}
if (ZS == None)
{
`Log_Base("Can't Spawn 'ZedSpawner', Destroy...");
`Log_Base("FATAL: Can't Spawn 'ZedSpawner'");
Destroy();
}
}
@ -40,19 +38,19 @@ public function AddMutator(Mutator Mut)
public function NotifyLogin(Controller C)
{
Super.NotifyLogin(C);
ZS.NotifyLogin(C);
Super.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
Super.NotifyLogout(C);
ZS.NotifyLogout(C);
Super.NotifyLogout(C);
}
DefaultProperties
defaultproperties
{
}

View File

@ -1,4 +1,4 @@
class ZedSpawnerRepLink extends ReplicationInfo;
class ZedSpawnerRepInfo extends ReplicationInfo;
var public ZedSpawner ZS;
var public E_LogLevel LogLevel;
@ -18,7 +18,7 @@ public simulated function bool SafeDestroy()
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{
`Log_Trace(`Location);
`Log_Trace();
`Log_Debug("Received:" @ CustomZed);
CustomZeds.AddItem(CustomZed);
@ -29,7 +29,7 @@ public reliable client function SyncFinished()
{
local class<KFPawn_Monster> CustomZed;
`Log_Trace(`Location);
`Log_Trace();
foreach CustomZeds(CustomZed)
{
@ -42,7 +42,7 @@ public reliable client function SyncFinished()
public reliable server function ServerSync()
{
`Log_Trace(`Location);
`Log_Trace();
if (bPendingDelete || bDeleteMe) return;
@ -50,7 +50,7 @@ public reliable server function ServerSync()
{
`Log_Debug("Sync finished");
SyncFinished();
if (!ZS.DestroyRepLink(Controller(Owner)))
if (!ZS.DestroyRepInfo(Controller(Owner)))
{
SafeDestroy();
}

View File

@ -4,6 +4,7 @@ class _Logger extends Object
enum E_LogLevel
{
LL_WrongLevel,
LL_None,
LL_Fatal,
LL_Error,
LL_Warning,

View File

@ -1,11 +1,15 @@
// Logger
`define Log_Tag 'ZedSpawner'
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
`define LocationStatic "`{ClassName}::" $ GetFuncName()
`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)
`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)

View File

@ -11,6 +11,15 @@ StripSource="True"
PackageBuildOrder="ZedSpawner"
### Brew parameters ###
# Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator,
# The order doesn't matter
PackagePeelzBrew=""
### Steam Workshop upload parameters ###
# Mutators that will be uploaded to the workshop

2
tools

Submodule tools updated: 2f173aad7a...d830a5ea16