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 class ZedSpawner extends Info
config(ZedSpawner); config(ZedSpawner);
const LatestVersion = 4; const LatestVersion = 5;
const CfgSpawn = class'Spawn'; const CfgSpawn = class'Spawn';
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart'; const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
@ -32,6 +32,8 @@ struct S_SpawnEntry
var private config int Version; var private config int Version;
var private config E_LogLevel LogLevel; var private config E_LogLevel LogLevel;
var private config float Tickrate; var private config float Tickrate;
var private config bool bPreloadContentServer;
var private config bool bPreloadContentClient;
var private float dt; var private float dt;
@ -111,6 +113,9 @@ private function PreInit()
case 2: case 2:
case 3: case 3:
case 4:
bPreloadContentServer = true;
bPreloadContentClient = true;
case MaxInt: case MaxInt:
`Log_Info("Config updated to version"@LatestVersion); `Log_Info("Config updated to version"@LatestVersion);
@ -222,7 +227,17 @@ private function PostInit()
CycleWaveSize = CycleWaveSize - CycleWaveShift + 1; CycleWaveSize = CycleWaveSize - CycleWaveShift + 1;
} }
if (bPreloadContentServer || bPreloadContentClient)
{
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
}
if (bPreloadContentServer)
{
PreloadContent(); PreloadContent();
}
SetTimer(dt, true, nameof(SpawnTimer)); SetTimer(dt, true, nameof(SpawnTimer));
} }
@ -233,10 +248,6 @@ private function PreloadContent()
`Log_Trace(); `Log_Trace();
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
foreach CustomZeds(PawnClass) foreach CustomZeds(PawnClass)
{ {
`Log_Info("Preload content:" @ PawnClass); `Log_Info("Preload content:" @ PawnClass);
@ -767,6 +778,8 @@ public function NotifyLogin(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (!bPreloadContentClient) return;
if (!CreateRepInfo(C)) if (!CreateRepInfo(C))
{ {
`Log_Error("Can't create RepInfo for:" @ C); `Log_Error("Can't create RepInfo for:" @ C);
@ -777,6 +790,8 @@ public function NotifyLogout(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (!bPreloadContentClient) return;
DestroyRepInfo(C); DestroyRepInfo(C);
} }

2
tools

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