11 Commits

Author SHA1 Message Date
90a69ef739 ...
- now the type of unit affects the choice of spawn location
- bSpawnAtPlayerStart removed from spawn list
- SpawnAtPlayerStart can be set separately for specified maps or zed classes
- optimized spawn list loading
- added handling of the situation when the player leaves the game before preloadcontent synchronization ends
- fixed calculation of the number of zeds in some cases
2022-06-13 17:07:55 +03:00
e1face5c04 add description 2022-06-06 10:52:48 +03:00
35048c6fec Merge branch 'master' of https://github.com/GenZmeY/KF2-ZedSpawner 2022-06-06 08:48:48 +03:00
088da70984 add new gif preview 2022-06-06 08:47:39 +03:00
525ee1728e update build tools 2022-06-06 08:47:13 +03:00
3dad5b10c7 Update README.md 2022-06-06 02:50:19 +03:00
3a42094ca2 Update README.md 2022-06-06 02:49:49 +03:00
a45ba21925 feat: adjust spawner tickrate 2022-06-06 02:44:39 +03:00
f681c7d40d Merge branch 'master' of https://github.com/GenZmeY/KF2-ZedSpawner 2022-06-05 04:00:03 +03:00
c06591d5a2 Update README.md 2022-06-01 18:10:40 +03:00
11c5490bd6 Update README.md 2022-06-01 18:07:37 +03:00
11 changed files with 294 additions and 67 deletions

View File

@ -1,7 +1,68 @@
[h1]ZedSpawner[/h1]
[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 unrank your server. Any XP gained will not be saved.
[h1]Usage (single player)[/h1]
1. Subscribe to this mutator;
2. Start KF2;
3. Open console (`) and input:
[b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b]
(replace the map and add the parameters you need)
4. <Enter>.
[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]
1. Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
2. Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2811290931[/b]
3. Start the server and wait while the mutator is downloading;
4. Add mutator to server start parameters: [b]?Mutator=ZedSpawner.ZedSpawnerMut[/b] and restart the server.
[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.
[h1]📌[url=https://redirect.genzmey.su/kf2-zedspawner-calc]Spawn calculator[/url][/h1]
[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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

View File

@ -8,7 +8,7 @@
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner)](LICENSE)
# Description
Spawner for zeds. Started as a modification of the [PissJar](https://steamcommunity.com/sharedfiles/filedetails/?id=1082749153) and [Windows 10](https://steamcommunity.com/sharedfiles/filedetails/?id=2488241348) version, but grew into something completely different...
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;
@ -17,9 +17,10 @@ Spawner for zeds. Started as a modification of the [PissJar](https://steamcommun
- separate spawn for special waves and boss waves;
- spawn after a certain percentage of killed zeds.
# Usage
**UNDER CONSTRUCTION**
# 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

View File

@ -0,0 +1,77 @@
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, Loaded;
Loaded = 0;
`ZS_Info("Load zeds to spawn at player start:");
foreach default.ZedClass(ZedClassTmp, Line)
{
KFPMC = class<KFPawn_Monster>(DynamicLoadObject(ZedClassTmp, class'Class'));
if (KFPMC == None)
{
`ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp);
}
else
{
Loaded++;
ZedList.AddItem(KFPMC);
`ZS_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp);
}
}
if (Loaded == default.ZedClass.Length)
{
`ZS_Info("Spawn at player start list (Zeds) loaded successfully (" $ default.ZedClass.Length @ "entries)");
}
else
{
`ZS_Info("Spawn at player start list (Zeds): loaded" @ Loaded @ "of" @ default.ZedClass.Length @ "entries");
}
return ZedList;
}
defaultproperties
{
}

View File

