Compare commits

...

34 Commits

Author SHA1 Message Date
0e5701bdc7
Merge pull request #5 from GenZmeY/short-name
add short alias for mutator
2024-03-08 23:07:23 +03:00
dde4c9aa93
add short alias for mutator 2023-12-31 23:36:23 +03:00
98604ab176
update ci/cd 2023-12-31 20:50:05 +03:00
22b8f51e7b update description 2023-06-29 00:37:43 +03:00
fc4538344c update description 2023-06-29 00:26:28 +03:00
96eede074b
Merge pull request #4 from GenZmeY/dev
Refactoring and fixes
2023-06-29 00:14:15 +03:00
23424ad094 optimize KillZeds 2023-06-03 17:12:57 +03:00
8e213d4f78 update descriptions 2023-05-21 01:15:37 +03:00
f1debb3ec9 upd comment 2023-05-21 01:01:26 +03:00
1179c7c5e5 update test settings 2023-05-21 00:47:28 +03:00
5608de55f0 fix updating endless difficulty 2023-05-21 00:46:42 +03:00
6857f68fb4 remove redundant code 2023-05-20 23:13:21 +03:00
c471a854e0 fix parsing options 2023-05-20 23:10:40 +03:00
81beb8052d ref 2023-05-20 22:20:03 +03:00
c367e00f63 optimize boss override 2023-05-20 22:11:37 +03:00
363e003dff add LogLevel parsing 2023-05-20 21:27:00 +03:00
5f4b2abfe5 remake mod structure into my template 2023-05-20 21:10:14 +03:00
7b5669febf make .editorconfig checker happy 2023-05-20 19:51:12 +03:00
98102cf58a replace logger 2023-05-20 19:48:47 +03:00
0b5197f923 make it server-side 2023-05-20 19:05:32 +03:00
aef92c7d47
Merge pull request #3 from GenZmeY/MegaLinter
add Mega Linter
2023-05-14 11:38:56 +03:00
e654d3f6bd fix style 2023-05-14 11:31:02 +03:00
b4d6d1eab6 update README.md 2023-05-14 11:19:34 +03:00
b17a3a3f12 add MegaLinter 2023-05-14 11:16:13 +03:00
6e5a893018 add .editorconfig 2023-05-14 11:15:55 +03:00
94ed0a01b1 update build tools 2023-05-14 11:14:52 +03:00
6543cdeb1e update README.md 2022-09-02 16:12:03 +03:00
69fab05c8c Merge branch 'master' of https://github.com/GenZmeY/KF2-StartWave 2022-09-02 16:10:51 +03:00
3025427652 update build tools 2022-09-02 16:10:42 +03:00
026cfeeea7
Update README.md 2022-08-18 21:53:20 +03:00
3ba6962f28 update README.md 2022-07-11 10:05:00 +03:00
7ea797cda4 update description 2022-07-11 10:03:17 +03:00
989ac33966 update build tools 2022-07-11 10:03:00 +03:00
eb17931dd1 update deps 2022-01-24 07:20:33 +03:00
18 changed files with 894 additions and 464 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

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

@ -0,0 +1,114 @@
---
name: MegaLinter
permissions: read-all
on:
push:
pull_request:
branches:
- master
env:
APPLY_FIXES: none
APPLY_FIXES_EVENT: pull_request
APPLY_FIXES_MODE: commit
FILTER_REGEX_EXCLUDE: (mega-linter.yml)
DISABLE: SPELL
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
megalinter:
name: MegaLinter
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
with:
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: MegaLinter
uses: oxsecurity/megalinter@7e042c726c68415475b05a65a686c612120a1232
id: ml
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive production artifacts
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392
if: success() || failure()
with:
name: MegaLinter reports
path: |
megalinter-reports
mega-linter.log
- name: Set APPLY_FIXES_IF var
run: |
printf 'APPLY_FIXES_IF=%s\n' "${{
steps.ml.outputs.has_updated_sources == 1 &&
(
env.APPLY_FIXES_EVENT == 'all' ||
env.APPLY_FIXES_EVENT == github.event_name
) &&
(
github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.repository
)
}}" >> "${GITHUB_ENV}"
- name: Set APPLY_FIXES_IF_* vars
run: |
printf 'APPLY_FIXES_IF_PR=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'pull_request'
}}" >> "${GITHUB_ENV}"
printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{
env.APPLY_FIXES_IF == 'true' &&
env.APPLY_FIXES_MODE == 'commit' &&
(!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref))
}}" >> "${GITHUB_ENV}"
- name: Create Pull Request with applied fixes
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
id: cpr
if: env.APPLY_FIXES_IF_PR == 'true'
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: env.APPLY_FIXES_IF_PR == 'true'
run: |
echo "PR Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "PR URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Prepare commit
if: env.APPLY_FIXES_IF_COMMIT == 'true'
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d
if: env.APPLY_FIXES_IF_COMMIT == 'true'
with:
branch: >-
${{
github.event.pull_request.head.ref ||
github.head_ref ||
github.ref
}}
commit_message: "[MegaLinter] Apply linters fixes"
commit_user_name: "github-actions"
commit_user_email: "github-actions[bot]@users.noreply.github.com"

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.psd
/ignore

