8 Commits

Author SHA1 Message Date
42f9cc4931 Merge pull request #1 from GenZmeY/BuildSystem
Build system
2022-01-24 07:11:39 +03:00
3d43768f04 Update README.md 2022-01-24 07:11:00 +03:00
5655aae2e5 update build system 2022-01-24 07:08:16 +03:00
f10871b501 update description 2022-01-24 07:02:51 +03:00
3ffc5b0e55 update readme 2021-06-20 08:42:02 +03:00
1a78385437 upd desc 2021-06-20 06:16:38 +03:00
5d3a7cece3 update readme 2021-06-20 06:11:09 +03:00
e4956a6125 fix dosh bug in endless mode 2021-06-20 05:58:00 +03:00
11 changed files with 222 additions and 224 deletions

2
.gitignore vendored
View File

@ -1,2 +0,0 @@
testing.ini
3rd-party-bin

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "tools"]
path = tools
url = https://github.com/GenZmeY/KF2-BuildTools

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -1,2 +1,101 @@
[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 Dosh parameter for Endless mode.
- 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]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 458 KiB

After

Width:  |  Height:  |  Size: 440 KiB

View File

@ -1 +1,55 @@
# KF2-StartWave
# 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 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)
[![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
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.
# 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.
# 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);
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`
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\`
# 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
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.
If it's a crash issue, be sure to include the `Launch.log` and `Launch_2.log` files. You can find them 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)

View File

@ -295,6 +295,9 @@ function OverrideBoss()
function OverrideTimer()
{
local KFGameInfo_Survival KFGI_Surv;
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)
@ -315,6 +318,19 @@ function OverrideTimer()
MyKFGI.DifficultyInfo.Suicidal.StartingDosh = Dosh;
MyKFGI.DifficultyInfo.HellOnEarth.StartingDosh = Dosh;
KFGI_Endl = KFGameInfo_Endless(MyKFGI);
if (KFGI_Endl != None)
{
KFGD_Endl = KFGameDifficulty_Endless(KFGI_Endl.DifficultyInfo);
if (KFGD_Endl != None)
{
for (i = 0; i < KFGD_Endl.CurrentDifficultyScaling.Difficulties.length; ++i)
{
KFGD_Endl.CurrentDifficultyScaling.Difficulties[i].StartingDosh = Dosh;
}
}
}
`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

16
build.cfg Normal file
View File

@ -0,0 +1,16 @@
# 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"

220
make.sh
View File

@ -1,220 +0,0 @@
#!/bin/bash
# Requirements: git-bash
# https://git-scm.com/download/win
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
function winpath2unix () # $1: win path
{
echo "$*" | \
sed -r 's|^(.):|\\\1|' | \
sed 's|\\|/|g'
}
function unixpath2win () # $1: unix path
{
echo "$*" | \
sed -r 's|^/(.)|\1:|' | \
sed 's|/|\\|g'
}
function reg_readkey () # $1: path, $2: key
{
winpath2unix $(
reg query "$1" //v "$2" | \
grep -F "$2" | \
awk '{ $1=$2=""; print $0 }' )
}
function show_help ()
{
echo "$ScriptName"
echo "Usage:"
echo "${ScriptName} OPTION"
echo "Options:"
echo " -c, --compile"
echo " -b, --brew"
echo " -bu, --brew-unpublished"
echo " -u, --upload"
echo " -t, --test"
echo " -h, --help"
}
function cleanup()
{
trap - SIGINT SIGTERM ERR EXIT
restore_kfeditorconf
}
function get_latest_multini ()
{
local ApiUrl="https://api.github.com/repos/GenZmeY/multini/releases/latest"
local LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
local DownloadUrl="https://github.com/GenZmeY/multini/releases/download/$LatestTag/multini-windows-amd64.exe"
mkdir -p "$ThirdPartyBin"
curl -LJs "$DownloadUrl" -o "$ThirdPartyBin/multini.exe"
}
function backup_kfeditorconf ()
{
cp "$KFEditorConf" "$KFEditorConfBackup"
}
function restore_kfeditorconf ()
{
if [[ -f "$KFEditorConfBackup" ]]; then
mv -f "$KFEditorConfBackup" "$KFEditorConf"
fi
}
function setup_modpackages ()
{
multini --set "$KFEditorConf" 'ModPackages' 'ModPackages' 'StartWave'
multini --set "$KFEditorConf" 'ModPackages' 'ModPackagesInPath' "$(unixpath2win "$MutSource")"
}
function compiled ()
{
test -f "$MutStructScript/StartWave.u"
}
function compile ()
{
if ! command -v multini &> /dev/null; then
get_latest_multini
fi
backup_kfeditorconf && setup_modpackages
rm -rf "$MutUnpublish"
mkdir -p \
"$MutUnpublish" \
"$MutStructScript"
CMD //C "$(unixpath2win "$KFEditor")" make -useunpublished &
local PID="$!"
while ps -p "$PID" &> /dev/null
do
if compiled; then
kill "$PID"; break
fi
sleep 2
done
restore_kfeditorconf
if ! compiled; then
echo "Compilation failed"
return 1
fi
}
function brew ()
{
echo "brew command is broken. Use --brew-unpublished or brew from WorkshopUploadToolGUI instead of this."
# CMD //C "$(unixpath2win "$KFEditor")" brewcontent -platform=PC ServerExt ServerExtMut -useunpublished
}
function brew_unpublished ()
{
rm -rf "$MutPublish"
if ! compiled; then
compile
fi
cp -rf "$MutUnpublish" "$MutPublish"
}
function generate_wsinfo () # $1: package dir
{
local Description=$(cat "$MutPubContent/description.txt")
local Title=$(cat "$MutPubContent/title.txt")
local Preview=$(unixpath2win "$MutPubContent/preview.png")
local Tags=$(cat "$MutPubContent/tags.txt")
local PackageDir=$(unixpath2win "$1")
echo "\$Description \"$Description\"
\$Title \"$Title\"
\$PreviewFile \"$Preview\"
\$Tags \"$Tags\"
\$MicroTxItem \"false\"
\$PackageDirectory \"$PackageDir\"
" > "$MutWsInfo"
}
function upload ()
{
PackageDir=$(mktemp -d -u -p "$KFDoc")
cp -rf "$MutPublish"/* "$PackageDir"
generate_wsinfo "$PackageDir"
CMD //C "$(unixpath2win "$KFWorkshop")" "$MutWsInfoName"
rm -rf "$PackageDir"
rm -f "$MutWsInfo"
}
function create_default_testing_ini ()
{
echo "Map=\"KF-Outpost\"
Game=\"KFGameContent.KFGameInfo_Endless\"
Difficulty=\"0\"
GameLength=\"0\"
Mutators=\"StartWave.StartWave\"
Args=\"StartWave=7?Dosh=999?bUseDebug=True\"" > "$MutTestingIni"
}
function game_test ()
{
if ! [[ -r "$MutTestingIni" ]]; then
create_default_testing_ini
fi
source "$MutTestingIni"
CMD //C "$(unixpath2win "$KFGame")" ${Map}?Difficulty=${Difficulty}?GameLength=${GameLength}?Game=${Game}?Mutator=${Mutators}?${Args} -useunpublished -log
}
ScriptFullname=$(readlink -e "$0")
ScriptName=$(basename "$0")
ScriptDir=$(dirname "$ScriptFullname")
SteamPath=$(reg_readkey "HKCU\Software\Valve\Steam" "SteamPath")
DocumentsPath=$(reg_readkey "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" "Personal")
KFPath="$SteamPath/steamapps/common/killingfloor2"
KFBin="$KFPath/Binaries"
KFEditor="$KFBin/Win64/KFEditor.exe"
KFGame="$KFBin/Win64/KFGame.exe"
KFWorkshop="$KFBin/WorkshopUserTool.exe"
KFDoc="$DocumentsPath/My Games/KillingFloor2"
KFConfig="$KFDoc/KFGame/Config"
KFEditorConf="$KFConfig/KFEditor.ini"
KFEditorConfBackup="${KFEditorConf}.backup"
MutSource="$ScriptDir"
MutPubContent="$MutSource/PublicationContent"
MutUnpublish="$KFDoc/KFGame/Unpublished"
MutPublish="$KFDoc/KFGame/Published"
MutStructScript="$MutUnpublish/BrewedPC/Script"
MutStructPackages="$MutUnpublish/BrewedPC/Packages"
MutStructLocalization="$MutUnpublish/BrewedPC/Localization"
MutTestingIni="$MutSource/testing.ini"
MutWsInfoName="wsinfo_serverext.txt"
MutWsInfo="$KFDoc/$MutWsInfoName"
ThirdPartyBin="$MutSource/3rd-party-bin"
export PATH="$PATH:$ThirdPartyBin"
if [[ $# -eq 0 ]]; then show_help; exit 0; fi
case $1 in
-h|--help ) show_help ; ;;
-c|--compile ) compile ; ;;
-b|--brew ) brew ; ;;
-bu|--brew-unpublished ) brew_unpublished ; ;;
-u|--upload ) upload ; ;;
-t|--test ) game_test ; ;;
* ) echo "Command not recognized: $1"; exit 1;;
esac

31
test.cfg Normal file
View File

@ -0,0 +1,31 @@
# 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"

1
tools Submodule

Submodule tools added at 3d96a1e6c6