Merge pull request #3 from GenZmeY/MegaLinter

add Mega Linter
This commit is contained in:
GenZmeY 2023-05-14 09:41:36 +03:00 committed by GitHub
commit a747c3eaf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1720 additions and 1621 deletions

33
.editorconfig Normal file
View File

@ -0,0 +1,33 @@
root = true
# Global
[*]
indent_style = unset
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = unset
# Unreal Engine 3 / Source
[*.uc]
indent_style = tab
[*.{uci,upkg}]
# Unreal Engine 3 / i18n
[*.{chn,cht,cze,dan,deu,dut,esl,esn,fra,frc,hun,int,ita,jpn,kor,pol,por,ptb,rus,tur,ukr}]
charset = utf-16le
# Other
[*.md]
indent_style = space
trim_trailing_whitespace = false
[*.yml]
indent_style = space
indent_size = 2
[*.{txt,cfg,conf}]
indent_style = tab

72
.github/workflows/mega-linter.yml vendored Normal file
View File

@ -0,0 +1,72 @@
---
name: MegaLinter
permissions: read-all
on:
push:
pull_request:
branches: [master]
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
DISABLE: SPELL
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
name: MegaLinter
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
- name: MegaLinter
id: ml
uses: oxsecurity/megalinter@v6
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
- name: Create Pull Request with applied fixes
id: cpr
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Prepare commit
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: megalinter-bot
commit_user_email: nicolas.vuillamy@ox.security

View File

@ -16,7 +16,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[h1]Usage (single player)[/h1] [h1]Usage (single player)[/h1]
[olist] [olist]
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (~) and input: [*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b] [b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)

View File