View File

@ -1,101 +1,106 @@
[h1]Warning[/h1]
This mod is not whitelisted and will unrank your server. Any XP gained will not be saved.
[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]Usage (single player):[/h1]
1. Subscribe to this mutator;
2. Start KF2;
3. Open console (`) and input:
[code]open KF-BioticsLab?Game=KFGameContent.KFGameInfo_Endless?Difficulty=0?GameLength=0?Mutator=StartWave.StartWave?[/code]
Change the name of the map and the parameters of the game to the ones you need.
Add StartWave parameters that you need to the end of the line (you can add any parameter from the config, the description is below).
4. <Enter>.
[h1]Usage (server):[/h1]
[b]Note:[/b] 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.
1. Open your PCServer-KFEngine.ini / LinuxServer-KFEngine.ini;
2. Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section:
[code]ServerSubscribedWorkshopItems=2521731447[/code]
3. Start the server and wait while the mutator is downloading;
4. Stop the server;
5. Add mutator to server start line: [b]?Mutator=StartWave.StartWave[/b]
6. Add StartWave parameters or use config (the description is below).
7. Start the server
[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]
[u]https://github.com/GenZmeY/KF2-StartWave[/u] [b](GNU GPLv3)[/b]
[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:
[olist]
[*] fixed starting Dosh for Endless mode;
[*] fixed difficulty setting when changing wave;
[*] optimized boss replacement: now it always works successfully and quickly;
[*] players no longer need to download StartWave when connecting to a server.
[/olist]
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.Mut[/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 (with parameters you need) to server start parameters: [b]?Mutator=StartWave.Mut[/b] and restart the server.
[/olist]
[h1]Mutator setup[/h1]
The parameters below can be used as parameters in the startup line.
But You can use a config if you don't want to specify parameters in the startup line:
Create a file [b]KFGame/Config/KFStartWave.ini[/b] 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.
// LogLevel (Set this to 'LL_Debug' if you need more information in the log)
LogLevel=LL_Info
// 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]Sources[/h1]
[url=https://github.com/GenZmeY/KF2-StartWave]https://github.com/GenZmeY/KF2-StartWave[/url] [b](GNU GPLv3)[/b]

View File

@ -1,55 +1,51 @@
# KF2-StartWave
[![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 Subscriptions](https://img.shields.io/steam/subscriptions/2521731447)](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.
**This is the same as [Pharrahnox's SetWave](https://steamcommunity.com/sharedfiles/filedetails/?id=1417081496), but with some fixes:**
- fixed starting Dosh for Endless mode.
**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;
- fixed difficulty setting when changing wave;
- optimized boss replacement: now it always works successfully and quickly;
- players no longer need to download StartWave when connecting to a server.
# 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
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 `test.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

@ -0,0 +1,22 @@
class KFGI_Access extends Object
within KFGameInfo;
public function OverrideBossIndex(int Index, optional bool Force = false)
{
if (Index < 0 || Index >= default.AIBossClassList.Length)
{
return;
}
if (!UseSpecificBossIndex(BossIndex) || Force)
{
BossIndex = Index;
}
MyKFGRI.CacheSelectedBoss(BossIndex);
}
defaultproperties
{
}

53
StartWave/Classes/Mut.uc Normal file
View File

@ -0,0 +1,53 @@
class Mut extends KFMutator;
var private StartWave StartWave;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'StartWave', StartWave)
{
break;
}
if (StartWave == None)
{
StartWave = WorldInfo.Spawn(class'StartWave');
}
if (StartWave == None)
{
`Log_Base("FATAL: Can't Spawn 'StartWave'");
SafeDestroy();
}
}
public function AddMutator(Mutator M)
{
if (M == Self) return;
if (M.Class == Class)
Mut(M).SafeDestroy();
else
Super.AddMutator(M);
}
public function Mutate(String MutateString, PlayerController Sender)
{
StartWave.Mutate(MutateString, Sender);
Super.Mutate(MutateString, Sender);
}
defaultproperties
{
}

View File

@ -0,0 +1,87 @@
class OptionsParser extends Object;
const GameInfo = class'GameInfo';
/**
*** @brief Gets a int from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return int value of the option we are looking for
***/
static function int GetIntOption( String Options, String ParseString, int CurrentValue)
{
return GameInfo.static.GetIntOption(Options, ParseString, CurrentValue);
}
/**
*** @brief Gets a bool from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return bool value of the option we are looking for
***/
static public function bool GetBoolOption(String Options, String ParseString, bool CurrentValue)
{
local String InOpt;
//Find the value associated with this variable in the launch command.
InOpt = 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;
}
/**
*** @brief Gets a String from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return String value of the option we are looking for
***/
static public function String GetStringOption(String Options, String ParseString, String CurrentValue)
{
local String InOpt;
//Find the value associated with this variable in the launch command.
InOpt = 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;
}
/**
*** @brief Gets a LogLevel from the launch command if available.
***
*** @param Options - options passed in via the launch command
*** @param ParseString - the variable we are looking for
*** @param CurrentValue - the current value of the variable
*** @return E_LogLevel value of the option we are looking for
***/
static public function E_LogLevel GetLogLevelOption(String Options, String ParseString, E_LogLevel CurrentValue)
{
local String InOpt;
//Find the value associated with this variable in the launch command.
InOpt = GameInfo.static.ParseOption(Options, ParseString);
if (InOpt != "")
{
return class'_Logger'.static.LogLevelFromString(InOpt, CurrentValue);
}
return CurrentValue;
}

View File

@ -1,6 +1,16 @@
class StartWave extends KFMutator
class StartWave extends Info
config(StartWave);
const OptionsParser = class'OptionsParser';
var private KFGameInfo KFGI;
var private KFGameInfo_Survival KFGIS;
var private KFGameInfo_Endless KFGIE;
var private KFGI_Access KFGIA;
var private KFGameReplicationInfo KFGRI;
/*********************************************************************************************************
* Config properties
*********************************************************************************************************/
@ -15,12 +25,13 @@ var config int TraderTime;
var config int Dosh;
/** Whether an 'initial' trader time should occur before the first wave. */
var config bool bStartWithTrader;
/** Whether mod-specific events should be logged. */
var config bool bUseDebug;
/** Log level. */
var config E_LogLevel LogLevel;
/**
* 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.
*/
*** 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.
***/
var config int Boss;
/*********************************************************************************************************
@ -36,84 +47,173 @@ var bool bOverridenDifficultySettings;
/** Whether the trader duration has been overriden. */
var bool bOverridenTraderDuration;
function InitMutator(string Options, out string ErrorMessage)
public simulated function bool SafeDestroy()
{
//This needs to be called first since KFMutator.InitMutator sets the MyKFGI reference.
Super.InitMutator(Options, ErrorMessage);
`Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
`Log_Trace();
if (WorldInfo.NetMode == NM_Client)
{
`Log_Fatal("Wrong NetMode:" @ WorldInfo.NetMode);
SafeDestroy();
return;
}
Super.PreBeginPlay();
PreInit();
}
public event PostBeginPlay()
{
`Log_Trace();
if (bPendingDelete || bDeleteMe) return;
Super.PostBeginPlay();
PostInit();
}
private function PreInit()
{
local String URL;
local String Options;
`Log_Trace();
URL = WorldInfo.GetLocalURL();
Options = Mid(URL, InStr(URL, "?"));
//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);
InitialTraderTime = Max(class'GameInfo'.static.GetIntOption(Options, "InitialTraderTime",
InitialTraderTime), 1);
TraderTime = Max(class'GameInfo'.static.GetIntOption(Options, "TraderTime", TraderTime), 1);
Dosh = Max(class'GameInfo'.static.GetIntOption(Options, "Dosh", Dosh), 0);
Boss = class'GameInfo'.static.GetIntOption(Options, "Boss", Boss);
bStartWithTrader = GetBoolOption(Options, "bStartWithTrader", bStartWithTrader);
bUseDebug = GetBoolOption(Options, "bUseDebug", bUseDebug);
StartWave = OptionsParser.static.GetIntOption (Options, "StartWave", StartWave);
InitialTraderTime = OptionsParser.static.GetIntOption (Options, "InitialTraderTime", InitialTraderTime);
TraderTime = OptionsParser.static.GetIntOption (Options, "TraderTime", TraderTime);
Dosh = OptionsParser.static.GetIntOption (Options, "Dosh", Dosh);
Boss = OptionsParser.static.GetIntOption (Options, "Boss", Boss);
bStartWithTrader = OptionsParser.static.GetBoolOption (Options, "bStartWithTrader", bStartWithTrader);
LogLevel = OptionsParser.static.GetLogLevelOption(Options, "LogLevel", LogLevel);
// Adjust values if needed
StartWave = Max(StartWave, 1);
InitialTraderTime = Max(InitialTraderTime, 1);
TraderTime = Max(TraderTime, 1);
Dosh = Max(Dosh, 0);
//DEBUG
`log("StartWave: "$StartWave, bUseDebug, 'StartWave');
`log("InitialTraderTime: "$InitialTraderTime, bUseDebug, 'StartWave');
`log("TraderTime: "$TraderTime, bUseDebug, 'StartWave');
`log("Dosh: "$Dosh, bUseDebug, 'StartWave');
`log("Boss: "$Boss, bUseDebug, 'StartWave');
`log("bStartWithTrader: "$bStartWithTrader, bUseDebug, 'StartWave');
`Log_Info("LogLevel:" @ LogLevel);
`Log_Info("StartWave:" @ StartWave);
`Log_Info("InitialTraderTime:" @ InitialTraderTime);
`Log_Info("TraderTime:" @ TraderTime);
`Log_Info("Dosh:" @ Dosh);
`Log_Info("Boss:" @ Boss);
`Log_Info("bStartWithTrader:" @ bStartWithTrader);
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)
bOverridenTraderDuration = false;
}
private function PostInit()
{
`Log_Trace();
if (WorldInfo.Game == None || WorldInfo.GRI == None)
{
SetTimer(0.1, false, nameof(OverrideBoss));
SetTimer(0.2, false, nameof(PostInit));
return;
}
KFGI = KFGameInfo(WorldInfo.Game);
if (KFGI == None)
{
`Log_Fatal("Incompatible gamemode:" @ WorldInfo.Game $ ". Destroy...");
SafeDestroy();
return;
}
KFGIA = new(KFGI) class'KFGI_Access';
if (KFGIA == None)
{
`Log_Fatal("Can't create KFGI_Access object");
SafeDestroy();
return;
}
KFGIS = KFGameInfo_Survival(KFGI);
if (KFGIS == None)
{
`Log_Warn("The game mode does not extend KFGameInfo_Survival. Most features of this mutator are not compatible with non-wave-based game modes.");
}
KFGIE = KFGameInfo_Endless(KFGIS);
KFGRI = KFGameReplicationInfo(WorldInfo.GRI);
if (KFGRI == None)
{
`Log_Fatal("Incompatible game replication info:" @ WorldInfo.GRI $ ". Destroy...");
SafeDestroy();
return;
}
SetTimer(0.1, false, nameof(OverrideTimer));
//Override the boss with the boss corresponding to the specified boss index. -1 signifies random.
KFGIA.OverrideBossIndex(Boss);
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)
if (bStartWithTrader || StartWave > 1)
{
`log("Calling StartWaveTimer() to alter the start wave or activate the trader initially.",
bUseDebug, 'StartWave');
`Log_Debug("Calling StartWaveTimer() to alter the start wave or activate the trader initially.");
SetTimer(0.2, false, nameof(StartWaveTimer));
}
//If we will need to alter TimeBetweenWaves for later activations of the trader.
if(bStartWithTrader && InitialTraderTime != TraderTime)
if (bStartWithTrader && InitialTraderTime != TraderTime)
{
`log("Calling UpdateTraderDurationTimer() to alter the trader duration later.", bUseDebug,
'StartWave');
`Log_Debug("Calling UpdateTraderDurationTimer() to alter the trader duration later.");
SetTimer(1, true, nameof(UpdateTraderDurationTimer));
}
`Log_Info("Initialized.");
}
/** Allows for handling player input in the console by the mutator. */
function Mutate(string MutateString, PlayerController Sender)
public function Mutate(string MutateString, PlayerController Sender)
{
local array<string> CommandBreakdown;
if(MutateString == "")
`Log_Trace();
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)
if (CommandBreakdown.Length > 1&&
CommandBreakdown[0] == "setwave" &&
Sender.CheatManager != None &&
KFGI.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)
if (CommandBreakdown.Length == 2)
{
SetWave(int(CommandBreakdown[1]), Sender);
}
@ -122,23 +222,23 @@ function Mutate(string MutateString, PlayerController Sender)
SetWave(int(CommandBreakdown[1]), Sender, bool(CommandBreakdown[2]));
}
}
Super.Mutate(MutateString, Sender);
}
/** Jumps to the specified wave, NewWaveNum, with trader time iff bSkipTraderTime is false. */
function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderTime)
private function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderTime)
{
if(NewWaveNum < 1)
`Log_Trace();
if (NewWaveNum < 1)
{
`log("SetWave: new wave num must be > 0.", true, 'StartWave');
`Log_Error("SetWave: new wave num must be > 0.");
return;
}
if(KFGameInfo_Endless(MyKFGI) != None)
if (KFGIE != None)
{
//Jump straight to the final wave if the specified wave number is higher than wave max.
if(NewWaveNum > 254)
if (NewWaveNum > 254)
{
NewWaveNum = 254;
}
@ -146,376 +246,284 @@ function SetWave(int NewWaveNum, PlayerController PC, optional bool bSkipTraderT
else
{
//Jump straight to the boss wave if the specified wave number is higher than wave max.
if(NewWaveNum > KFGameInfo_Survival(MyKFGI).WaveMax)
if (NewWaveNum > KFGIS.WaveMax)
{
NewWaveNum = KFGameInfo_Survival(MyKFGI).WaveMax+1;
NewWaveNum = KFGIS.WaveMax+1;
}
}
KFGameInfo_Survival(MyKFGI).WaveNum = NewWaveNum - 1;
if (KFGIS != None)
{
KFGIS.WaveNum = NewWaveNum - 1;
}
//Kill all zeds currently alive.
PC.ConsoleCommand("KillZeds");
KillZeds();
//Clear any current objectives.
MyKFGI.MyKFGRI.DeactivateObjective();
if(bSkipTraderTime)
KFGRI.DeactivateObjective();
if (bSkipTraderTime)
{
//Go to some unused state so that PlayingWave.BeginState is called when we go to PlayingWave.
MyKFGI.GotoState('TravelTheWorld');
KFGI.GotoState('TravelTheWorld');
UpdateEndlessDifficulty();
//Go to PlayingWave to start the new wave.
MyKFGI.GotoState('PlayingWave');
KFGI.GotoState('PlayingWave');
}
else
{
//Go to trader time before starting the new wave.
MyKFGI.GotoState('TraderOpen');
KFGI.GotoState('TraderOpen');
UpdateEndlessDifficulty();
}
MyKFGI.ResetAllPickups();
KFGI.ResetAllPickups();
}
/**
* Since the difficulty in Endless scales with the wave number, we need to update the difficulty when
* jumping between wave numbers to match the expected difficulty.
*/
function UpdateEndlessDifficulty()
*** Since the difficulty in Endless scales with the wave number, we need to update the difficulty when
*** jumping between wave numbers to match the expected difficulty.
***/
private function UpdateEndlessDifficulty()
{
local KFGameInfo_Endless Endless;
local int i;
Endless = KFGameInfo_Endless(MyKFGI);
if(Endless == None)
`Log_Trace();
if (KFGIE == None)
{
return;
}
// KFGIE.ResetDifficulty() does not reset ModifiedDifficulty, so do it manually
KFGRI.SetModifiedGameDifficulty(0);
KFGI.GameDifficultyModifier = 0;
//Reflects the difficulty update in KFGameInfo_Endless.SetWave.
Endless.bIsInHoePlus = false;
Endless.ResetDifficulty();
Endless.SpawnManager.GetWaveSettings(Endless.SpawnManager.WaveSettings);
Endless.UpdateGameSettings();
KFGIE.bIsInHoePlus = false;
KFGIE.ResetDifficulty();
KFGIE.SpawnManager.GetWaveSettings(KFGIE.SpawnManager.WaveSettings);
KFGIE.UpdateGameSettings();
//Don't bother iterating for i=0-4, no difficulty increment can occur.
for(i = 5; i < Endless.WaveNum; ++i)
for (i = 5; i <= KFGIE.WaveNum; ++i)
{
//Simulate the death of a boss. The difficulty is incremented after each boss round.
if(i % 5 == 0)
if (i % 5 == 0)
{
Endless.IncrementDifficulty();
KFGIE.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();
KFGIE.HellOnEarthPlusRoundIncrement();
}
`Log_Debug("Updated difficulty (Game + Modifier):" @ String(KFGRI.GameDifficulty) @ "+" @ String(KFGRI.GameDifficultyModifier));
}
/** Checks whether we should force the initial trader, regardless of the config/command value. */
function CheckForceInitialTrader()
private function CheckForceInitialTrader()
{
`Log_Trace();
//Force the initial trader for compatibility with holdout maps. Otherwise, zeds spawn in the wrong room.
if(!bStartWithTrader && StartWave > 1)
if (!bStartWithTrader && StartWave > 1)
{
bStartWithTrader = true;
InitialTraderTime = 1.0;
}
}
/** Overrides the boss to spawn if a valid boss index has been specified. */
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)
{
++SameIters;
}
else
{
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');
}
else
{
`log("Failed to override boss index after "$i$" attempts.", bUseDebug, 'StartWave');
}
}
/** Overrides difficulty settings and trader duration when possible. */
function OverrideTimer()
private function OverrideTimer()
{
local KFGameInfo_Survival KFGI_Surv;
local KFGameInfo_Endless KFGI_Endl;
local KFGameDifficulty_Endless KFGD_Endl;
local KFGameDifficulty_Endless KFGDE;
local int i;
`Log_Trace();
//If we've overriden what we need to, don't call this timer again.
if(bOverridenDifficultySettings && bOverridenTraderDuration)
if (bOverridenDifficultySettings && bOverridenTraderDuration)
{
`log("All settings have been overriden.", bUseDebug, 'StartWave');
`Log_Debug("All settings have been overriden.");
return;
}
if(!bOverridenDifficultySettings && MyKFGI.DifficultyInfo != None)
if (!bOverridenDifficultySettings && KFGI.DifficultyInfo != None)
{
`log("Overriding difficulty settings...", bUseDebug, 'StartWave');
`Log_Debug("Overriding difficulty settings...");
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)
KFGI.DifficultyInfo.Normal.StartingDosh = Dosh;
KFGI.DifficultyInfo.Hard.StartingDosh = Dosh;
KFGI.DifficultyInfo.Suicidal.StartingDosh = Dosh;
KFGI.DifficultyInfo.HellOnEarth.StartingDosh = Dosh;
if (KFGIE != None)
{
KFGD_Endl = KFGameDifficulty_Endless(KFGI_Endl.DifficultyInfo);
if (KFGD_Endl != None)
KFGDE = KFGameDifficulty_Endless(KFGIE.DifficultyInfo);
if (KFGDE != None)
{
for (i = 0; i < KFGD_Endl.CurrentDifficultyScaling.Difficulties.length; ++i)
for (i = 0; i < KFGDE.CurrentDifficultyScaling.Difficulties.length; ++i)
{
KFGD_Endl.CurrentDifficultyScaling.Difficulties[i].StartingDosh = Dosh;
KFGDE.CurrentDifficultyScaling.Difficulties[i].StartingDosh = Dosh;
}
}
}
`log("Starting dosh has been set to: "$Dosh$" dosh.", bUseDebug, 'StartWave');
`Log_Debug("Starting dosh has been set to:" @ Dosh @ "dosh.");
//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);
KFGI.DifficultyInfo.SetDifficultySettings(KFGI.GameDifficulty);
}
//Set the starting wave number.
if(!bOverridenTraderDuration)
if (!bOverridenTraderDuration)
{
KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv != None)
if (KFGIS != None)
{
//We require the SpawnManager to be set, because this signifies that InitSpawnManager has been
//executed, which sets WaveMax.
if(MyKFGI.SpawnManager != None)
if (KFGI.SpawnManager != None)
{
`log("Overriding trader duration...", bUseDebug, 'StartWave');
`Log_Debug("Overriding trader duration...");
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');
KFGIS.TimeBetweenWaves = bInitialTrader ? InitialTraderTime : TraderTime;
`Log_Debug("Trader duration has been set to:" @ KFGIS.TimeBetweenWaves @ "seconds.");
}
else
{
`log("MyKFGI.SpawnManager hasn't been set yet. Calling StartWaveTimer again.", bUseDebug,
'StartWave');
`Log_Debug("KFGI.SpawnManager hasn't been set yet. Calling StartWaveTimer again.");
//We don't know WaveMax yet, so we need to wait longer.
SetTimer(0.1, false, nameof(StartWaveTimer));
return;
}
}
else
{
`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');
}
}
//If the difficulty info isn't set yet, wait.
SetTimer(0.1, false, nameof(OverrideTimer));
}
function StartWaveTimer()
private function StartWaveTimer()
{
local KFGameInfo_Survival KFGI_Surv;
local PlayerController PC;
`Log_Trace();
//We need to wait for the wave to be active, as this will signify that StartMatch has been executed.
if(!MyKFGI.IsWaveActive())
if (!KFGI.IsWaveActive())
{
//If the wave isn't active yet (probably still in lobby), wait.
SetTimer(0.1, false, nameof(StartWaveTimer));
return;
}
KFGI_Surv = KFGameInfo_Survival(MyKFGI);
if(KFGI_Surv == None)
if (KFGIS == None)
{
return;
}
`log("Clearing the current wave.", bUseDebug, 'StartWave');
`Log_Debug("Clearing the current wave.");
//Clear the current wave.
foreach WorldInfo.AllControllers(class'PlayerController', PC)
{
if (KFDemoRecSpectator(PC) == none)
{
PC.ConsoleCommand("KillZeds");
KillZeds();
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);
StartWave = Min(StartWave, KFGIS.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)
KFGIS.WaveNum = StartWave - 1;
UpdateEndlessDifficulty();
`Log_Info("WaveNum set to:" @ KFGIS.WaveNum);
if (bStartWithTrader)
{
`log("Switching to state: TraderOpen.", bUseDebug, 'StartWave');
`Log_Debug("Switching to state: TraderOpen.");
//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();
KFGRI.WaveNum = KFGIS.WaveNum;
KFGRI.UpdateHUDWaveCount();
//Start with the trader active.
MyKFGI.GotoState('TraderOpen', 'Begin');
KFGI.GotoState('TraderOpen', 'Begin');
}
else
{
`log("Switching to state: PlayingWave.", bUseDebug, 'StartWave');
{
`Log_Debug("Switching to state: PlayingWave.");
//Start with a wave as usual - but our StartWave number will be used.
MyKFGI.GotoState('PlayingWave');
KFGI.GotoState('PlayingWave');
}
//Since we've updated the wave number, we need to update the game settings (which includes the
//current wave number).
MyKFGI.UpdateGameSettings();
KFGI.UpdateGameSettings();
bInitialTrader = false;
}
/** Updates the trader duration. Waits until the initial trader has closed. */
function UpdateTraderDurationTimer()
private function UpdateTraderDurationTimer()
{
`Log_Trace();
//If the initial trader has already been opened, and the wave is now active.
if(!bInitialTrader && MyKFGI.IsWaveActive())
if (!bInitialTrader && KFGI.IsWaveActive())
{
if(KFGameInfo_Survival(MyKFGI) != None)
if (KFGIS != None)
{
`log("Updating trader duration to "$TraderTime$" seconds.", bUseDebug, 'StartWave');
`Log_Debug("Updating trader duration to" @ TraderTime @ "seconds.");
//We can update TimeBetweenWaves to be the TraderTime we specified in the launch command.
KFGameInfo_Survival(MyKFGI).TimeBetweenWaves = TraderTime;
KFGIS.TimeBetweenWaves = TraderTime;
}
else
{
`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));
}
}
/**
* @brief Gets a bool from the launch command if available.
*
* @param Options - options passed in via the launch command
* @param ParseString - the variable we are looking for
* @param CurrentValue - the current value of the variable
* @return bool value of the option we are looking for
*/
static function bool GetBoolOption(string Options, string ParseString, bool CurrentValue)
private function KillZeds()
{
local string InOpt;
local KFPawn_Monster KFPM;
//Find the value associated with this variable in the launch command.
InOpt = class'GameInfo'.static.ParseOption(Options, ParseString);
if(InOpt != "")
foreach WorldInfo.AllPawns(class'KFPawn_Monster', KFPM)
{
return bool(InOpt);
if (!KFPM.IsAliveAndWell()) continue;
if (KFPM.Health > 0 && PlayerController(KFPM.Controller) == None)
{
KFPM.Died(None, None, KFPM.Location);
}
}
//If a value for this variable was not specified in the launch command, return the original value.
return CurrentValue;
}
/**
* @brief Gets a string from the launch command if available.
*
* @param Options - options passed in via the launch command
* @param ParseString - the variable we are looking for
* @param CurrentValue - the current value of the variable
* @return string value of the option we are looking for
*/
static function string GetStringOption(string Options, string ParseString, string CurrentValue)
defaultproperties
{
local string InOpt;
//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

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

View File

@ -0,0 +1 @@
class StartWaveMut extends Mut; // backward compatibility

View File

@ -0,0 +1,74 @@
class _Logger extends Object
abstract;
enum E_LogLevel
{
LL_WrongLevel,
LL_None,
LL_Fatal,
LL_Error,
LL_Warning,
LL_Info,
LL_Debug,
LL_Trace,
LL_All
};
public static function E_LogLevel LogLevelFromString(String LogLevel, optional E_LogLevel DefaultLogLevel)
{
switch (LogLevel)
{
case "0":
case "WrongLevel":
case "LL_WrongLevel":
return LL_WrongLevel;
case "1":
case "None":
case "LL_None":
return LL_None;
case "2":
case "Fatal":
case "LL_Fatal":
return LL_Fatal;
case "3":
case "Error":
case "LL_Error":
return LL_Error;
case "4":
case "Warning":
case "LL_Warning":
return LL_Warning;
case "5":
case "Info":
case "LL_Info":
return LL_Info;
case "6":
case "Debug":
case "LL_Debug":
return LL_Debug;
case "7":
case "Trace":
case "LL_Trace":
return LL_Trace;
case "8":
case "All":
case "LL_All":
return LL_All;
default:
return DefaultLogLevel;
}
}
defaultproperties
{
}

2
StartWave/Globals.uci Normal file
View File

@ -0,0 +1,2 @@
// Imports
`include(Logger.uci)

15
StartWave/Logger.uci Normal file
View File

@ -0,0 +1,15 @@
// Logger
`define Log_Tag 'StartWave'
`define LocationStatic "`{ClassName}::" $ GetFuncName()
`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_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `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_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_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)

