add PreloadContent config options

This commit is contained in:
GenZmeY 2022-09-15 11:03:57 +03:00
parent 88e78d678d
commit 86e785b122
2 changed files with 22 additions and 7 deletions

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;
@ -111,6 +113,9 @@ private function PreInit()
case 2:
case 3:
case 4:
bPreloadContentServer = true;
bPreloadContentClient = true;
case MaxInt:
`Log_Info("Config updated to version"@LatestVersion);
@ -222,7 +227,17 @@ private function PostInit()
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));
}
@ -233,10 +248,6 @@ private function PreloadContent()
`Log_Trace();
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
foreach CustomZeds(PawnClass)
{
`Log_Info("Preload content:" @ PawnClass);
@ -766,6 +777,8 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, opt
public function NotifyLogin(Controller C)
{
`Log_Trace();
if (!bPreloadContentClient) return;
if (!CreateRepInfo(C))
{
@ -776,6 +789,8 @@ public function NotifyLogin(Controller C)
public function NotifyLogout(Controller C)
{
`Log_Trace();
if (!bPreloadContentClient) return;
DestroyRepInfo(C);
}

2
tools

@ -1 +1 @@
Subproject commit 88b35bd7ebb7e30448579f1564220398f990541c
Subproject commit 0e821f3dbbc6b3528f2028b0060d3b6f7f1c4b93