add build tools, remove useless code
This commit is contained in:
parent
b12f519113
commit
285ad73b8f
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "tools"]
|
||||||
|
path = tools
|
||||||
|
url = https://github.com/GenZmeY/KF2-BuildTools
|
@ -17,4 +17,4 @@ You will not gain experience for playing with this mutator.
|
|||||||
[code]?Mutator=TAWOD.TAWODMut[/code]
|
[code]?Mutator=TAWOD.TAWODMut[/code]
|
||||||
|
|
||||||
[h1]Sources:[/h1]
|
[h1]Sources:[/h1]
|
||||||
[url=https://github.com/GenZmeY/KF2-TAWOD][u]Github[/u][/url] (GNU GPLv3)
|
[url=https://github.com/GenZmeY/KF2-TAWOD]https://github.com/GenZmeY/KF2-TAWOD[/url] (GNU GPLv3)
|
||||||
|
23
README.md
23
README.md
@ -9,23 +9,22 @@
|
|||||||
A small mutator that forces players to throw all their weapons on death (not just the current weapon as in the game by default).
|
A small mutator that forces players to throw all their weapons on death (not just the current weapon as in the game by default).
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
**Note:** If you want to build/test/brew/publish a mutator without git-bash and/or scripts, follow [these instructions](https://tripwireinteractive.atlassian.net/wiki/spaces/KF2SW/pages/26247172/KF2+Code+Modding+How-to) instead of what is described here.
|
||||||
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
|
1. Install [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/), Killing Floor 2 - SDK and [git for windows](https://git-scm.com/download/win);
|
||||||
2. Open git-bash, clone this repository and go to the source folder:
|
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-TAWOD && cd KF2-TAWOD`
|
`git clone https://github.com/GenZmeY/KF2-TAWOD && cd KF2-TAWOD`
|
||||||
3. Run make.sh script:
|
4. Download dependencies:
|
||||||
`./make.sh --compile`
|
`git submodule init && git submodule update`
|
||||||
4. The compiled files will be here:
|
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
|
|
||||||
You can check your build using the `make.sh` script.
|
|
||||||
Open git-bash in the source folder and run the script:
|
|
||||||
`./make.sh --test`
|
|
||||||
On first launch, the script will create `testing.ini` file and launch the game with the settings from it (KF-Outpost map + TAWODMut). Edit this file if you need to test the mutator with different parameters.
|
|
||||||
|
|
||||||
# Usage (Server)
|
# Usage (Server)
|
||||||
1. Open your PCServer-KFEngine.ini / LinuxServer-KFEngine.ini;
|
1. Open your PCServer-KFEngine.ini / LinuxServer-KFEngine.ini;
|
||||||
2. Add the following string to the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section:
|
2. Add the following string to the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section (create one if it doesn't exist):
|
||||||
`ServerSubscribedWorkshopItems=2379769040`
|
`ServerSubscribedWorkshopItems=2379769040`
|
||||||
3. Start the server and wait while the mutator is downloading;
|
3. Start the server and wait while the mutator is downloading;
|
||||||
4. Add the following line to the startup parameters and restart the server:
|
4. Add the following line to the startup parameters and restart the server:
|
||||||
@ -36,4 +35,4 @@ If you find a bug, create new issue here: [Issues](https://github.com/GenZmeY/KF
|
|||||||
Describe what the bug looks like and how to reproduce it.
|
Describe what the bug looks like and how to reproduce it.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
The mutator is licensed under the [GNU GPLv3](LICENSE).
|
[GNU GPLv3](LICENSE).
|
||||||
|
@ -1,24 +1,14 @@
|
|||||||
Class TAWODMut extends KFMutator;
|
class TAWODMut extends KFMutator;
|
||||||
|
|
||||||
simulated event PostBeginPlay()
|
public event PreBeginPlay()
|
||||||
{
|
{
|
||||||
super.PostBeginPlay();
|
Super.PreBeginPlay();
|
||||||
|
`log("Loaded.", true, 'TAWOD');
|
||||||
if (WorldInfo.Game.BaseMutator == None)
|
|
||||||
WorldInfo.Game.BaseMutator = Self;
|
|
||||||
else
|
|
||||||
WorldInfo.Game.BaseMutator.AddMutator(Self);
|
|
||||||
|
|
||||||
if (bDeleteMe)
|
|
||||||
return;
|
|
||||||
|
|
||||||
`Log("[TAWOD] Loaded mutator.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddMutator(Mutator Mut)
|
public function AddMutator(Mutator Mut)
|
||||||
{
|
{
|
||||||
if (Mut == Self)
|
if (Mut == Self) return;
|
||||||
return;
|
|
||||||
|
|
||||||
if (Mut.Class == Class)
|
if (Mut.Class == Class)
|
||||||
Mut.Destroy();
|
Mut.Destroy();
|
||||||
@ -26,16 +16,16 @@ function AddMutator(Mutator Mut)
|
|||||||
Super.AddMutator(Mut);
|
Super.AddMutator(Mut);
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
|
public function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
|
||||||
{
|
{
|
||||||
local KFWeapon TempWeapon;
|
local KFWeapon TempWeapon;
|
||||||
local KFPawn_Human KFP;
|
local KFPawn_Human KFP;
|
||||||
|
|
||||||
KFP = KFPawn_Human(Killed);
|
KFP = KFPawn_Human(Killed);
|
||||||
|
|
||||||
if (Role >= ROLE_Authority && KFP != None && KFP.InvManager != none)
|
if (Role >= ROLE_Authority && KFP != None && KFP.InvManager != None)
|
||||||
foreach KFP.InvManager.InventoryActors(class'KFWeapon', TempWeapon)
|
foreach KFP.InvManager.InventoryActors(class'KFWeapon', TempWeapon)
|
||||||
if (TempWeapon != none && TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
|
if (TempWeapon != None && TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
|
||||||
KFP.TossInventory(TempWeapon);
|
KFP.TossInventory(TempWeapon);
|
||||||
|
|
||||||
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
|
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
|
||||||
@ -43,4 +33,5 @@ function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> dam
|
|||||||
|
|
||||||
defaultproperties
|
defaultproperties
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
52
builder.cfg
Normal file
52
builder.cfg
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
### 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="TAWOD"
|
||||||
|
|
||||||
|
|
||||||
|
### 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="TAWOD"
|
||||||
|
|
||||||
|
|
||||||
|
### 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_Survival"
|
||||||
|
|
||||||
|
# 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="TAWOD.TAWODMut"
|
||||||
|
|
||||||
|
# Additional parameters
|
||||||
|
Args=""
|
220
make.sh
220
make.sh
@ -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' 'TAWOD'
|
|
||||||
multini --set "$KFEditorConf" 'ModPackages' 'ModPackagesInPath' "$(unixpath2win "$MutSource")"
|
|
||||||
}
|
|
||||||
|
|
||||||
function compiled ()
|
|
||||||
{
|
|
||||||
test -f "$MutStructScript/TAWOD.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_Survival\"
|
|
||||||
Difficulty=\"0\"
|
|
||||||
GameLength=\"0\"
|
|
||||||
Mutators=\"TAWOD.TAWODMut\"
|
|
||||||
Args=\"\"" > "$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
|
|
1
tools
Submodule
1
tools
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 02222cf4536ac3b4dc9341c17549f77bd8efd4a4
|
Loading…
Reference in New Issue
Block a user