Merge pull request #3 from GenZmeY/MegaLinter

add Mega Linter
This commit is contained in:
GenZmeY 2023-05-14 11:38:56 +03:00 committed by GitHub
commit aef92c7d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 296 additions and 199 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

@ -1,105 +1,105 @@
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-StartWave[/img] [img]https://img.shields.io/steam/subscriptions/2521731447[/img] [img]https://img.shields.io/steam/favorites/2521731447[/img] [img]https://img.shields.io/steam/update-date/2521731447[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2521731447][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-StartWave[/img][/url]
[h1]Description:[/h1]
This is the same as [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496]Pharrahnox's SetWave[/url], but with some fixes:
- fixed starting Dosh for Endless mode.
A utility mod that allows users to specify the starting wave and the boss that will spawn. Additionally, users can jump between waves during the match with a console command (mutate setwave, see below).
The purpose of this mod is to allow mappers to more efficiently test their maps for later waves or for the boss. It could also be used to skip early waves if you find them boring, or to test strategies against a specific boss.
It is designed to be compatible with every mutator and wave-based gamemode, and to require little to no maintenance after game updates.
[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]
[olist]
[*]Subscribe to this mutator;
[*]Start KF2;
[*]Open console (`) and input:
[b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWave?[/b]
(replace the map and add the parameters you need)
[*]<Enter>.
[/olist]
[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]
[olist]
[*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
[*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
[b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2521731447[/b]
[*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=StartWave.StartWave[/b] and restart the server.
[/olist]
[h1]Mutator setup[/h1]
You can use a config if you don't want to specify parameters in the startup line:
Create a file KFGame/Config/KFStartWave.ini and copy this text into it:
[code]
[StartWave.StartWave]
// Any settings not specified in the launch command will use the values stored here.
// If you use the same settings often, it is recommended to store those here
// and only change what you need in the launch command.
// Whether mod-specific events should be logged.
bUseDebug=true
// Whether an 'initial' trader time should occur before the first wave.
bStartWithTrader=false
// The wave that the match should start on. It is clamped between wave 1 and the boss wave.
StartWave=1
// The duration of the 'initial' trader (before the first wave).
InitialTraderTime=60
// The duration of standard trader (between waves).
TraderTime=60
// The starting dosh of players.
Dosh=250
// The boss override index.
// For the default boss list, 0-Hans, 1-Patty, 2-King FP, 3-Abomination.
// Negative values can be used to keep the boss spawn random.
Boss=-1
[/code]
You can change the config as you need.
[b]The setwave command[/b]
To jump to any wave during the match, use the setwave command which has the definition: mutate setwave WaveNum bSkipTraderTime. Cheats must be enabled for this command to work.
Example usages (all to be typed into the console):
[code]
mutate setwave 5 true // jump to wave 5 with no trader time.
mutate setwave 3 false // jump to wave 3 with trader time.
mutate setwave 3 // identical to the above (the last parameter defaults to false).
[/code]
You can jump forwards or backwards between waves (e.g. from 5 -> 2 -> 8 -> 3, etc.)
[h1]If not working[/h1]
Older versions of SetWave have the same file names - this can cause conflicts if you subscribe to them. Therefore:
1. Check your subscriptions. If you are subscribed to old versions of the mutator, cancel them.
2. Clear the cache (the game doesn't clear it). It's here:
[code]
Client:
C:\Users\<YOUR_USERNAME>\Documents\My Games\KillingFloor2\KFGame\Cache\
Server:
<KF2_DIR>/Binaries/Win64/steamapps/workshop/content/232090/
<KF2_DIR>/KFGame/Cache/
[/code]
If its not a problem for you to download all subscriptions again, you can simply clear this folder(s). Your subscriptions are downloaded the next time you start the game/server.
If you do not want to download the subscriptions again, delete only those folders that contain SetWave.u file.
3. Try starting the game/server again.
[h1]Bug reports[/h1]
I didn't test the mod very much because I only needed to fix a bug with Dosh.
If you find any other problems, please describe how to reproduce them. Maybe I can fix it.
You can do it right here, but I'll be much happier if you do it [url=https://github.com/GenZmeY/KF2-StartWave/issues]in issues on github[/url] .
[h1]Sources[/h1]
[img]https://img.shields.io/static/v1?logo=GitHub&labelColor=gray&color=blue&logoColor=white&label=&message=Open Source[/img] [img]https://img.shields.io/github/license/GenZmeY/KF2-StartWave[/img] [img]https://img.shields.io/steam/subscriptions/2521731447[/img] [img]https://img.shields.io/steam/favorites/2521731447[/img] [img]https://img.shields.io/steam/update-date/2521731447[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2521731447][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-StartWave[/img][/url]
[h1]Description:[/h1]
This is the same as [url=https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496]Pharrahnox's SetWave[/url], but with some fixes:
- fixed starting Dosh for Endless mode.
A utility mod that allows users to specify the starting wave and the boss that will spawn. Additionally, users can jump between waves during the match with a console command (mutate setwave, see below).
The purpose of this mod is to allow mappers to more efficiently test their maps for later waves or for the boss. It could also be used to skip early waves if you find them boring, or to test strategies against a specific boss.
It is designed to be compatible with every mutator and wave-based gamemode, and to require little to no maintenance after game updates.
[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]
[olist]
[*]Subscribe to this mutator;
[*]Start KF2;
[*]Open console (`) and input:
[b]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWave?[/b]
(replace the map and add the parameters you need)
[*]<Enter>.
[/olist]
[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]
[olist]
[*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
[*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
[b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2521731447[/b]
[*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=StartWave.StartWave[/b] and restart the server.
[/olist]
[h1]Mutator setup[/h1]
You can use a config if you don't want to specify parameters in the startup line:
Create a file KFGame/Config/KFStartWave.ini and copy this text into it:
[code]
[StartWave.StartWave]
// Any settings not specified in the launch command will use the values stored here.
// If you use the same settings often, it is recommended to store those here
// and only change what you need in the launch command.
// Whether mod-specific events should be logged.
bUseDebug=true
// Whether an 'initial' trader time should occur before the first wave.
bStartWithTrader=false
// The wave that the match should start on. It is clamped between wave 1 and the boss wave.
StartWave=1
// The duration of the 'initial' trader (before the first wave).
InitialTraderTime=60
// The duration of standard trader (between waves).
TraderTime=60
// The starting dosh of players.
Dosh=250
// The boss override index.
// For the default boss list, 0-Hans, 1-Patty, 2-King FP, 3-Abomination.
// Negative values can be used to keep the boss spawn random.
Boss=-1
[/code]
You can change the config as you need.
[b]The setwave command[/b]
To jump to any wave during the match, use the setwave command which has the definition: mutate setwave WaveNum bSkipTraderTime. Cheats must be enabled for this command to work.
Example usages (all to be typed into the console):
[code]
mutate setwave 5 true // jump to wave 5 with no trader time.
mutate setwave 3 false // jump to wave 3 with trader time.
mutate setwave 3 // identical to the above (the last parameter defaults to false).
[/code]
You can jump forwards or backwards between waves (e.g. from 5 -> 2 -> 8 -> 3, etc.)
[h1]If not working[/h1]
Older versions of SetWave have the same file names - this can cause conflicts if you subscribe to them. Therefore:
1. Check your subscriptions. If you are subscribed to old versions of the mutator, cancel them.
2. Clear the cache (the game doesn't clear it). It's here:
[code]
Client:
C:\Users\<YOUR_USERNAME>\Documents\My Games\KillingFloor2\KFGame\Cache\
Server:
<KF2_DIR>/Binaries/Win64/steamapps/workshop/content/232090/
<KF2_DIR>/KFGame/Cache/
[/code]
If its not a problem for you to download all subscriptions again, you can simply clear this folder(s). Your subscriptions are downloaded the next time you start the game/server.
If you do not want to download the subscriptions again, delete only those folders that contain SetWave.u file.
3. Try starting the game/server again.
[h1]Bug reports[/h1]
I didn't test the mod very much because I only needed to fix a bug with Dosh.
If you find any other problems, please describe how to reproduce them. Maybe I can fix it.
You can do it right here, but I'll be much happier if you do it [url=https://github.com/GenZmeY/KF2-StartWave/issues]in issues on github[/url] .
[h1]Sources[/h1]
[url=https://github.com/GenZmeY/KF2-StartWave]https://github.com/GenZmeY/KF2-StartWave[/url] [b](GNU GPLv3)[/b]

View File

@ -3,11 +3,11 @@
[![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=2521731447)
[![Steam Downloads](https://img.shields.io/steam/downloads/2521731447)](https://steamcommunity.com/sharedfiles/filedetails/?id=2521731447)
[![Steam Favorites](https://img.shields.io/steam/favorites/2521731447)](https://steamcommunity.com/sharedfiles/filedetails/?id=2521731447)
[![Steam Update Date](https://img.shields.io/steam/update-date/2521731447)](https://steamcommunity.com/sharedfiles/filedetails/?id=2521731447)
[![MegaLinter](https://github.com/GenZmeY/KF2-StartWave/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-StartWave/actions/workflows/mega-linter.yml)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-StartWave)](https://github.com/GenZmeY/KF2-StartWave/tags)
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-StartWave)](LICENSE)
# Description
## Description
A utility mod that allows users to specify the starting wave and the boss that will spawn. Additionally, users can jump between waves during the match with a console command (mutate setwave, see below).
The purpose of this mod is to allow mappers to more efficiently test their maps for later waves or for the boss. It could also be used to skip early waves if you find them boring, or to test strategies against a specific boss.
It is designed to be compatible with every mutator and wave-based gamemode, and to require little to no maintenance after game updates.
@ -15,42 +15,34 @@ It is designed to be compatible with every mutator and wave-based gamemode, and
**This is the same as [Pharrahnox's StartWave](https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496), but with some fixes:**
- fixed starting Dosh for Endless mode.
# Usage
## Usage
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2521731447)
***
**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.
# 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.
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);
## 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.
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:
`cd <ANY_FOLDER_YOU_WANT>`
3. Clone this repository and go to the source folder:
`git clone https://github.com/GenZmeY/KF2-StartWave && cd KF2-StartWave`
`git clone https://github.com/GenZmeY/KF2-StartWave && cd KF2-StartWave`
4. Download dependencies:
`git submodule init && git submodule update`
5. Compile:
`./tools/builder -c`
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
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
## Bug reports
If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-StartWave/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.
Attach screenshots if you think it might help.
Attach screenshots if you think it might help.
If it's a crash issue, be sure to include the `Launch.log` and `Launch_2.log` files. You can find them here:
If it's a crash issue, be sure to include the `Launch.log` file. You can find it here:
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Logs\`
Please note that these files are overwritten every time you start the game/server. Therefore, you must take these files immediately after the game crashes in order not to lose information.
# License
[GNU GPLv3](LICENSE)
## License
[![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE)

View File

@ -40,7 +40,7 @@ function InitMutator(string Options, out string ErrorMessage)
{
//This needs to be called first since KFMutator.InitMutator sets the MyKFGI reference.
Super.InitMutator(Options, ErrorMessage);
//Parse options entered via the launch command.
//We further restrict StartWave later when we know the maximum wave number for the selected game length.
StartWave = Max(class'GameInfo'.static.GetIntOption(Options, "StartWave", StartWave), 1);
@ -51,7 +51,7 @@ function InitMutator(string Options, out string ErrorMessage)
Boss = class'GameInfo'.static.GetIntOption(Options, "Boss", Boss);
bStartWithTrader = GetBoolOption(Options, "bStartWithTrader", bStartWithTrader);
bUseDebug = GetBoolOption(Options, "bUseDebug", bUseDebug);
//DEBUG
`log("StartWave: "$StartWave, bUseDebug, 'StartWave');
`log("InitialTraderTime: "$InitialTraderTime, bUseDebug, 'StartWave');
@ -59,23 +59,23 @@ function InitMutator(string Options, out string ErrorMessage)
`log("Dosh: "$Dosh, bUseDebug, 'StartWave');
`log("Boss: "$Boss, bUseDebug, 'StartWave');
`log("bStartWithTrader: "$bStartWithTrader, bUseDebug, 'StartWave');
bOverridenDifficultySettings = false;
bOverridenTraderDuration = false;
SetTimer(0.1, false, nameof(OverrideTimer));
//Override the boss with the boss corresponding to the specified boss index. -1 signifies random.
if(Boss != -1)
{
SetTimer(0.1, false, nameof(OverrideBoss));
}
CheckForceInitialTrader();
//We only care if this is the 'initial' trader time if we start with the trader active.
bInitialTrader = bStartWithTrader;
//If we want to start with the trader active or alter the starting wave number.
if(bStartWithTrader || StartWave > 1)
{
@ -83,7 +83,7 @@ function InitMutator(string Options, out string ErrorMessage)
bUseDebug, 'StartWave');
SetTimer(0.2, false, nameof(StartWaveTimer));
}
//If we will need to alter TimeBetweenWaves for later activations of the trader.
if(bStartWithTrader && InitialTraderTime != TraderTime)
{
@ -97,22 +97,22 @@ function InitMutator(string Options, out string ErrorMessage)
function Mutate(string MutateString, PlayerController Sender)
{
local array<string> CommandBreakdown;
if(MutateString == "")
{
return;
}
//Split the string on the space character.
ParseStringIntoArray(MutateString, CommandBreakdown, " ", true);
//The CheatManager check is equivalent to checking if cheats are enabled for that player.
if(CommandBreakdown.Length > 1 && CommandBreakdown[0] == "setwave" && Sender.CheatManager != None &&
MyKFGI.GetLivingPlayerCount() > 0)
{
//The setwave command should be: mutate setwave WaveNum bSkipTraderTime
//where WaveNum is an integer (or byte) and bSkipTraderTime is a bool.
if(CommandBreakdown.Length == 2)
{
SetWave(int(CommandBreakdown[1]), Sender);
@ -122,7 +122,7 @@ function Mutate(string MutateString, PlayerController Sender)
SetWave(int(CommandBreakdown[1]), Sender, bool(CommandBreakdown[2]));
}
}
Super.Mutate(MutateString, Sender);
}
@ -134,7 +134,7 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
`log("SetWave: new wave num must be > 0.", true, 'StartWave');
return;
}
if(KFGameInfo_Endless(MyKFGI) != None)
{
//Jump straight to the final wave if the specified wave number is higher than wave max.
@ -151,22 +151,22 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
NewWaveNum = KFGameInfo_Survival(MyKFGI).WaveMax+1;
}
}
KFGameInfo_Survival(MyKFGI).WaveNum = NewWaveNum - 1;
//Kill all zeds currently alive.
PC.ConsoleCommand("KillZeds");
//Clear any current objectives.
MyKFGI.MyKFGRI.DeactivateObjective();
if(bSkipTraderTime)
{
//Go to some unused state so that PlayingWave.BeginState is called when we go to PlayingWave.
MyKFGI.GotoState('TravelTheWorld');
UpdateEndlessDifficulty();
//Go to PlayingWave to start the new wave.
MyKFGI.GotoState('PlayingWave');
}
@ -174,7 +174,7 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
{
//Go to trader time before starting the new wave.
MyKFGI.GotoState('TraderOpen');
UpdateEndlessDifficulty();
}
@ -189,20 +189,20 @@ function UpdateEndlessDifficulty()
{
local KFGameInfo_Endless Endless;
local int i;
Endless = KFGameInfo_Endless(MyKFGI);
if(Endless == None)
{
return;
}
//Reflects the difficulty update in KFGameInfo_Endless.SetWave.
Endless.bIsInHoePlus = false;
Endless.ResetDifficulty();
Endless.SpawnManager.GetWaveSettings(Endless.SpawnManager.WaveSettings);
Endless.UpdateGameSettings();
//Don't bother iterating for i=0-4, no difficulty increment can occur.
for(i = 5; i < Endless.WaveNum; ++i)
{
@ -211,7 +211,7 @@ function UpdateEndlessDifficulty()
{
Endless.IncrementDifficulty();
}
//This should happen at the end of each wave (if we're in HoE+). The check is handled internally.
//We do this after the simulation of a boss death so that bIsInHoePlus can be set first.
Endless.HellOnEarthPlusRoundIncrement();
@ -234,38 +234,38 @@ function OverrideBoss()
{
local bool bHalt;
local byte MaxIters, i, MaxSameIters, PrevIndex, SameIters;
//We need a valid KFGRI reference as we use its public BossIndex field.
if(MyKFGI.MyKFGRI == None)
{
SetTimer(0.2, false, nameof(OverrideBoss));
return;
}
//Unfortunately, we cannot directly set the boss index since KFGameInfo.BossIndex is protected. The only
//way we can affect BossIndex is through KFGameInfo.SetBossIndex which randomly chooses a value in the
//valid range. So we have to continue calling SetBossIndex until the desired index has been chosen. We
//can verify this by checking KFGameReplicationInfo.BossIndex because that is public.
i = 0;
MaxIters = 100;
//Since some events/maps could force a specific boss to be spawned (see KFGameInfo.SetBossIndex), we
//should check whether the index hasn't changed after several iterations. If it stays the same for a
//while we assume the index is forced, in which case we can't do anything about it.
SameIters = 0;
MaxSameIters = 10;
PrevIndex = MyKFGI.MyKFGRI.BossIndex;
bHalt = Boss < 0 || MyKFGI.MyKFGRI.BossIndex == Boss;
while(!bHalt)
{
++i;
//Randomly select a new boss.
MyKFGI.SetBossIndex();
//Track whether the boss index is changing.
if(MyKFGI.MyKFGRI.BossIndex == PrevIndex)
{
@ -276,11 +276,11 @@ function OverrideBoss()
SameIters = 0;
PrevIndex = MyKFGI.MyKFGRI.BossIndex;
}
//Halt if we have the desired index or we have tried enough times.
bHalt = MyKFGI.MyKFGRI.BossIndex == Boss || SameIters >= MaxSameIters || i >= MaxIters;
}
if(MyKFGI.MyKFGRI.BossIndex == Boss)
{
`log("Successfully overrode boss index to "$Boss$" after "$i$" attempts.", bUseDebug, 'StartWave');
@ -298,26 +298,26 @@ function OverrideTimer()
local KFGameInfo_Endless KFGI_Endl;
local KFGameDifficulty_Endless KFGD_Endl;
local int i;
//If we've overriden what we need to, don't call this timer again.
if(bOverridenDifficultySettings && bOverridenTraderDuration)
{
`log("All settings have been overriden.", bUseDebug, 'StartWave');
return;
}
if(!bOverridenDifficultySettings && MyKFGI.DifficultyInfo != None)
{
`log("Overriding difficulty settings...", bUseDebug, 'StartWave');
bOverridenDifficultySettings = true;
//Override starting dosh.
MyKFGI.DifficultyInfo.Normal.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.Hard.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.Suicidal.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.HellOnEarth.StartingDosh = Dosh;
KFGI_Endl = KFGameInfo_Endless(MyKFGI);
if (KFGI_Endl != None)
{
@ -330,19 +330,19 @@ function OverrideTimer()
}
}
}
`log("Starting dosh has been set to: "$Dosh$" dosh.", bUseDebug, 'StartWave');
//We need to set the difficulty settings again - normally done in KFGameInfo.InitGame - to apply
//these changes, since this happens after InitGame is executed.
MyKFGI.DifficultyInfo.SetDifficultySettings(MyKFGI.GameDifficulty);
}
//Set the starting wave number.
if(!bOverridenTraderDuration)
{
KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv != None)
{
//We require the SpawnManager to be set, because this signifies that InitSpawnManager has been
@ -350,14 +350,14 @@ function OverrideTimer()
if(MyKFGI.SpawnManager != None)
{
`log("Overriding trader duration...", bUseDebug, 'StartWave');
bOverridenTraderDuration = true;
//Since InitSpawnManager has been executed, then PreBeginPlay must have been executed. This
//means that PostBeginPlay will have been executed as well since it happens straight after.
//Now we can override TimeBetweenWaves.
KFGI_Surv.TimeBetweenWaves = bInitialTrader ? InitialTraderTime : TraderTime;
`log("Trader duration has been set to: "$KFGI_Surv.TimeBetweenWaves$" seconds.", bUseDebug,
'StartWave');
}
@ -365,7 +365,7 @@ function OverrideTimer()
{
`log("MyKFGI.SpawnManager hasn't been set yet. Calling StartWaveTimer again.", bUseDebug,
'StartWave');
//We don't know WaveMax yet, so we need to wait longer.
SetTimer(0.1, false, nameof(StartWaveTimer));
return;
@ -377,7 +377,7 @@ function OverrideTimer()
$"compatible with non-wave-based game modes.", true, 'StartWave');
}
}
//If the difficulty info isn't set yet, wait.
SetTimer(0.1, false, nameof(OverrideTimer));
}
@ -386,7 +386,7 @@ function StartWaveTimer()
{
local KFGameInfo_Survival KFGI_Surv;
local PlayerController PC;
//We need to wait for the wave to be active, as this will signify that StartMatch has been executed.
if(!MyKFGI.IsWaveActive())
{
@ -394,16 +394,16 @@ function StartWaveTimer()
SetTimer(0.1, false, nameof(StartWaveTimer));
return;
}
KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv == None)
{
return;
}
`log("Clearing the current wave.", bUseDebug, 'StartWave');
//Clear the current wave.
foreach WorldInfo.AllControllers(class'PlayerController', PC)
{
@ -413,39 +413,39 @@ function StartWaveTimer()
break;
}
}
//Set the starting wave number.
//Keep the assignments separated so that we can used the restricted StartWave later if we want.
StartWave = Min(StartWave, KFGI_Surv.WaveMax);
//We need to subtract 1 because when the state is eventually reset to PlayingWave, this will be
//incremented by 1.
KFGI_Surv.WaveNum = StartWave - 1;
`log("WaveNum set to: "$KFGI_Surv.WaveNum, bUseDebug, 'StartWave');
if(bStartWithTrader)
{
`log("Switching to state: TraderOpen.", bUseDebug, 'StartWave');
//We need to update GRI's WaveNum and update the HUD element that shows the last wave.
MyKFGI.MyKFGRI.WaveNum = KFGI_Surv.WaveNum;
MyKFGI.MyKFGRI.UpdateHUDWaveCount();
//Start with the trader active.
MyKFGI.GotoState('TraderOpen', 'Begin');
}
else
{
{
`log("Switching to state: PlayingWave.", bUseDebug, 'StartWave');
//Start with a wave as usual - but our StartWave number will be used.
MyKFGI.GotoState('PlayingWave');
}
//Since we've updated the wave number, we need to update the game settings (which includes the
//current wave number).
MyKFGI.UpdateGameSettings();
bInitialTrader = false;
}
@ -466,7 +466,7 @@ function UpdateTraderDurationTimer()
`warn("The game mode does not extend KFGameInfo_Survival. Most features of this mutator are not"
$"compatible with non-wave-based game modes.", true, 'StartWave');
}
//We don't need to call this timer again.
ClearTimer(nameof(UpdateTraderDurationTimer));
}
@ -486,12 +486,12 @@ static function bool GetBoolOption(string Options, string ParseString, bool Curr
//Find the value associated with this variable in the launch command.
InOpt = class'GameInfo'.static.ParseOption(Options, ParseString);
if(InOpt != "")
{
return bool(InOpt);
}
//If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue;
}
@ -510,12 +510,12 @@ static function string GetStringOption(string Options, string ParseString, strin
//Find the value associated with this variable in the launch command.
InOpt = class'GameInfo'.static.ParseOption(Options, ParseString);
if(InOpt != "")
{
return InOpt;
}
//If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue;
}

View File

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