KF2-ZedSpawner/ZedSpawner/Classes/Spawn.uc

108 lines
3.0 KiB
Ucode
Raw Normal View History

2022-05-11 12:43:39 +00:00
class Spawn extends Object
dependson(ZedSpawner)
config(ZedSpawner);
2022-05-20 21:31:35 +00:00
var public config bool bCyclicalSpawn;
var public config bool bShadowSpawn;
var public config float ZedTotalMultiplier;
var public config float SpawnTotalPlayerMultiplier;
var public config float SpawnTotalCycleMultiplier;
var public config float SingleSpawnLimitMultiplier;
var public config float SingleSpawnLimitPlayerMultiplier;
var public config float SingleSpawnLimitCycleMultiplier;
var public config int AliveSpawnLimit;
2022-07-13 09:09:18 +00:00
var public config bool bSmoothSpawn;
2022-05-11 12:43:39 +00:00
2022-07-19 10:28:43 +00:00
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
2022-05-20 20:45:26 +00:00
{
2022-07-19 10:28:43 +00:00
`Log_TraceStatic();
2022-05-20 20:45:26 +00:00
switch (Version)
{
case `NO_CONFIG:
2022-07-19 10:28:43 +00:00
ApplyDefault(LogLevel);
2022-05-20 20:45:26 +00:00
2022-07-13 09:09:18 +00:00
case 3:
default.bSmoothSpawn = false;
2022-05-20 20:45:26 +00:00
default: break;
}
if (LatestVersion != Version)
{
StaticSaveConfig();
}
}
2022-07-19 10:28:43 +00:00
private static function ApplyDefault(E_LogLevel LogLevel)
2022-05-11 12:43:39 +00:00
{
2022-07-19 10:28:43 +00:00
`Log_TraceStatic();
default.bCyclicalSpawn = true;
default.bShadowSpawn = true;
2022-07-13 09:09:18 +00:00
default.bSmoothSpawn = true;
default.ZedTotalMultiplier = 1.0;
default.SpawnTotalPlayerMultiplier = 0.75;
default.SpawnTotalCycleMultiplier = 0.75;
default.SingleSpawnLimitMultiplier = 1.0;
2022-05-16 02:42:13 +00:00
default.SingleSpawnLimitPlayerMultiplier = 0.75;
default.SingleSpawnLimitCycleMultiplier = 0.75;
default.AliveSpawnLimit = 0;
2022-05-11 12:43:39 +00:00
}
public static function bool Load(E_LogLevel LogLevel)
{
local bool Errors;
2022-07-19 10:28:43 +00:00
`Log_TraceStatic();
2022-05-16 02:42:13 +00:00
if (default.ZedTotalMultiplier <= 0.f)
{
2022-07-13 07:00:06 +00:00
`Log_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0");
2022-05-16 02:42:13 +00:00
Errors = true;
}
if (default.SpawnTotalPlayerMultiplier < 0.f)
{
2022-07-13 07:00:06 +00:00
`Log_Error("SpawnTotalPlayerMultiplier" @ "(" $ default.SpawnTotalPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
2022-05-16 02:42:13 +00:00
Errors = true;
}
if (default.SpawnTotalCycleMultiplier < 0.f)
2022-05-11 12:43:39 +00:00
{
2022-07-13 07:00:06 +00:00
`Log_Error("SpawnTotalCycleMultiplier" @ "(" $ default.SpawnTotalCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
2022-05-11 12:43:39 +00:00
Errors = true;
}
if (default.SingleSpawnLimitMultiplier <= 0.f)
{
2022-07-13 07:00:06 +00:00
`Log_Error("SingleSpawnLimitMultiplier" @ "(" $ default.SingleSpawnLimitMultiplier $ ")" @ "must be greater than 0.0");
Errors = true;
}
2022-05-16 02:42:13 +00:00
if (default.SingleSpawnLimitPlayerMultiplier < 0.f)
2022-05-11 12:43:39 +00:00
{
2022-07-13 07:00:06 +00:00
`Log_Error("SingleSpawnLimitPlayerMultiplier" @ "(" $ default.SingleSpawnLimitPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
2022-05-11 12:43:39 +00:00
Errors = true;
}
2022-05-16 02:42:13 +00:00
if (default.SingleSpawnLimitCycleMultiplier < 0.f)
2022-05-11 12:43:39 +00:00
{
2022-07-13 07:00:06 +00:00
`Log_Error("SingleSpawnLimitCycleMultiplier" @ "(" $ default.SingleSpawnLimitCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
2022-05-11 12:43:39 +00:00
Errors = true;
}
if (default.AliveSpawnLimit < 0)
{
2022-07-13 07:00:06 +00:00
`Log_Error("AliveSpawnLimit" @ "(" $ default.AliveSpawnLimit $ ")" @ "must be greater than or equal 0");
2022-05-11 12:43:39 +00:00
Errors = true;
}
return !Errors;
}
defaultproperties
{
}