Compare commits
No commits in common. "master" and "v1.0.0" have entirely different histories.
@ -1,33 +0,0 @@
|
|||||||
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
114
.github/workflows/mega-linter.yml
vendored
@ -1,114 +0,0 @@
|
|||||||
---
|
|
||||||
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"
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
*.psd
|
testing.ini
|
||||||
/ignore
|
3rd-party-bin
|
||||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "tools"]
|
|
||||||
path = tools
|
|
||||||
url = https://github.com/GenZmeY/KF2-BuildTools
|
|
@ -1,23 +1,20 @@
|
|||||||
[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-TAWOD[/img] [img]https://img.shields.io/steam/favorites/2379769040[/img] [img]https://img.shields.io/steam/update-date/2379769040[/img] [url=https://steamcommunity.com/sharedfiles/filedetails/changelog/2379769040][img]https://img.shields.io/github/v/tag/GenZmeY/KF2-TAWOD[/img][/url]
|
[img]https://raw.githubusercontent.com/GenZmeY/KF2-TAWOD/master/PublicationContent/mutbanner.png[/img]
|
||||||
|
|
||||||
[h1]Description:[/h1]
|
[h1]Description:[/h1]
|
||||||
[i]A small server-side mutator that forces players to throw all their weapons on death (not just the current weapon as in the game by default).[/i]
|
[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]Whitelisted?[/h1]
|
[h1]The mutator is not whitelisted![/h1]
|
||||||
No. This mod is not whitelisted and will de-rank your server. Any XP gained will not be saved.
|
You will not gain experience for playing with this mutator.
|
||||||
|
|
||||||
[h1]Usage (server)[/h1]
|
[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]
|
[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.
|
||||||
[olist]
|
|
||||||
[*]Open your [b]PCServer-KFEngine.ini[/b] / [b]LinuxServer-KFEngine.ini[/b];
|
1. Open your PCServer-KFEngine.ini / LinuxServer-KFEngine.ini;
|
||||||
[*]Find the [b][IpDrv.TcpNetDriver][/b] section and make sure that there is a line (add if not):
|
2. Add the following string to the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section:
|
||||||
[b]DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload[/b]
|
[code]ServerSubscribedWorkshopItems=2379769040[/code]
|
||||||
❗️ If there are several [b]DownloadManagers=[/b] then the line above should be the first ❗️
|
3. Start the server and wait while the mutator is downloading;
|
||||||
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
|
4. Add the following line to the startup parameters and restart the server:
|
||||||
[b]ServerSubscribedWorkshopItems=2379769040[/b]
|
[code]?Mutator=TAWOD.TAWODMut[/code]
|
||||||
[*]Start the server and wait while the mutator is downloading;
|
|
||||||
[*]Add mutator to server start parameters: [b]?Mutator=TAWOD.Mut[/b] and restart the server.
|
|
||||||
[/olist]
|
|
||||||
|
|
||||||
[h1]Sources:[/h1]
|
[h1]Sources:[/h1]
|
||||||
[url=https://github.com/GenZmeY/KF2-TAWOD]https://github.com/GenZmeY/KF2-TAWOD[/url] [b](GNU GPLv3)[/b]
|
[url=https://github.com/GenZmeY/KF2-TAWOD][u]Github[/u][/url] (GNU GPLv3)
|
||||||
|
51
README.md
51
README.md
@ -1,36 +1,39 @@
|
|||||||
# Throw All Weapons On Death
|
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
|
||||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
|
|
||||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
|
||||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
|
||||||
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
[](https://github.com/GenZmeY/KF2-TAWOD/actions/workflows/mega-linter.yml)
|
[](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
||||||
[](https://github.com/GenZmeY/KF2-TAWOD/tags)
|
[](https://github.com/GenZmeY/KF2-TAWOD/tags)
|
||||||
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
|
||||||
|
|
||||||
**A small server-side 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 and go to any folder where you want to store sources:
|
2. Open git-bash, clone this repository and go to the source folder:
|
||||||
`cd <ANY_FOLDER_YOU_WANT>`
|
`git clone https://github.com/GenZmeY/KF2-TAWOD && cd KF2-TAWOD`
|
||||||
3. Clone this repository and go to the source folder:
|
3. Run make.sh script:
|
||||||
`git clone https://github.com/GenZmeY/KF2-TAWOD && cd KF2-TAWOD`
|
`./make.sh --compile`
|
||||||
4. Download dependencies:
|
4. The compiled files will be here:
|
||||||
`git submodule init && git submodule update`
|
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
|
||||||
5. Compile:
|
|
||||||
`./tools/builder -c`
|
|
||||||
5. The compiled files will be here:
|
|
||||||
`C:\Users\<USERNAME>\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\`
|
|
||||||
|
|
||||||
## Usage
|
# Testing
|
||||||
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040)
|
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.
|
||||||
|
|
||||||
## Bug reports
|
# 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)
|
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.
|
Describe what the bug looks like and how to reproduce it.
|
||||||
|
|
||||||
## License
|
# License
|
||||||
[](LICENSE)
|
The mutator is licensed under the [GNU GPLv3](LICENSE).
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
class Mut extends KFMutator;
|
|
||||||
|
|
||||||
public simulated function bool SafeDestroy()
|
|
||||||
{
|
|
||||||
return (bPendingDelete || bDeleteMe || Destroy());
|
|
||||||
}
|
|
||||||
|
|
||||||
public event PreBeginPlay()
|
|
||||||
{
|
|
||||||
Super.PreBeginPlay();
|
|
||||||
`log("Loaded.", true, 'TAWOD');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function AddMutator(Mutator M)
|
|
||||||
{
|
|
||||||
if (M == Self) return;
|
|
||||||
|
|
||||||
if (M.Class == Class)
|
|
||||||
Mut(M).SafeDestroy();
|
|
||||||
else
|
|
||||||
Super.AddMutator(M);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
|
|
||||||
{
|
|
||||||
local KFWeapon TempWeapon;
|
|
||||||
local KFPawn_Human KFP;
|
|
||||||
|
|
||||||
KFP = KFPawn_Human(Killed);
|
|
||||||
|
|
||||||
if (Role >= ROLE_Authority && KFP != None && KFP.InvManager != None)
|
|
||||||
foreach KFP.InvManager.InventoryActors(class'KFWeapon', TempWeapon)
|
|
||||||
if (TempWeapon != None && TempWeapon.bDropOnDeath && TempWeapon.CanThrow())
|
|
||||||
KFP.TossInventory(TempWeapon);
|
|
||||||
|
|
||||||
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultproperties
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
[Flags]
|
[Flags]
|
||||||
AllowDownload=False
|
AllowDownload=True
|
||||||
ClientOptional=False
|
ClientOptional=False
|
||||||
ServerSideOnly=True
|
ServerSideOnly=False
|
||||||
|
@ -1 +1,33 @@
|
|||||||
class TAWODMut extends Mut; // backward compatibility
|
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
|
||||||
|
{
|
||||||
|
}
|
61
builder.cfg
61
builder.cfg
@ -1,61 +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="TAWOD"
|
|
||||||
|
|
||||||
|
|
||||||
### 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="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
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
|
1
tools
1
tools
@ -1 +0,0 @@
|
|||||||
Subproject commit fb458ac61f7e6c6426b8dff366dd5e7499e0d95f
|
|
Loading…
x
Reference in New Issue
Block a user