View File

@ -1,16 +0,0 @@
# Build parameters
# If True - compresses the mutator when compiling
# Scripts will be stored in binary form
# (reduces the size of the output file)
StripSource="True"
# Mutators to be compiled
# Specify them with a space as a separator,
# Mutators will be compiled in the specified order
PackageBuildOrder="StartWave"
# Mutators that will be uploaded to the workshop
# Specify them with a space as a separator,
# The order doesn't matter
PackageUpload="StartWave"

61
builder.cfg Normal file
View File

@ -0,0 +1,61 @@
### Build parameters ###
# If True - compresses the mutator when compiling
# Scripts will be stored in binary form
# (reduces the size of the output file)
StripSource="True"
# Mutators to be compiled
# Specify them with a space as a separator,
# Mutators will be compiled in the specified order
PackageBuildOrder="StartWave"
### Brew parameters ###
# 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
PackagePeelzBrew=""
### Steam Workshop upload parameters ###
# Mutators that will be uploaded to the workshop
# Specify them with a space as a separator,
# The order doesn't matter
PackageUpload="StartWave"
### Test parameters ###
# Map:
Map="KF-Nuked"
# Game:
# Survival: KFGameContent.KFGameInfo_Survival
# WeeklyOutbreak: KFGameContent.KFGameInfo_WeeklySurvival
# Endless: KFGameContent.KFGameInfo_Endless
# Objective: KFGameContent.KFGameInfo_Objective
# Versus: KFGameContent.KFGameInfo_VersusSurvival
Game="KFGameContent.KFGameInfo_Endless"
# Difficulty:
# Normal: 0
# Hard: 1
# Suicide: 2
# Hell: 3
Difficulty="0"
# GameLength:
# 4 waves: 0
# 7 waves: 1
# 10 waves: 2
GameLength="0"
# Mutators
Mutators="StartWave.StartWaveMut"
# Additional parameters
Args="Dosh=10000?StartWave=16?LogLevel=LL_Debug?TraderTime=60?InitialTraderTime=60?bStartWithTrader=true?Boss=3"

View File

@ -1,31 +0,0 @@
# Test parameters
# Map:
Map="KF-Outpost"
# Game:
# Survival: KFGameContent.KFGameInfo_Survival
# WeeklyOutbreak: KFGameContent.KFGameInfo_WeeklySurvival
# Endless: KFGameContent.KFGameInfo_Endless
# Objective: KFGameContent.KFGameInfo_Objective
# Versus: KFGameContent.KFGameInfo_VersusSurvival
Game="KFGameContent.KFGameInfo_Endless"
# Difficulty:
# Normal: 0
# Hard: 1
# Suicide: 2
# Hell: 3
Difficulty="0"
# GameLength:
# 4 waves: 0
# 7 waves: 1
# 10 waves: 2
GameLength="2"
# Mutators
Mutators="StartWave.StartWave"
# Additional parameters
Args="Dosh=999?StartWave=7?bUseDebug=True"

2
tools

@ -1 +1 @@
Subproject commit 3d96a1e6c6e31163266d628c11202479ea429f94
Subproject commit fb458ac61f7e6c6426b8dff366dd5e7499e0d95f