diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a3108ab --- /dev/null +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml new file mode 100644 index 0000000..24897f3 --- /dev/null +++ b/.github/workflows/mega-linter.yml @@ -0,0 +1,72 @@ +--- +name: MegaLinter + +permissions: read-all + +on: + push: + pull_request: + branches: [master] + +env: + APPLY_FIXES: none + APPLY_FIXES_EVENT: pull_request + APPLY_FIXES_MODE: commit + DISABLE: SPELL + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + build: + name: MegaLinter + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + with: + token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + + - name: MegaLinter + id: ml + uses: oxsecurity/megalinter@v6 + env: + VALIDATE_ALL_CODEBASE: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Archive production artifacts + if: ${{ success() }} || ${{ failure() }} + uses: actions/upload-artifact@v3 + with: + name: MegaLinter reports + path: | + megalinter-reports + mega-linter.log + + - name: Create Pull Request with applied fixes + id: cpr + if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) + uses: peter-evans/create-pull-request@v5 + 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: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" + + - name: Prepare commit + if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) + run: sudo chown -Rc $UID .git/ + - name: Commit and push applied linter fixes + if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} + commit_message: "[MegaLinter] Apply linters fixes" + commit_user_name: megalinter-bot + commit_user_email: nicolas.vuillamy@ox.security diff --git a/README.md b/README.md index bb5916b..1b13ec7 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ -[![](PublicationContent/mutbanner.png)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040) +# Throw All Weapons On Death + +[![Banner](PublicationContent/mutbanner.png)](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040) [![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=2379769040) +[![Steam Downloads](https://img.shields.io/steam/downloads/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) +[![MegaLinter](https://github.com/GenZmeY/KF2-TAWOD/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-TAWOD/actions/workflows/mega-linter.yml) [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-TAWOD)](https://github.com/GenZmeY/KF2-TAWOD/tags) [![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-TAWOD)](https://www.gnu.org/licenses/gpl-3.0.en.html) -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 server-side 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); 2. open git-bash and go to any folder where you want to store sources: @@ -22,12 +25,12 @@ A small mutator that forces players to throw all their weapons on death (not jus 5. The compiled files will be here: `C:\Users\\Documents\My Games\KillingFloor2\KFGame\Unpublished\BrewedPC\Script\` -# Usage +## Usage [See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040) -# Bug reports +## 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 -[GNU GPLv3](LICENSE). +## License +[![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE) diff --git a/TAWOD/Classes/TAWOD.upkg b/TAWOD/Classes/TAWOD.upkg index 7d148dd..ae6c83c 100644 --- a/TAWOD/Classes/TAWOD.upkg +++ b/TAWOD/Classes/TAWOD.upkg @@ -1,4 +1,4 @@ -[Flags] -AllowDownload=False -ClientOptional=False -ServerSideOnly=True +[Flags] +AllowDownload=False +ClientOptional=False +ServerSideOnly=True diff --git a/TAWOD/Classes/TAWODMut.uc b/TAWOD/Classes/TAWODMut.uc index a9ed138..3b3c541 100644 --- a/TAWOD/Classes/TAWODMut.uc +++ b/TAWOD/Classes/TAWODMut.uc @@ -1,37 +1,37 @@ -class TAWODMut extends KFMutator; - -public event PreBeginPlay() -{ - Super.PreBeginPlay(); - `log("Loaded.", true, 'TAWOD'); -} - -public function AddMutator(Mutator Mut) -{ - if (Mut == Self) return; - - if (Mut.Class == Class) - Mut.Destroy(); - else - Super.AddMutator(Mut); -} - -public function bool PreventDeath(Pawn Killed, Controller Killer, class 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 -{ - -} +class TAWODMut extends KFMutator; + +public event PreBeginPlay() +{ + Super.PreBeginPlay(); + `log("Loaded.", true, 'TAWOD'); +} + +public function AddMutator(Mutator Mut) +{ + if (Mut == Self) return; + + if (Mut.Class == Class) + Mut.Destroy(); + else + Super.AddMutator(Mut); +} + +public function bool PreventDeath(Pawn Killed, Controller Killer, class 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 +{ + +} diff --git a/builder.cfg b/builder.cfg index 889e3c2..618a572 100644 --- a/builder.cfg +++ b/builder.cfg @@ -7,7 +7,7 @@ StripSource="True" # Mutators to be compiled # Specify them with a space as a separator, -# Mutators will be compiled in the specified order +# Mutators will be compiled in the specified order PackageBuildOrder="TAWOD" @@ -16,7 +16,7 @@ PackageBuildOrder="TAWOD" # 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 +# The order doesn't matter PackagePeelzBrew="" @@ -24,7 +24,7 @@ PackagePeelzBrew="" # Mutators that will be uploaded to the workshop # Specify them with a space as a separator, -# The order doesn't matter +# The order doesn't matter PackageUpload="TAWOD" diff --git a/tools b/tools index cd658d9..fb458ac 160000 --- a/tools +++ b/tools @@ -1 +1 @@ -Subproject commit cd658d9af958a46be3d46679dde4e3af6109c59e +Subproject commit fb458ac61f7e6c6426b8dff366dd5e7499e0d95f