From 86e785b1228318ebb47002327e433244e272145e Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Thu, 15 Sep 2022 11:03:57 +0300 Subject: [PATCH] add PreloadContent config options --- ZedSpawner/Classes/ZedSpawner.uc | 27 +++++++++++++++++++++------ tools | 2 +- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ZedSpawner/Classes/ZedSpawner.uc b/ZedSpawner/Classes/ZedSpawner.uc index 819018b..fbe32ed 100644 --- a/ZedSpawner/Classes/ZedSpawner.uc +++ b/ZedSpawner/Classes/ZedSpawner.uc @@ -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 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); } diff --git a/tools b/tools index 88b35bd..0e821f3 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit 88b35bd7ebb7e30448579f1564220398f990541c +Subproject commit 0e821f3dbbc6b3528f2028b0060d3b6f7f1c4b93