@ -10,7 +10,6 @@ struct S_SpawnEntryCfg
var int Probability;
var int SpawnCountBase;
var int SingleSpawnLimit;
var bool bSpawnAtPlayerStart;
};
var public config bool bStopRegularSpawn;
@ -47,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)
{
@ -65,7 +63,7 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
local bool Errors;
local int Loaded;
`ZS_Info("Load boss waves spawn list...");
`ZS_Info("Load boss waves spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line)
{
Errors = false;
@ -114,8 +112,6 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
Errors = true;
}
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
if (!Errors)
{
Loaded++;
@ -126,7 +122,7 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
if (Loaded == default.Spawn.Length)
{
`ZS_Info("Boss spawn list loaded successfully");
`ZS_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{

View File

@ -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)
@ -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)
{
@ -120,8 +123,6 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
Errors = true;
}
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
if (!Errors)
{
Loaded++;
@ -130,9 +131,11 @@ public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
}
}
default.Spawn.Sort(SpawnListSort);
if (Loaded == default.Spawn.Length)
{
`ZS_Info("Regular spawn list loaded successfully");
`ZS_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{

View File

@ -11,7 +11,6 @@ struct S_SpawnEntryCfg
var int Probability;
var int SpawnCountBase;
var int SingleSpawnLimit;
var bool bSpawnAtPlayerStart;
};
var public config bool bStopRegularSpawn;
@ -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;
@ -123,8 +121,6 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
Errors = true;
}
SpawnEntry.SpawnAtPlayerStart = SpawnEntryCfg.bSpawnAtPlayerStart;
if (!Errors)
{
Loaded++;
@ -135,7 +131,7 @@ public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogL
if (Loaded == default.Spawn.Length)
{
`ZS_Info("Special spawn list loaded successfully");
`ZS_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
}
else
{

View File

@ -1,14 +1,13 @@
class ZedSpawner extends Info
config(ZedSpawner);
const LatestVersion = 1;
const LatestVersion = 3;
const dt = 1;
const CfgSpawn = class'Spawn';
const CfgSpawnListRW = class'SpawnListRegular';
const CfgSpawnListBW = class'SpawnListBossWaves';
const CfgSpawnListSW = class'SpawnListSpecialWaves';
const CfgSpawn = class'Spawn';
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
const CfgSpawnListRW = class'SpawnListRegular';
const CfgSpawnListBW = class'SpawnListBossWaves';
const CfgSpawnListSW = class'SpawnListSpecialWaves';
enum E_LogLevel
{
@ -34,16 +33,18 @@ struct S_SpawnEntry
var float RelativeStartDefault;
var float RelativeStart;
var int DelayDefault;
var int Delay;
var float Delay;
var int PawnsLeft;
var int PawnsTotal;
var bool SpawnAtPlayerStart;
var bool ForceSpawn;
var String ZedNameFiller;
};
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;
@ -54,6 +55,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;
@ -68,10 +70,18 @@ var private int WaveTotalAI;
var private class<KFPawn_Monster> CurrentBossClass;
var private Array<class<KFPawn_Monster> > CustomZeds;
var private Array<class<KFPawn_Monster> > SpawnAtPlayerStartZeds;
var private bool SpawnActive;
var private String SpawnListsComment;
var private Array<ZedSpawnerRepLink> RepLinks;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
`ZS_Trace(`Location);
@ -79,7 +89,7 @@ public event PreBeginPlay()
if (WorldInfo.NetMode == NM_Client)
{
`ZS_Fatal("NetMode == NM_Client, Destroy...");
Destroy();
SafeDestroy();
return;
}
@ -90,7 +100,7 @@ public event PostBeginPlay()
{
`ZS_Trace(`Location);
if (bPendingDelete) return;
if (bPendingDelete || bDeleteMe) return;
Super.PostBeginPlay();
@ -106,6 +116,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,6 +125,11 @@ private function InitConfig()
{
case `NO_CONFIG:
`ZS_Info("Config created");
case 1:
Tickrate = 1.0f;
case 2:
case MaxInt:
`ZS_Info("Config updated to version"@LatestVersion);
@ -140,6 +156,7 @@ private function InitConfig()
private function Init()
{
local S_SpawnEntry SE;
local String CurrentMap;
`ZS_Trace(`Location);
@ -147,7 +164,7 @@ private function Init()
if (KFGIS == None)
{
`ZS_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
Destroy();
SafeDestroy();
return;
}
@ -164,16 +181,29 @@ private function Init()
}
`ZS_Log("LogLevel:" @ LogLevel);
if (!CfgSpawn.static.Load(LogLevel))
if (Tickrate <= 0)
{
`ZS_Error("Spawner tickrate must be positive (current value:" @ Tickrate $ ")");
}
if (!CfgSpawn.static.Load(LogLevel) || Tickrate <= 0)
{
`ZS_Fatal("Wrong settings, Destroy...");
Destroy();
SafeDestroy();
return;
}
dt = 1 / Tickrate;
`ZS_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);
`ZS_Info("GlobalSpawnAtPlayerStart:" @ GlobalSpawnAtPlayerStart $ GlobalSpawnAtPlayerStart ? "(" $ CurrentMap $ ")" : "");
CurrentWave = INDEX_NONE;
SpecialWave = INDEX_NONE;
@ -193,7 +223,7 @@ private function Init()
PreloadContent();
SetTimer(float(dt), true, nameof(SpawnTimer));
SetTimer(dt, true, nameof(SpawnTimer));
}
private function PreloadContent()
@ -281,7 +311,7 @@ private function SpawnTimer()
continue;
}
if (SE.Delay > 0)
if (SE.Delay > 0.0f)
{
SpawnListCurrent[Index].Delay -= dt;
continue;
@ -298,6 +328,7 @@ private function SetupWave()
{
local Array<String> SpawnListNames;
local int WaveTotalAIDef;
local byte BaseWave;
local String WaveTypeInfo;
local S_SpawnEntry SE;
local EAIType SWType;
@ -366,9 +397,12 @@ private function SetupWave()
if (UseRegularSpawnList)
{
SpawnListNames.AddItem("regular");
BaseWave = KFGIS.WaveNum - CycleWaveSize * (CurrentCycle - 1);
foreach SpawnListRW(SE)
if (SE.Wave == KFGIS.WaveNum - CycleWaveSize * (CurrentCycle - 1))
if (SE.Wave == BaseWave)
SpawnListCurrent.AddItem(SE);
else if (SE.Wave > BaseWave)
break;
}
if (UseSpecialSpawnList)
@ -413,9 +447,6 @@ private function AdjustSpawnList(out Array<S_SpawnEntry> List)
Cycle = float(CurrentCycle);
Players = float(PlayerCount());
B = float(SE.SpawnCountBase);
L = float(SE.SingleSpawnLimitDefault);
TM = CfgSpawn.default.ZedTotalMultiplier;
TCM = CfgSpawn.default.SpawnTotalCycleMultiplier;
TPM = CfgSpawn.default.SpawnTotalPlayerMultiplier;
@ -423,7 +454,7 @@ private function AdjustSpawnList(out Array<S_SpawnEntry> List)
LM = CfgSpawn.default.SingleSpawnLimitMultiplier;
LCM = CfgSpawn.default.SingleSpawnLimitCycleMultiplier;
LPM = CfgSpawn.default.SingleSpawnLimitPlayerMultiplier;
ZedNameMaxLength = 0;
foreach List(SE, Index)
{
@ -431,17 +462,20 @@ private function AdjustSpawnList(out Array<S_SpawnEntry> List)
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;
}
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));
@ -485,12 +519,13 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
local S_SpawnEntry SE;
local int FreeSpawnSlots, PawnCount, Spawned;
local String Action, Comment, NextSpawn;
local bool SpawnAtPlayerStart;
`ZS_Trace(`Location);
SE = SpawnList[Index];
SpawnList[Index].Delay = SE.DelayDefault;
SpawnList[Index].Delay = float(SE.DelayDefault);
if (FRand() <= SE.Probability || SE.ForceSpawn)
{
if (SE.SingleSpawnLimit == 0 || SE.PawnsLeft < SE.SingleSpawnLimit)
@ -517,13 +552,15 @@ private function SpawnEntry(out Array<S_SpawnEntry> SpawnList, int Index)
}
}
Spawned = SpawnZed(SE.ZedClass, PawnCount, SE.SpawnAtPlayerStart);
SpawnAtPlayerStart = (GlobalSpawnAtPlayerStart || (SpawnAtPlayerStartZeds.Find(SE.ZedClass) != INDEX_NONE));
Spawned = SpawnZed(SE.ZedClass, PawnCount, SpawnAtPlayerStart);
if (Spawned == INDEX_NONE)
{
SpawnList[Index].Delay = 5;
SpawnList[Index].Delay = 5.0f;
SpawnList[Index].ForceSpawn = true;
Action = "Skip spawn";
Comment = "no free spawn volume, try to spawn it again in" @ SpawnList[Index].Delay @ "seconds...";
Comment = "no free spawn volume, try to spawn it again in" @ Round(SpawnList[Index].Delay) @ "seconds...";
SpawnLog(SE, Action, Comment);
return;
}
@ -600,9 +637,10 @@ private function Vector PlayerStartLocation()
return KFGIS.FindPlayerStart(None, 0).Location;
}
private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, bool SpawnAtPlayerStart)
private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, optional bool SpawnAtPlayerStart = false)
{
local Array<class<KFPawn_Monster> > CustomSquad;
local ESquadType PrevDesiredSquadType;
local Vector SpawnLocation, PlayerStart;
local KFSpawnVolume SpawnVolume;
local KFPawn_Monster KFPM;
@ -626,12 +664,18 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, boo
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)
{
@ -664,6 +708,11 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, boo
Spawned++;
}
if (Spawned > 0)
{
KFGIS.SpawnManager.LastAISpawnVolume = SpawnVolume;
}
if (CfgSpawn.default.bShadowSpawn && !KFGIS.MyKFGRI.IsBossWave())
{
KFGIS.NumAIFinishedSpawning += Spawned;
@ -677,21 +726,55 @@ private function int SpawnZed(class<KFPawn_Monster> ZedClass, int PawnCount, boo
public function NotifyLogin(Controller C)
{
local ZedSpawnerRepLink RepLink;
`ZS_Trace(`Location);
RepLink = Spawn(class'ZedSpawnerRepLink', C);
RepLink.LogLevel = LogLevel;
RepLink.CustomZeds = CustomZeds;
RepLink.ServerSync();
CreateRepLink(C);
}
public function NotifyLogout(Controller C)
{
`ZS_Trace(`Location);
DestroyRepLink(C);
}
public function CreateRepLink(Controller C)
{
local ZedSpawnerRepLink RepLink;
return;
`ZS_Trace(`Location);
if (C == None) return;
RepLink = Spawn(class'ZedSpawnerRepLink', C);
RepLink.LogLevel = LogLevel;
RepLink.CustomZeds = CustomZeds;
RepLink.ZS = Self;
RepLinks.AddItem(RepLink);
RepLink.ServerSync();
}
public function bool DestroyRepLink(Controller C)
{
local int i;
`ZS_Trace(`Location);
if (C == None) return false;
for (i = RepLinks.Length - 1; i >= 0; --i)
{
if (RepLinks[i].Owner == C)
{
RepLinks[i].SafeDestroy();
RepLinks.Remove(i, 1);
return true;
}
}
return false;
}
DefaultProperties

View File

@ -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,7 +11,11 @@ replication
LogLevel;
}
public simulated function bool SafeDestroy() { if (!bPendingDelete) return Destroy(); else return true; }
public simulated function bool SafeDestroy()
{
`ZS_Debug(`Location @ "bPendingDelete:" @ bPendingDelete @ "bDeleteMe" @ bDeleteMe);
return (bPendingDelete || bDeleteMe || Destroy());
}
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{
@ -40,11 +45,16 @@ public reliable server function ServerSync()
{
`ZS_Trace(`Location);
if (bPendingDelete || bDeleteMe) return;
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
{
`ZS_Debug("Sync finished");
SyncFinished();
SafeDestroy();
if (!ZS.DestroyRepLink(Controller(Owner)))
{
SafeDestroy();
}
}
else
{

2
tools

Submodule tools updated: 49fcaf67a2...02222cf453