First version
This commit is contained in:
parent
1697284b69
commit
67b37fab6c
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
testing.ini
|
||||||
|
3rd-party-bin
|
20
PublicationContent/description.txt
Normal file
20
PublicationContent/description.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[img]https://raw.githubusercontent.com/GenZmeY/KF2-TAWOD/master/PublicationContent/mutbanner.png[/img]
|
||||||
|
|
||||||
|
[h1]Description:[/h1]
|
||||||
|
[i]A small mutator that forces players to throw all their weapons on death (not just the current weapon as in the game by default). [/i]
|
||||||
|
|
||||||
|
[h1]The mutator is not whitelisted![/h1]
|
||||||
|
You will not gain experience for playing with this mutator.
|
||||||
|
|
||||||
|
[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 [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section:
|
||||||
|
[code]ServerSubscribedWorkshopItems=2379769040[/code]
|
||||||
|
3. Start the server and wait while the mutator is downloading;
|
||||||
|
4. Add the following line to the startup parameters and restart the server:
|
||||||
|
[code]?Mutator=TAWOD.TAWODMut[/code]
|
||||||
|
|
||||||
|
[h1]Sources:[/h1]
|
||||||
|
[url=https://github.com/GenZmeY/KF2-TAWOD][u]Github[/u][/url] (GNU GPLv3)
|
BIN
PublicationContent/mutbanner.png
Normal file
BIN
PublicationContent/mutbanner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1014 KiB |
BIN
PublicationContent/preview.png
Normal file
BIN
PublicationContent/preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 471 KiB |
BIN
PublicationContent/socialpreview.png
Normal file
BIN
PublicationContent/socialpreview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 731 KiB |
1
PublicationContent/tags.txt
Normal file
1
PublicationContent/tags.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Mutators
|
1
PublicationContent/title.txt
Normal file
1
PublicationContent/title.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Throw All Weapons On Dead (TAWOD)
|
46
README.md
46
README.md
@ -1 +1,45 @@
|
|||||||
# Throw All Weapons On Death Mutator
|
# Throw All Weapons On Death
|
||||||
|
|
||||||
|
[![](PublicationContent/mutbanner.png)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
|
||||||
|
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-TAWOD)](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
[![Steam Workshop](https://img.shields.io/badge/steam-workshop-0)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
[![Steam Subscriptions](https://img.shields.io/steam/subscriptions/2379769040)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
[![Steam Favorites](https://img.shields.io/steam/favorites/2379769040)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
[![Steam Update Date](https://img.shields.io/steam/update-date/2379769040)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-TAWOD)](https://github.com/GenZmeY/KF2-TAWOD/tags)
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
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
|
||||||
|
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: `git clone https://github.com/GenZmeY/KF2-TAWOD && cd KF2-TAWOD`
|
||||||
|
3. Run make.sh script:
|
||||||
|
`./make.sh --compile`
|
||||||
|
4. The compiled files will be here:
|
||||||
|
`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)
|
||||||
|
1. Open your PCServer-KFEngine.ini / LinuxServer-KFEngine.ini;
|
||||||
|
2. Add the following string to the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section:
|
||||||
|
`ServerSubscribedWorkshopItems=2379769040`
|
||||||
|
3. Start the server and wait while the mutator is downloading;
|
||||||
|
4. Add the following line to the startup parameters and restart the server:
|
||||||
|
`?Mutator=TAWOD.TAWODMut`
|
||||||
|
|
||||||
|
# Bug reports
|
||||||
|
If you find a bug, create new issue here: [Issues](https://github.com/GenZmeY/KF2-TAWOD/issues)
|
||||||
|
Describe what the bug looks like and how to reproduce it.
|
||||||
|
|
||||||
|
# License
|
||||||
|
The mutator is licensed under the [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html).
|
||||||
|
4
TAWOD/Classes/TAWOD.upkg
Normal file
4
TAWOD/Classes/TAWOD.upkg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[Flags]
|
||||||
|
AllowDownload=True
|
||||||
|
ClientOptional=False
|
||||||
|
ServerSideOnly=False
|
33
TAWOD/Classes/TAWODMut.uc
Normal file
33
TAWOD/Classes/TAWODMut.uc
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
Class TAWODMut extends KFMutator;
|
||||||
|
|
||||||
|
simulated event PostBeginPlay()
|
||||||
|
{
|
||||||
|
super.PostBeginPlay();
|
||||||
|
|
||||||
|
if (WorldInfo.Game.BaseMutator == None)
|
||||||
|
WorldInfo.Game.BaseMutator = Self;
|
||||||
|
else
|
||||||
|
WorldInfo.Game.BaseMutator.AddMutator(Self);
|
||||||
|
|
||||||
|
if (bDeleteMe)
|
||||||
|
return;
|
||||||
|
|
||||||
|
WorldInfo.Game.DefaultPawnClass = class'TAWODPawn_Human';
|
||||||
|
|
||||||
|
`Log("[TAWOD] Loaded mutator.");
|
||||||
|
}
|
||||||
|
|
||||||
|
function AddMutator(Mutator Mut)
|
||||||
|
{
|
||||||
|
if (Mut == Self)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Mut.Class == Class)
|
||||||
|
Mut.Destroy();
|
||||||
|
else
|
||||||
|
Super.AddMutator(Mut);
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultproperties
|
||||||
|
{
|
||||||
|
}
|
28
TAWOD/Classes/TAWODPawn_Human.uc
Normal file
28
TAWOD/Classes/TAWODPawn_Human.uc
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
class TAWODPawn_Human extends KFPawn_Human;
|
||||||
|
|
||||||
|
function ThrowActiveWeapon( optional bool bDestroyWeap )
|
||||||
|
{
|
||||||
|
local KFWeapon TempWeapon;
|
||||||
|
|
||||||
|
if( Role < ROLE_Authority )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Health <= 0)
|
||||||
|
{
|
||||||
|
if (InvManager != none)
|
||||||
|
foreach InvManager.InventoryActors(class'KFWeapon', TempWeapon)
|
||||||
|
if (TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
|
||||||
|
if (TempWeapon != none)
|
||||||
|
TossInventory(TempWeapon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.ThrowActiveWeapon( bDestroyWeap );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultproperties
|
||||||
|
{
|
||||||
|
}
|
220
make.sh
Normal file
220
make.sh
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
#!/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
|
Loading…
Reference in New Issue
Block a user