2022-05-11 12:43:39 +00:00
class SpawnListSpecialWaves extends Object
dependson ( ZedSpawner )
config ( ZedSpawner ) ;
struct S _SpawnEntryCfg
{
var EAIType Wave ;
var String ZedClass ;
2022-05-16 02:42:13 +00:00
var int RelativeStart ;
2022-05-11 12:43:39 +00:00
var int Delay ;
var int Probability ;
2022-05-16 02:42:13 +00:00
var int SpawnCountBase ;
var int SingleSpawnLimit ;
2022-05-11 12:43:39 +00:00
var bool bSpawnAtPlayerStart ;
} ;
var config bool bStopRegularSpawn ;
var config Array < S _SpawnEntryCfg > Spawn ;
public static function InitConfig ( )
{
local S _SpawnEntryCfg SpawnEntry ;
default . bStopRegularSpawn = true ;
default . Spawn . Length = 0 ;
SpawnEntry . Wave = AT _Husk ;
SpawnEntry . ZedClass = "SomePackage.SomeHuskClass" ;
2022-05-16 02:42:13 +00:00
SpawnEntry . SpawnCountBase = 2 ;
SpawnEntry . SingleSpawnLimit = 1 ;
SpawnEntry . RelativeStart = 0 ;
2022-05-11 12:43:39 +00:00
SpawnEntry . Delay = 60 ;
2022-05-16 02:42:13 +00:00
SpawnEntry . Probability = 100 ;
2022-05-11 12:43:39 +00:00
SpawnEntry . bSpawnAtPlayerStart = false ;
default . Spawn . AddItem ( SpawnEntry ) ;
StaticSaveConfig ( ) ;
}
public static function Array < S _SpawnEntry > Load ( KFGameInfo _Endless KFGIE , E _LogLevel LogLevel )
{
local Array < S _SpawnEntry > SpawnList ;
local S _SpawnEntryCfg SpawnEntryCfg ;
local S _SpawnEntry SpawnEntry ;
local int Line ;
local bool Errors ;
if ( KFGIE == None )
{
` ZS_Info("Not Endless mode, skip loading special waves", LogLevel);
return SpawnList ;
}
` ZS_Info("Load special waves spawn list:", LogLevel);
foreach default . Spawn ( SpawnEntryCfg , Line )
{
Errors = false ;
SpawnEntry . Wave = SpawnEntryCfg . Wave ;
if ( KFGIE . SpecialWaveTypes . Find ( EAIType ( SpawnEntryCfg . Wave ) ) == INDEX _NONE )
{
` ZS_Warn("[" $ Line + 1 $ "]" @ "Unknown special wave:" @ SpawnEntryCfg.Wave, LogLevel);
Errors = true ;
}
SpawnEntry . ZedClass = class < KFPawn _Monster > ( DynamicLoadObject ( SpawnEntryCfg . ZedClass , class 'Class' ) ) ;
if ( SpawnEntry . ZedClass == None )
{
` ZS_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass, LogLevel);
Errors = true ;
}
2022-05-16 02:42:13 +00:00
SpawnEntry . RelativeStartDefault = SpawnEntryCfg . RelativeStart / 100. f ;
if ( SpawnEntryCfg . RelativeStart < 0 || SpawnEntryCfg . RelativeStart > 100 )
2022-05-11 12:43:39 +00:00
{
2022-05-16 02:42:13 +00:00
` ZS_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100", LogLevel);
2022-05-11 12:43:39 +00:00
Errors = true ;
}
2022-05-16 02:42:13 +00:00
SpawnEntry . DelayDefault = SpawnEntryCfg . Delay ;
if ( SpawnEntryCfg . Delay <= 0 )
2022-05-11 12:43:39 +00:00
{
2022-05-16 02:42:13 +00:00
` ZS_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0", LogLevel);
2022-05-11 12:43:39 +00:00
Errors = true ;
}
2022-05-16 02:42:13 +00:00
SpawnEntry . Probability = SpawnEntryCfg . Probability / 100. f ;
if ( SpawnEntryCfg . Probability <= 0 || SpawnEntryCfg . Probability > 100 )
2022-05-11 12:43:39 +00:00
{
2022-05-16 02:42:13 +00:00
` ZS_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100", LogLevel);
2022-05-11 12:43:39 +00:00
Errors = true ;
}
2022-05-16 02:42:13 +00:00
SpawnEntry . SpawnCountBase = SpawnEntryCfg . SpawnCountBase ;
if ( SpawnEntry . SpawnCountBase <= 0 )
2022-05-11 12:43:39 +00:00
{
2022-05-16 02:42:13 +00:00
` ZS_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0", LogLevel);
2022-05-11 12:43:39 +00:00
Errors = true ;
}
2022-05-16 02:42:13 +00:00
SpawnEntry . SingleSpawnLimitDefault = SpawnEntryCfg . SingleSpawnLimit ;
if ( SpawnEntry . SingleSpawnLimit < 0 )
2022-05-11 12:43:39 +00:00
{
2022-05-16 02:42:13 +00:00
` ZS_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0", LogLevel);
2022-05-11 12:43:39 +00:00
Errors = true ;
}
2022-05-16 02:42:13 +00:00
2022-05-11 12:43:39 +00:00
SpawnEntry . SpawnAtPlayerStart = SpawnEntryCfg . bSpawnAtPlayerStart ;
if ( ! Errors )
{
SpawnList . AddItem ( SpawnEntry ) ;
` ZS_Info("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ SpawnEntryCfg.Wave @ SpawnEntryCfg.ZedClass, LogLevel);
}
}
return SpawnList ;
}
defaultproperties
{
}