10 Commits

Author SHA1 Message Date
131e4db937 Merge pull request #2 from GenZmeY/short-name
add short alias for mutator
2024-03-08 23:23:45 +03:00
87697f65fb add short alias for mutator 2023-12-31 23:41:11 +03:00
e3a2a1bc74 update ci/cd 2023-12-31 20:50:07 +03:00
12bc017bbf trigger megalinter 2023-05-14 11:12:54 +03:00
85edd10ede Merge pull request #1 from GenZmeY/MegaLinter
add Mega Linter
2023-05-14 11:09:26 +03:00
da94da21ef update build tools 2023-05-14 11:06:28 +03:00
70baade05d fix style 2023-05-14 11:05:01 +03:00
7ec056711e update README.md 2023-05-14 11:03:03 +03:00
30981eb5d9 add MegaLinter 2023-05-14 10:56:40 +03:00
4b79242979 add .editorconfig 2023-05-14 10:56:09 +03:00
15 changed files with 210 additions and 161 deletions

33
.editorconfig Normal file
View File

@ -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

114
.github/workflows/mega-linter.yml vendored Normal file
View File

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

View File

@ -16,7 +16,7 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2379769040[/b]
[*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=TAWOD.TAWODMut[/b] and restart the server.
[*]Add mutator to server start parameters: [b]?Mutator=TAWOD.Mut[/b] and restart the server.
[/olist]
[h1]Sources:[/h1]

View File

@ -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\<USERNAME>\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)

42
TAWOD/Classes/Mut.uc Normal file
View File

@ -0,0 +1,42 @@
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
{
}

View File

@ -1,4 +1,4 @@
[Flags]
AllowDownload=True
AllowDownload=False
ClientOptional=False
ServerSideOnly=False
ServerSideOnly=True

View File

@ -1,82 +1 @@
class TAWODMut extends KFMutator;
var const E_LogLevel LogLevel;
var private TAWOD TAWOD;
public simulated function bool SafeDestroy()
{
`Log_Trace();
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
`Log_Trace();
Super.PreBeginPlay();
if (WorldInfo.Game.DefaultPawnClass != WorldInfo.Game.default.DefaultPawnClass)
{
`Log_Warn("Custom 'DefaultPawnClass' (" $ WorldInfo.Game.DefaultPawnClass $ ") detected, possible compatibility issues. Turn off TAWOD if there are problems");
}
if (ClassIsChildOf(WorldInfo.Game.DefaultPawnClass, class'KFGameInfo_VersusSurvival'.default.DefaultPawnClass))
{
WorldInfo.Game.DefaultPawnClass = class'TAWOD_PawnHuman_Versus';
`Log_Info("TAWOD_PawnHuman_Versus");
}
else
{
WorldInfo.Game.DefaultPawnClass = class'TAWOD_PawnHuman';
`Log_Info("TAWOD_PawnHuman");
}
`Log_Info("Loaded.");
}
public function AddMutator(Mutator Mut)
{
`Log_Trace();
if (Mut == Self) return;
if (Mut.Class == Class)
Mut.Destroy();
else
Super.AddMutator(Mut);
}
public function bool PreventDeath(Pawn Killed, Controller Killer, class<DamageType> damageType, vector HitLocation)
{
`Log_Trace();
if (Role >= ROLE_Authority)
{
DropAllWeapons(KFPawn_Human(Killed));
}
return Super.PreventDeath(Killed, Killer, damageType, HitLocation);
}
public static function DropAllWeapons(KFPawn_Human KFP)
{
local KFWeapon KFW;
if (KFP != None && KFP.InvManager != None)
{
foreach KFP.InvManager.InventoryActors(class'KFWeapon', KFW)
{
if (KFW != None && KFW.bDropOnDeath && KFW.CanThrow())
{
KFP.TossInventory(KFW);
}
}
}
}
defaultproperties
{
LogLevel = LL_Info
}
class TAWODMut extends Mut; // backward compatibility

View File

@ -1,11 +0,0 @@
class TAWOD_PawnHuman extends KFPawn_Human;
public function ThrowWeaponOnDeath()
{
class'TAWODMut'.static.DropAllWeapons(Self);
}
defaultproperties
{
}

View File

@ -1,11 +0,0 @@
class TAWOD_PawnHuman_Versus extends KFPawn_Human_Versus;
public function ThrowWeaponOnDeath()
{
class'TAWODMut'.static.DropAllWeapons(Self);
}
defaultproperties
{
}

View File

@ -1,20 +0,0 @@
class _Logger extends Object
abstract;
enum E_LogLevel
{
LL_WrongLevel,
LL_None,
LL_Fatal,
LL_Error,
LL_Warning,
LL_Info,
LL_Debug,
LL_Trace,
LL_All
};
defaultproperties
{
}

View File

@ -1,2 +0,0 @@
// Constants
`define NO_CONFIG 0

View File

@ -1,3 +0,0 @@
// Imports
`include(Logger.uci)
`include(Constants.uci)

View File

@ -1,15 +0,0 @@
// Logger
`define Log_Tag 'TAWOD'
`define LocationStatic "`{ClassName}::" $ GetFuncName()
`define Log_Base(msg, cond) `log(`msg `if(`cond), `cond`{endif}, `Log_Tag)
`define Log_Fatal(msg) `log("FATAL:" @ `msg, (LogLevel >= LL_Fatal), `Log_Tag)
`define Log_Error(msg) `log("ERROR:" @ `msg, (LogLevel >= LL_Error), `Log_Tag)
`define Log_Warn(msg) `log("WARN:" @ `msg, (LogLevel >= LL_Warning), `Log_Tag)
`define Log_Info(msg) `log("INFO:" @ `msg, (LogLevel >= LL_Info), `Log_Tag)
`define Log_Debug(msg) `log("DEBUG:" @ `msg, (LogLevel >= LL_Debug), `Log_Tag)
`define Log_Trace(msg) `log("TRACE:" @ `Location `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)
`define Log_TraceStatic(msg) `log("TRACE:" @ `LocationStatic `if(`msg) @ `msg`{endif}, (LogLevel >= LL_Trace), `Log_Tag)

2
tools

Submodule tools updated: cd658d9af9...fb458ac61f