@ -1,28 +1,29 @@
# ZedSpawner # ZedSpawner
[![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [![Steam Workshop](https://img.shields.io/static/v1?message=workshop&logo=steam&labelColor=gray&color=blue&logoColor=white&label=steam%20)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Downloads](https://img.shields.io/steam/downloads/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Favorites](https://img.shields.io/steam/favorites/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [![Steam Favorites](https://img.shields.io/steam/favorites/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Update Date](https://img.shields.io/steam/update-date/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [![MegaLinter](https://github.com/GenZmeY/KF2-ZedSpawner/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-ZedSpawner/actions/workflows/mega-linter.yml)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner)](https://github.com/GenZmeY/KF2-ZedSpawner/tags) [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner)](https://github.com/GenZmeY/KF2-ZedSpawner/tags)
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner)](LICENSE) [![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner)](LICENSE)
# Description ## Description
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 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 ## Features
- spawn without increasing zed counter; - spawn without increasing zed counter;
- spawn depends on the number of players; - spawn depends on the number of players;
- cyclic spawn (useful for endless mode); - cyclic spawn (useful for endless mode);
- separate spawn for special waves and boss waves; - separate spawn for special waves and boss waves;
- spawn after a certain percentage of killed zeds. - spawn after a certain percentage of killed zeds.
# Usage & Setup ## Usage & Setup
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
# Spawn calculator ## Spawn calculator
[Spawn Calculator](https://docs.google.com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=sharing) [Spawn Calculator](https://docs.google.com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=sharing)
# Build ## Build
**Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here. **Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here.
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win); 1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
2. open git-bash and go to any folder where you want to store sources: 2. open git-bash and go to any folder where you want to store sources:
@ -36,17 +37,10 @@ Spawner for zeds. Started as a modification of the [this version](https://steamc
5. The compiled files will be here: 5. The compiled files will be here:
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\` `C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
# Testing ## Bug reports
Open git-bash in the source folder and run command:
`./tools/builder -t`
(or `./tools/builder -ct` if you haven't compiled the mutator yet)
A local single-user test will be launched with parameters from `builder.cfg` (edit this file if you want to test mutator with different parameters).
# Bug reports
If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ZedSpawner/issues) and check if there is a description of your bug. If not, create a new issue. If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ZedSpawner/issues) and check if there is a description of your bug. If not, create a new issue.
Describe what the bug looks like and how reproduce it. Describe what the bug looks like and how reproduce it.
Attaching your KFZedSpawner.ini and Launch.log can also be helpful. Attaching your KFZedSpawner.ini and Launch.log can also be helpful.
# License ## License
[GNU GPLv3](LICENSE) [![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE)

View File

@ -5,12 +5,12 @@ public function Array<class<KFPawn_Monster> > GetAIClassList(E_LogLevel LogLevel
{ {
local Array<class<KFPawn_Monster> > RV; local Array<class<KFPawn_Monster> > RV;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
`Log_Trace(); `Log_Trace();
foreach AIClassList(KFPMC) foreach AIClassList(KFPMC)
RV.AddItem(KFPMC); RV.AddItem(KFPMC);
return RV; return RV;
} }
@ -18,12 +18,12 @@ public function Array<class<KFPawn_Monster> > GetNonSpawnAIClassList(E_LogLevel
{ {
local Array<class<KFPawn_Monster> > RV; local Array<class<KFPawn_Monster> > RV;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
`Log_Trace(); `Log_Trace();
foreach NonSpawnAIClassList(KFPMC) foreach NonSpawnAIClassList(KFPMC)
RV.AddItem(KFPMC); RV.AddItem(KFPMC);
return RV; return RV;
} }
@ -31,12 +31,12 @@ public function Array<class<KFPawn_Monster> > GetAIBossClassList(E_LogLevel LogL
{ {
local Array<class<KFPawn_Monster> > RV; local Array<class<KFPawn_Monster> > RV;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
`Log_Trace(); `Log_Trace();
foreach AIBossClassList(KFPMC) foreach AIBossClassList(KFPMC)
RV.AddItem(KFPMC); RV.AddItem(KFPMC);
return RV; return RV;
} }
@ -51,39 +51,39 @@ public function bool IsCustomZed(class<KFPawn_Monster> KFPM, E_LogLevel LogLevel
public function bool IsOriginalAI(class<KFPawn_Monster> KFPM, optional out EAIType AIType, optional E_LogLevel LogLevel = LL_None) public function bool IsOriginalAI(class<KFPawn_Monster> KFPM, optional out EAIType AIType, optional E_LogLevel LogLevel = LL_None)
{ {
local int Type; local int Type;
`Log_Trace(); `Log_Trace();
Type = AIClassList.Find(KFPM); Type = AIClassList.Find(KFPM);
if (Type != INDEX_NONE) if (Type != INDEX_NONE)
{ {
AIType = EAIType(Type); AIType = EAIType(Type);
return true; return true;
} }
return false; return false;
} }
public function bool IsOriginalAIBoss(class<KFPawn_Monster> KFPM, optional out EBossAIType AIType, optional E_LogLevel LogLevel = LL_None) public function bool IsOriginalAIBoss(class<KFPawn_Monster> KFPM, optional out EBossAIType AIType, optional E_LogLevel LogLevel = LL_None)
{ {
local int Type; local int Type;
`Log_Trace(); `Log_Trace();
Type = AIBossClassList.Find(KFPM); Type = AIBossClassList.Find(KFPM);
if (Type != INDEX_NONE) if (Type != INDEX_NONE)
{ {
AIType = EBossAIType(Type); AIType = EBossAIType(Type);
return true; return true;
} }
return false; return false;
} }
public function class<KFPawn_Monster> AITypePawn(EAIType AIType, E_LogLevel LogLevel) public function class<KFPawn_Monster> AITypePawn(EAIType AIType, E_LogLevel LogLevel)
{ {
`Log_Trace(); `Log_Trace();
if (AIType < AIClassList.Length) if (AIType < AIClassList.Length)
return AIClassList[AIType]; return AIClassList[AIType];
else else
@ -93,7 +93,7 @@ public function class<KFPawn_Monster> AITypePawn(EAIType AIType, E_LogLevel LogL
public function class<KFPawn_Monster> BossAITypePawn(EBossAIType AIType, E_LogLevel LogLevel) public function class<KFPawn_Monster> BossAITypePawn(EBossAIType AIType, E_LogLevel LogLevel)
{ {
`Log_Trace(); `Log_Trace();
if (AIType < AIBossClassList.Length) if (AIType < AIBossClassList.Length)
return AIBossClassList[AIType]; return AIBossClassList[AIType];
else else
@ -102,5 +102,5 @@ public function class<KFPawn_Monster> BossAITypePawn(EBossAIType AIType, E_LogLe
defaultproperties defaultproperties
{ {
} }

View File

@ -1,107 +1,107 @@
class Spawn extends Object class Spawn extends Object
dependson(ZedSpawner) dependson(ZedSpawner)
config(ZedSpawner); config(ZedSpawner);
var public config bool bCyclicalSpawn; var public config bool bCyclicalSpawn;
var public config bool bShadowSpawn; var public config bool bShadowSpawn;
var public config float ZedTotalMultiplier; var public config float ZedTotalMultiplier;
var public config float SpawnTotalPlayerMultiplier; var public config float SpawnTotalPlayerMultiplier;
var public config float SpawnTotalCycleMultiplier; var public config float SpawnTotalCycleMultiplier;
var public config float SingleSpawnLimitMultiplier; var public config float SingleSpawnLimitMultiplier;
var public config float SingleSpawnLimitPlayerMultiplier; var public config float SingleSpawnLimitPlayerMultiplier;
var public config float SingleSpawnLimitCycleMultiplier; var public config float SingleSpawnLimitCycleMultiplier;
var public config int AliveSpawnLimit; var public config int AliveSpawnLimit;
var public config bool bSmoothSpawn; var public config bool bSmoothSpawn;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
case 3: case 3:
default.bSmoothSpawn = false; default.bSmoothSpawn = false;
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
private static function ApplyDefault(E_LogLevel LogLevel) private static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.bCyclicalSpawn = true; default.bCyclicalSpawn = true;
default.bShadowSpawn = true; default.bShadowSpawn = true;
default.bSmoothSpawn = true; default.bSmoothSpawn = true;
default.ZedTotalMultiplier = 1.0; default.ZedTotalMultiplier = 1.0;
default.SpawnTotalPlayerMultiplier = 0.75; default.SpawnTotalPlayerMultiplier = 0.75;
default.SpawnTotalCycleMultiplier = 0.75; default.SpawnTotalCycleMultiplier = 0.75;
default.SingleSpawnLimitMultiplier = 1.0; default.SingleSpawnLimitMultiplier = 1.0;
default.SingleSpawnLimitPlayerMultiplier = 0.75; default.SingleSpawnLimitPlayerMultiplier = 0.75;
default.SingleSpawnLimitCycleMultiplier = 0.75; default.SingleSpawnLimitCycleMultiplier = 0.75;
default.AliveSpawnLimit = 0; default.AliveSpawnLimit = 0;
} }
public static function bool Load(E_LogLevel LogLevel) public static function bool Load(E_LogLevel LogLevel)
{ {
local bool Errors; local bool Errors;
`Log_TraceStatic(); `Log_TraceStatic();
if (default.ZedTotalMultiplier <= 0.f) if (default.ZedTotalMultiplier <= 0.f)
{ {
`Log_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0"); `Log_Error("ZedTotalMultiplier" @ "(" $ default.ZedTotalMultiplier $ ")" @ "must be greater than 0.0");
Errors = true; Errors = true;
} }
if (default.SpawnTotalPlayerMultiplier < 0.f) if (default.SpawnTotalPlayerMultiplier < 0.f)
{ {
`Log_Error("SpawnTotalPlayerMultiplier" @ "(" $ default.SpawnTotalPlayerMultiplier $ ")" @ "must be greater than or equal 0.0"); `Log_Error("SpawnTotalPlayerMultiplier" @ "(" $ default.SpawnTotalPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
Errors = true; Errors = true;
} }
if (default.SpawnTotalCycleMultiplier < 0.f) if (default.SpawnTotalCycleMultiplier < 0.f)
{ {
`Log_Error("SpawnTotalCycleMultiplier" @ "(" $ default.SpawnTotalCycleMultiplier $ ")" @ "must be greater than or equal 0.0"); `Log_Error("SpawnTotalCycleMultiplier" @ "(" $ default.SpawnTotalCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
Errors = true; Errors = true;
} }
if (default.SingleSpawnLimitMultiplier <= 0.f) if (default.SingleSpawnLimitMultiplier <= 0.f)
{ {
`Log_Error("SingleSpawnLimitMultiplier" @ "(" $ default.SingleSpawnLimitMultiplier $ ")" @ "must be greater than 0.0"); `Log_Error("SingleSpawnLimitMultiplier" @ "(" $ default.SingleSpawnLimitMultiplier $ ")" @ "must be greater than 0.0");
Errors = true; Errors = true;
} }
if (default.SingleSpawnLimitPlayerMultiplier < 0.f) if (default.SingleSpawnLimitPlayerMultiplier < 0.f)
{ {
`Log_Error("SingleSpawnLimitPlayerMultiplier" @ "(" $ default.SingleSpawnLimitPlayerMultiplier $ ")" @ "must be greater than or equal 0.0"); `Log_Error("SingleSpawnLimitPlayerMultiplier" @ "(" $ default.SingleSpawnLimitPlayerMultiplier $ ")" @ "must be greater than or equal 0.0");
Errors = true; Errors = true;
} }
if (default.SingleSpawnLimitCycleMultiplier < 0.f) if (default.SingleSpawnLimitCycleMultiplier < 0.f)
{ {
`Log_Error("SingleSpawnLimitCycleMultiplier" @ "(" $ default.SingleSpawnLimitCycleMultiplier $ ")" @ "must be greater than or equal 0.0"); `Log_Error("SingleSpawnLimitCycleMultiplier" @ "(" $ default.SingleSpawnLimitCycleMultiplier $ ")" @ "must be greater than or equal 0.0");
Errors = true; Errors = true;
} }
if (default.AliveSpawnLimit < 0) if (default.AliveSpawnLimit < 0)
{ {
`Log_Error("AliveSpawnLimit" @ "(" $ default.AliveSpawnLimit $ ")" @ "must be greater than or equal 0"); `Log_Error("AliveSpawnLimit" @ "(" $ default.AliveSpawnLimit $ ")" @ "must be greater than or equal 0");
Errors = true; Errors = true;
} }
return !Errors; return !Errors;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,80 +1,80 @@
class SpawnAtPlayerStart extends Object class SpawnAtPlayerStart extends Object
dependson(ZedSpawner) dependson(ZedSpawner)
config(ZedSpawner); config(ZedSpawner);
var private config Array<String> ZedClass; var private config Array<String> ZedClass;
var public config Array<String> Map; var public config Array<String> Map;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
case 2: case 2:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
private static function ApplyDefault(E_LogLevel LogLevel) private static function ApplyDefault(E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
default.ZedClass.Length = 0; default.ZedClass.Length = 0;
default.ZedClass.AddItem("HL2Monsters.Combine_Strider"); default.ZedClass.AddItem("HL2Monsters.Combine_Strider");
default.ZedClass.AddItem("HL2Monsters.Combine_Gunship"); default.ZedClass.AddItem("HL2Monsters.Combine_Gunship");
default.ZedClass.AddItem("HL2Monsters.Hunter_Chopper"); default.ZedClass.AddItem("HL2Monsters.Hunter_Chopper");
default.ZedClass.AddItem("SomePackage.SomeZedClassYouWantToSpawnAtPlayerStart"); default.ZedClass.AddItem("SomePackage.SomeZedClassYouWantToSpawnAtPlayerStart");
default.Map.Length = 0; default.Map.Length = 0;
default.Map.AddItem("KF-SomeMapNameWhereYouWantSpawnZedsAtPlayerStart"); default.Map.AddItem("KF-SomeMapNameWhereYouWantSpawnZedsAtPlayerStart");
} }
public static function Array<class<KFPawn_Monster> > Load(E_LogLevel LogLevel) public static function Array<class<KFPawn_Monster> > Load(E_LogLevel LogLevel)
{ {
local Array<class<KFPawn_Monster> > ZedList; local Array<class<KFPawn_Monster> > ZedList;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
local String ZedClassTmp; local String ZedClassTmp;
local int Line; local int Line;
`Log_TraceStatic(); `Log_TraceStatic();
`Log_Info("Load zeds to spawn at player start:"); `Log_Info("Load zeds to spawn at player start:");
foreach default.ZedClass(ZedClassTmp, Line) foreach default.ZedClass(ZedClassTmp, Line)
{ {
KFPMC = class<KFPawn_Monster>(DynamicLoadObject(ZedClassTmp, class'Class')); KFPMC = class<KFPawn_Monster>(DynamicLoadObject(ZedClassTmp, class'Class'));
if (KFPMC == None) if (KFPMC == None)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp); `Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ ZedClassTmp);
} }
else else
{ {
ZedList.AddItem(KFPMC); ZedList.AddItem(KFPMC);
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp); `Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully:" @ ZedClassTmp);
} }
} }
if (ZedList.Length == default.ZedClass.Length) if (ZedList.Length == default.ZedClass.Length)
{ {
`Log_Info("Spawn at player start list (Zeds) loaded successfully (" $ default.ZedClass.Length @ "entries)"); `Log_Info("Spawn at player start list (Zeds) loaded successfully (" $ default.ZedClass.Length @ "entries)");
} }
else else
{ {
`Log_Info("Spawn at player start list (Zeds): loaded" @ ZedList.Length @ "of" @ default.ZedClass.Length @ "entries"); `Log_Info("Spawn at player start list (Zeds): loaded" @ ZedList.Length @ "of" @ default.ZedClass.Length @ "entries");
} }
return ZedList; return ZedList;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,142 +1,142 @@
class SpawnListBossWaves extends Object class SpawnListBossWaves extends Object
dependson(ZedSpawner) dependson(ZedSpawner)
config(ZedSpawner); config(ZedSpawner);
struct S_SpawnEntryCfg struct S_SpawnEntryCfg
{ {
var String BossClass; var String BossClass;
var String ZedClass; var String ZedClass;
var int Delay; var int Delay;
var int Probability; var int Probability;
var int SpawnCountBase; var int SpawnCountBase;
var int SingleSpawnLimit; var int SingleSpawnLimit;
}; };
var public config bool bStopRegularSpawn; var public config bool bStopRegularSpawn;
var private config Array<S_SpawnEntryCfg> Spawn; var private config Array<S_SpawnEntryCfg> Spawn;
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(KFGIA, LogLevel); ApplyDefault(KFGIA, LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel) private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel)
{ {
local S_SpawnEntryCfg SpawnEntry; local S_SpawnEntryCfg SpawnEntry;
local Array<class<KFPawn_Monster> > KFPM_Bosses; local Array<class<KFPawn_Monster> > KFPM_Bosses;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
`Log_TraceStatic(); `Log_TraceStatic();
default.Spawn.Length = 0; default.Spawn.Length = 0;
default.bStopRegularSpawn = true; default.bStopRegularSpawn = true;
default.Spawn.Length = 0; default.Spawn.Length = 0;
SpawnEntry.ZedClass = "SomePackage.SomeClass"; SpawnEntry.ZedClass = "SomePackage.SomeClass";
SpawnEntry.SpawnCountBase = 2; SpawnEntry.SpawnCountBase = 2;
SpawnEntry.SingleSpawnLimit = 1; SpawnEntry.SingleSpawnLimit = 1;
SpawnEntry.Delay = 30; SpawnEntry.Delay = 30;
SpawnEntry.Probability = 100; SpawnEntry.Probability = 100;
KFPM_Bosses = KFGIA.GetAIBossClassList(LogLevel); KFPM_Bosses = KFGIA.GetAIBossClassList(LogLevel);
foreach KFPM_Bosses(KFPMC) foreach KFPM_Bosses(KFPMC)
{ {
SpawnEntry.BossClass = "KFGameContent." $ String(KFPMC); SpawnEntry.BossClass = "KFGameContent." $ String(KFPMC);
default.Spawn.AddItem(SpawnEntry); default.Spawn.AddItem(SpawnEntry);
} }
} }
public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel) public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
{ {
local Array<S_SpawnEntry> SpawnList; local Array<S_SpawnEntry> SpawnList;
local S_SpawnEntryCfg SpawnEntryCfg; local S_SpawnEntryCfg SpawnEntryCfg;
local S_SpawnEntry SpawnEntry; local S_SpawnEntry SpawnEntry;
local int Line; local int Line;
local bool Errors; local bool Errors;
`Log_TraceStatic(); `Log_TraceStatic();
`Log_Info("Load boss waves spawn list:"); `Log_Info("Load boss waves spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line) foreach default.Spawn(SpawnEntryCfg, Line)
{ {
Errors = false; Errors = false;
SpawnEntry.BossClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.BossClass, class'Class')); SpawnEntry.BossClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.BossClass, class'Class'));
if (SpawnEntry.BossClass == None) if (SpawnEntry.BossClass == None)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load boss class:" @ SpawnEntryCfg.BossClass); `Log_Warn("[" $ Line + 1 $ "]" @ "Can't load boss class:" @ SpawnEntryCfg.BossClass);
Errors = true; Errors = true;
} }
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class')); SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
if (SpawnEntry.ZedClass == None) if (SpawnEntry.ZedClass == None)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass); `Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
Errors = true; Errors = true;
} }
SpawnEntry.RelativeStartDefault = 0.f; SpawnEntry.RelativeStartDefault = 0.f;
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay; SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
if (SpawnEntryCfg.Delay <= 0) if (SpawnEntryCfg.Delay <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f; SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100) if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100"); `Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
Errors = true; Errors = true;
} }
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase; SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
if (SpawnEntry.SpawnCountBase <= 0) if (SpawnEntry.SpawnCountBase <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit; SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
if (SpawnEntry.SingleSpawnLimit < 0) if (SpawnEntry.SingleSpawnLimit < 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
Errors = true; Errors = true;
} }
if (!Errors) if (!Errors)
{ {
SpawnList.AddItem(SpawnEntry); SpawnList.AddItem(SpawnEntry);
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.BossClass $ ")" @ SpawnEntryCfg.ZedClass); `Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.BossClass $ ")" @ SpawnEntryCfg.ZedClass);
} }
} }
if (SpawnList.Length == default.Spawn.Length) if (SpawnList.Length == default.Spawn.Length)
{ {
`Log_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)"); `Log_Info("Boss spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
} }
else else
{ {
`Log_Info("Boss spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries"); `Log_Info("Boss spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
} }
return SpawnList; return SpawnList;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,155 +1,155 @@
class SpawnListRegular extends Object class SpawnListRegular extends Object
dependson(ZedSpawner) dependson(ZedSpawner)
config(ZedSpawner); config(ZedSpawner);
struct S_SpawnEntryCfg struct S_SpawnEntryCfg
{ {
var int Wave; var int Wave;
var String ZedClass; var String ZedClass;
var int RelativeStart; var int RelativeStart;
var int Delay; var int Delay;
var int Probability; var int Probability;
var int SpawnCountBase; var int SpawnCountBase;
var int SingleSpawnLimit; var int SingleSpawnLimit;
}; };
var public config Array<S_SpawnEntryCfg> Spawn; var public config Array<S_SpawnEntryCfg> Spawn;
delegate int SpawnListSort(S_SpawnEntryCfg A, S_SpawnEntryCfg B) delegate int SpawnListSort(S_SpawnEntryCfg A, S_SpawnEntryCfg B)
{ {
return A.Wave > B.Wave ? -1 : 0; return A.Wave > B.Wave ? -1 : 0;
} }
public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, KFGI_Access KFGIA, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(KFGIA, LogLevel); ApplyDefault(KFGIA, LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel) private static function ApplyDefault(KFGI_Access KFGIA, E_LogLevel LogLevel)
{ {
local S_SpawnEntryCfg SpawnEntry; local S_SpawnEntryCfg SpawnEntry;
local Array<class<KFPawn_Monster> > KFPM_Zeds; local Array<class<KFPawn_Monster> > KFPM_Zeds;
local class<KFPawn_Monster> KFPMC; local class<KFPawn_Monster> KFPMC;
`Log_TraceStatic(); `Log_TraceStatic();
default.Spawn.Length = 0; default.Spawn.Length = 0;
SpawnEntry.Wave = 0; SpawnEntry.Wave = 0;
SpawnEntry.SpawnCountBase = 2; SpawnEntry.SpawnCountBase = 2;
SpawnEntry.SingleSpawnLimit = 1; SpawnEntry.SingleSpawnLimit = 1;
SpawnEntry.RelativeStart = 25; SpawnEntry.RelativeStart = 25;
SpawnEntry.Delay = 60; SpawnEntry.Delay = 60;
SpawnEntry.Probability = 100; SpawnEntry.Probability = 100;
KFPM_Zeds = KFGIA.GetAIClassList(LogLevel); KFPM_Zeds = KFGIA.GetAIClassList(LogLevel);
foreach KFPM_Zeds(KFPMC) foreach KFPM_Zeds(KFPMC)
{ {
++SpawnEntry.Wave; ++SpawnEntry.Wave;
SpawnEntry.ZedClass = "KFGameContent." $ String(KFPMC); SpawnEntry.ZedClass = "KFGameContent." $ String(KFPMC);
default.Spawn.AddItem(SpawnEntry); default.Spawn.AddItem(SpawnEntry);
} }
} }
public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel) public static function Array<S_SpawnEntry> Load(E_LogLevel LogLevel)
{ {
local Array<S_SpawnEntry> SpawnList; local Array<S_SpawnEntry> SpawnList;
local S_SpawnEntryCfg SpawnEntryCfg; local S_SpawnEntryCfg SpawnEntryCfg;
local S_SpawnEntry SpawnEntry; local S_SpawnEntry SpawnEntry;
local int Line; local int Line;
local bool Errors; local bool Errors;
`Log_TraceStatic(); `Log_TraceStatic();
`Log_Info("Load spawn list:"); `Log_Info("Load spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line) foreach default.Spawn(SpawnEntryCfg, Line)
{ {
Errors = false; Errors = false;
SpawnEntry.Wave = SpawnEntryCfg.Wave; SpawnEntry.Wave = SpawnEntryCfg.Wave;
if (SpawnEntryCfg.Wave <= 0 || SpawnEntryCfg.Wave > 255) if (SpawnEntryCfg.Wave <= 0 || SpawnEntryCfg.Wave > 255)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Wave" @ "(" $ SpawnEntryCfg.ZedClass $ ")" @ "must be greater than 0 and less than 256"); `Log_Warn("[" $ Line + 1 $ "]" @ "Wave" @ "(" $ SpawnEntryCfg.ZedClass $ ")" @ "must be greater than 0 and less than 256");
Errors = true; Errors = true;
} }
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class')); SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
if (SpawnEntry.ZedClass == None) if (SpawnEntry.ZedClass == None)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass); `Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
Errors = true; Errors = true;
} }
SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f; SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f;
if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100) if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100"); `Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
Errors = true; Errors = true;
} }
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay; SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
if (SpawnEntryCfg.Delay <= 0) if (SpawnEntryCfg.Delay <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f; SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100) if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100"); `Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
Errors = true; Errors = true;
} }
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase; SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
if (SpawnEntry.SpawnCountBase <= 0) if (SpawnEntry.SpawnCountBase <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit; SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
if (SpawnEntry.SingleSpawnLimit < 0) if (SpawnEntry.SingleSpawnLimit < 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
Errors = true; Errors = true;
} }
if (!Errors) if (!Errors)
{ {
SpawnList.AddItem(SpawnEntry); SpawnList.AddItem(SpawnEntry);
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass); `Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (w" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
} }
} }
default.Spawn.Sort(SpawnListSort); default.Spawn.Sort(SpawnListSort);
if (SpawnList.Length == default.Spawn.Length) if (SpawnList.Length == default.Spawn.Length)
{ {
`Log_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)"); `Log_Info("Regular spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
} }
else else
{ {
`Log_Info("Regular spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries"); `Log_Info("Regular spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
} }
return SpawnList; return SpawnList;
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -1,151 +1,151 @@
class SpawnListSpecialWaves extends Object class SpawnListSpecialWaves extends Object
dependson(ZedSpawner) dependson(ZedSpawner)
config(ZedSpawner); config(ZedSpawner);
struct S_SpawnEntryCfg struct S_SpawnEntryCfg
{ {
var EAIType Wave; var EAIType Wave;
var String ZedClass; var String ZedClass;
var int RelativeStart; var int RelativeStart;
var int Delay; var int Delay;
var int Probability; var int Probability;
var int SpawnCountBase; var int SpawnCountBase;
var int SingleSpawnLimit; var int SingleSpawnLimit;
}; };
var public config bool bStopRegularSpawn; var public config bool bStopRegularSpawn;
var private config Array<S_SpawnEntryCfg> Spawn; var private config Array<S_SpawnEntryCfg> Spawn;
public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel) public static function InitConfig(int Version, int LatestVersion, E_LogLevel LogLevel)
{ {
`Log_TraceStatic(); `Log_TraceStatic();
switch (Version) switch (Version)
{ {
case `NO_CONFIG: case `NO_CONFIG:
ApplyDefault(LogLevel); ApplyDefault(LogLevel);
default: break; default: break;
} }
if (LatestVersion != Version) if (LatestVersion != Version)
{ {
StaticSaveConfig(); StaticSaveConfig();
} }
} }
private static function ApplyDefault(E_LogLevel LogLevel) private static function ApplyDefault(E_LogLevel LogLevel)
{ {
local S_SpawnEntryCfg SpawnEntry; local S_SpawnEntryCfg SpawnEntry;
local EAIType AIType; local EAIType AIType;
`Log_TraceStatic(); `Log_TraceStatic();
default.bStopRegularSpawn = true; default.bStopRegularSpawn = true;
default.Spawn.Length = 0; default.Spawn.Length = 0;
SpawnEntry.ZedClass = "SomePackage.SomeClass"; SpawnEntry.ZedClass = "SomePackage.SomeClass";
SpawnEntry.SpawnCountBase = 2; SpawnEntry.SpawnCountBase = 2;
SpawnEntry.SingleSpawnLimit = 1; SpawnEntry.SingleSpawnLimit = 1;
SpawnEntry.RelativeStart = 0; SpawnEntry.RelativeStart = 0;
SpawnEntry.Delay = 60; SpawnEntry.Delay = 60;
SpawnEntry.Probability = 100; SpawnEntry.Probability = 100;
foreach class'KFGameInfo_Endless'.default.SpecialWaveTypes(AIType) foreach class'KFGameInfo_Endless'.default.SpecialWaveTypes(AIType)
{ {
SpawnEntry.Wave = AIType; SpawnEntry.Wave = AIType;
default.Spawn.AddItem(SpawnEntry); default.Spawn.AddItem(SpawnEntry);
} }
} }
public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogLevel LogLevel) public static function Array<S_SpawnEntry> Load(KFGameInfo_Endless KFGIE, E_LogLevel LogLevel)
{ {
local Array<S_SpawnEntry> SpawnList; local Array<S_SpawnEntry> SpawnList;
local S_SpawnEntryCfg SpawnEntryCfg; local S_SpawnEntryCfg SpawnEntryCfg;
local S_SpawnEntry SpawnEntry; local S_SpawnEntry SpawnEntry;
local int Line; local int Line;
local bool Errors; local bool Errors;
`Log_TraceStatic(); `Log_TraceStatic();
if (KFGIE == None) if (KFGIE == None)
{ {
`Log_Info("Not Endless mode, skip loading special waves"); `Log_Info("Not Endless mode, skip loading special waves");
return SpawnList; return SpawnList;
} }
`Log_Info("Load special waves spawn list:"); `Log_Info("Load special waves spawn list:");
foreach default.Spawn(SpawnEntryCfg, Line) foreach default.Spawn(SpawnEntryCfg, Line)
{ {
Errors = false; Errors = false;
SpawnEntry.Wave = SpawnEntryCfg.Wave; SpawnEntry.Wave = SpawnEntryCfg.Wave;
if (KFGIE.SpecialWaveTypes.Find(EAIType(SpawnEntryCfg.Wave)) == INDEX_NONE) if (KFGIE.SpecialWaveTypes.Find(EAIType(SpawnEntryCfg.Wave)) == INDEX_NONE)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Unknown special wave:" @ SpawnEntryCfg.Wave); `Log_Warn("[" $ Line + 1 $ "]" @ "Unknown special wave:" @ SpawnEntryCfg.Wave);
Errors = true; Errors = true;
} }
SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class')); SpawnEntry.ZedClass = class<KFPawn_Monster>(DynamicLoadObject(SpawnEntryCfg.ZedClass, class'Class'));
if (SpawnEntry.ZedClass == None) if (SpawnEntry.ZedClass == None)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass); `Log_Warn("[" $ Line + 1 $ "]" @ "Can't load zed class:" @ SpawnEntryCfg.ZedClass);
Errors = true; Errors = true;
} }
SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f; SpawnEntry.RelativeStartDefault = SpawnEntryCfg.RelativeStart / 100.f;
if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100) if (SpawnEntryCfg.RelativeStart < 0 || SpawnEntryCfg.RelativeStart > 100)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100"); `Log_Warn("[" $ Line + 1 $ "]" @ "RelativeStart" @ "(" $ SpawnEntryCfg.RelativeStart $ ")" @ "must be greater than or equal 0 and less than or equal 100");
Errors = true; Errors = true;
} }
SpawnEntry.DelayDefault = SpawnEntryCfg.Delay; SpawnEntry.DelayDefault = SpawnEntryCfg.Delay;
if (SpawnEntryCfg.Delay <= 0) if (SpawnEntryCfg.Delay <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "Delay" @ "(" $ SpawnEntryCfg.Delay $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f; SpawnEntry.Probability = SpawnEntryCfg.Probability / 100.f;
if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100) if (SpawnEntryCfg.Probability <= 0 || SpawnEntryCfg.Probability > 100)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100"); `Log_Warn("[" $ Line + 1 $ "]" @ "Probability" @ "(" $ SpawnEntryCfg.Probability $ ")" @ "must be greater than 0 and less than or equal 100");
Errors = true; Errors = true;
} }
SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase; SpawnEntry.SpawnCountBase = SpawnEntryCfg.SpawnCountBase;
if (SpawnEntry.SpawnCountBase <= 0) if (SpawnEntry.SpawnCountBase <= 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SpawnCountBase" @ "(" $ SpawnEntryCfg.SpawnCountBase $ ")" @ "must be greater than 0");
Errors = true; Errors = true;
} }
SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit; SpawnEntry.SingleSpawnLimitDefault = SpawnEntryCfg.SingleSpawnLimit;
if (SpawnEntry.SingleSpawnLimit < 0) if (SpawnEntry.SingleSpawnLimit < 0)
{ {
`Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0"); `Log_Warn("[" $ Line + 1 $ "]" @ "SingleSpawnLimit" @ "(" $ SpawnEntryCfg.SingleSpawnLimit $ ")" @ "must be equal or greater than 0");
Errors = true; Errors = true;
} }
if (!Errors) if (!Errors)
{ {
SpawnList.AddItem(SpawnEntry); SpawnList.AddItem(SpawnEntry);
`Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass); `Log_Debug("[" $ Line + 1 $ "]" @ "Loaded successfully: (" $ SpawnEntryCfg.Wave $ ")" @ SpawnEntryCfg.ZedClass);
} }
} }
if (SpawnList.Length == default.Spawn.Length) if (SpawnList.Length == default.Spawn.Length)
{ {
`Log_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)"); `Log_Info("Special spawn list loaded successfully (" $ default.Spawn.Length @ "entries)");
} }
else else
{ {
`Log_Info("Special spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries"); `Log_Info("Special spawn list: loaded" @ SpawnList.Length @ "of" @ default.Spawn.Length @ "entries");
} }
return SpawnList; return SpawnList;
} }
defaultproperties defaultproperties
{ {
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
[Flags] [Flags]
AllowDownload=True AllowDownload=True
ClientOptional=False ClientOptional=False
ServerSideOnly=False ServerSideOnly=False

View File

@ -1,56 +1,56 @@
class ZedSpawnerMut extends KFMutator class ZedSpawnerMut extends KFMutator
dependson(ZedSpawner); dependson(ZedSpawner);
var private ZedSpawner ZS; var private ZedSpawner ZS;
public event PreBeginPlay() public event PreBeginPlay()
{ {
Super.PreBeginPlay(); Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return; if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS) foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
{ {
break; break;
} }
if (ZS == None) if (ZS == None)
{ {
ZS = WorldInfo.Spawn(class'ZedSpawner'); ZS = WorldInfo.Spawn(class'ZedSpawner');
} }
if (ZS == None) if (ZS == None)
{ {
`Log_Base("FATAL: Can't Spawn 'ZedSpawner'"); `Log_Base("FATAL: Can't Spawn 'ZedSpawner'");
Destroy(); Destroy();
} }
} }
public function AddMutator(Mutator Mut) public function AddMutator(Mutator Mut)
{ {
if (Mut == Self) return; if (Mut == Self) return;
if (Mut.Class == Class) if (Mut.Class == Class)
Mut.Destroy(); Mut.Destroy();
else else
Super.AddMutator(Mut); Super.AddMutator(Mut);
} }
public function NotifyLogin(Controller C) public function NotifyLogin(Controller C)
{ {
ZS.NotifyLogin(C); ZS.NotifyLogin(C);
Super.NotifyLogin(C); Super.NotifyLogin(C);
} }
public function NotifyLogout(Controller C) public function NotifyLogout(Controller C)
{ {
ZS.NotifyLogout(C); ZS.NotifyLogout(C);
Super.NotifyLogout(C); Super.NotifyLogout(C);
} }
defaultproperties defaultproperties
{ {
} }

View File

@ -3,7 +3,7 @@ class ZedSpawnerRepInfo extends ReplicationInfo;
var public ZedSpawner ZS; var public ZedSpawner ZS;
var public E_LogLevel LogLevel; var public E_LogLevel LogLevel;
var public Array<class<KFPawn_Monster> > CustomZeds; var public Array<class<KFPawn_Monster> > CustomZeds;
var private int Recieved; var private int Recieved;
replication replication
{ {
@ -19,7 +19,7 @@ public simulated function bool SafeDestroy()
public reliable client function ClientSync(class<KFPawn_Monster> CustomZed) public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
{ {
`Log_Trace(); `Log_Trace();
`Log_Debug("Received:" @ CustomZed); `Log_Debug("Received:" @ CustomZed);
CustomZeds.AddItem(CustomZed); CustomZeds.AddItem(CustomZed);
ServerSync(); ServerSync();
@ -28,24 +28,24 @@ public reliable client function ClientSync(class<KFPawn_Monster> CustomZed)
public reliable client function SyncFinished() public reliable client function SyncFinished()
{ {
local class<KFPawn_Monster> CustomZed; local class<KFPawn_Monster> CustomZed;
`Log_Trace(); `Log_Trace();
foreach CustomZeds(CustomZed) foreach CustomZeds(CustomZed)
{ {
`Log_Debug("Preload Content for" @ CustomZed); `Log_Debug("Preload Content for" @ CustomZed);
CustomZed.static.PreloadContent(); CustomZed.static.PreloadContent();
} }
SafeDestroy(); SafeDestroy();
} }
public reliable server function ServerSync() public reliable server function ServerSync()
{ {
`Log_Trace(); `Log_Trace();
if (bPendingDelete || bDeleteMe) return; if (bPendingDelete || bDeleteMe) return;
if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone) if (CustomZeds.Length == Recieved || WorldInfo.NetMode == NM_StandAlone)
{ {
`Log_Debug("Sync finished"); `Log_Debug("Sync finished");
@ -67,6 +67,6 @@ defaultproperties
bAlwaysRelevant = false; bAlwaysRelevant = false;
bOnlyRelevantToOwner = true; bOnlyRelevantToOwner = true;
bSkipActorPropertyReplication = false; bSkipActorPropertyReplication = false;
Recieved = 0 Recieved = 0
} }

View File

@ -1,20 +1,20 @@
class _Logger extends Object class _Logger extends Object
abstract; abstract;
enum E_LogLevel enum E_LogLevel
{ {
LL_WrongLevel, LL_WrongLevel,
LL_None, LL_None,
LL_Fatal, LL_Fatal,
LL_Error, LL_Error,
LL_Warning, LL_Warning,
LL_Info, LL_Info,
LL_Debug, LL_Debug,
LL_Trace, LL_Trace,
LL_All LL_All
}; };
defaultproperties defaultproperties
{ {
} }

View File

@ -1,2 +1,2 @@
// Constants // Constants
`define NO_CONFIG 0 `define NO_CONFIG 0

View File

@ -1,15 +1,15 @@
// Logger // Logger
`define Log_Tag 'ZedSpawner' `define Log_Tag 'ZedSpawner'
`define LocationStatic "`{ClassName}::" $ GetFuncName() `define LocationStatic "`{ClassName}::" $ GetFuncName()
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag) `define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag) `define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag)
`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag) `define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag) `define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag)
`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag) `define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag)
`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag) `define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag)
`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag) `define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)

View File

@ -7,7 +7,7 @@ StripSource="True"
# Mutators to be compiled # Mutators to be compiled
# Specify them with a space as a separator, # Specify them with a space as a separator,
# Mutators will be compiled in the specified order # Mutators will be compiled in the specified order
PackageBuildOrder="ZedSpawner" PackageBuildOrder="ZedSpawner"
@ -16,7 +16,7 @@ PackageBuildOrder="ZedSpawner"
# Packages you want to brew using @peelz's patched KFEditor. # Packages you want to brew using @peelz's patched KFEditor.
# Useful for cases where regular brew doesn't put *.upk inside the package. # Useful for cases where regular brew doesn't put *.upk inside the package.
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackagePeelzBrew="" PackagePeelzBrew=""
@ -24,7 +24,7 @@ PackagePeelzBrew=""
# Mutators that will be uploaded to the workshop # Mutators that will be uploaded to the workshop
# Specify them with a space as a separator, # Specify them with a space as a separator,
# The order doesn't matter # The order doesn't matter
PackageUpload="ZedSpawner" PackageUpload="ZedSpawner"