Compare commits

..

17 Commits

Author SHA1 Message Date
1d01ec90b5
Merge pull request #5 from GenZmeY/short-name
add short alias for mutator
2024-03-08 23:51:26 +03:00
7fda68c17c
StartWave and CD chokepoints compat 2024-03-08 23:50:36 +03:00
07d8e16121
add short alias for mutator 2023-12-31 23:51:33 +03:00
ac7a20be9b
update ci/cd 2023-12-31 20:50:15 +03:00
a22ec1b078
update description 2023-12-31 20:32:13 +03:00
0c17002509
Merge pull request #4 from GenZmeY/mut-update
upd mut
2023-07-04 22:21:00 +03:00
b0292d71ce upd mut 2023-06-03 17:16:50 +03:00
a747c3eaf8
Merge pull request #3 from GenZmeY/MegaLinter
add Mega Linter
2023-05-14 09:41:36 +03:00
88d6bbb17b update build tools 2023-05-14 09:40:29 +03:00
281d67d9d3 fix style 2023-05-14 09:38:02 +03:00
b781db3329 update README.md 2023-05-14 09:35:48 +03:00
3a8b407ef5 add MegaLinter 2023-05-14 09:30:10 +03:00
9f1e220c8d add .editorconfig 2023-05-14 09:29:20 +03:00
f0aa54121e update build tools 2022-10-13 23:12:32 +03:00
9486cbe1f1 preload content setup description 2022-10-01 22:06:26 +03:00
d7c87d4b9b update description 2022-10-01 21:59:49 +03:00
86e785b122 add PreloadContent config options 2022-09-15 11:13:16 +03:00
20 changed files with 1793 additions and 1623 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

@ -17,8 +17,8 @@ No. This mod is not whitelisted and will de-rank your server. Any XP gained will
[olist] [olist]
[*]Subscribe to this mutator; [*]Subscribe to this mutator;
[*]Start KF2; [*]Start KF2;
[*]Open console (`) and input: [*]Open console (~) and input:
[b]open KF-BioticsLab?Mutator=ZedSpawner.ZedSpawnerMut[/b] [b]open KF-BioticsLab?Mutator=ZedSpawner.Mut[/b]
(replace the map and add the parameters you need) (replace the map and add the parameters you need)
[*]<Enter>. [*]<Enter>.
[/olist] [/olist]
@ -33,11 +33,25 @@ 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): [*]Add the following string to the [b][OnlineSubsystemSteamworks.KFWorkshopSteamworks][/b] section (create one if it doesn't exist):
[b]ServerSubscribedWorkshopItems=2811290931[/b] [b]ServerSubscribedWorkshopItems=2811290931[/b]
[*]Start the server and wait while the mutator is downloading; [*]Start the server and wait while the mutator is downloading;
[*]Add mutator to server start parameters: [b]?Mutator=ZedSpawner.ZedSpawnerMut[/b] and restart the server. [*]Add mutator to server start parameters: [b]?Mutator=ZedSpawner.Mut[/b] and restart the server.
[/olist] [/olist]
[h1]Setup[/h1] [h1]Important setup information[/h1]
At the first start, the [b]KFZedSpawner.ini[/b] config will be created(*). There are already default settings and spawn lists, but you still need to change them because this is just an example. The config should be created on first start, but now the game contains a bug that initializes the config values randomly if they are not explicitly set. Thus, the config may have incorrect values or not be created at all.
So if you are using this mutator for the first time, I highly recommend doing the following:
[olist]
[*]Create (modify) [b]KFZedSpawner.ini[/b] manually. Put the following content there:
[b][ZedSpawner.ZedSpawner]
Version=0[/b]
[*]Start the game/server with ZedSpawner to generate the contents of the config.
[*]Close the game/server.
[/olist]
[b]Right now this is the only way to correctly create the default config.[/b]
Unfortunately I can't do anything about it because it's a game problem (not mutator). I hope TWI fixes this someday.
[h1]Setup (KFZedSpawner.ini)[/h1]
[b]bPreloadContentServer[/b] - enable/disable server-side preload content;
[b]bPreloadContentClient[/b] - enable/disable client-side preload content;
[b]Cyclic spawn[/b] [b]Cyclic spawn[/b]
If you don't want to write an endless spawn list for the endless mode (lol) use a cyclic spawn. Set parameter [b]bCyclicalSpawn=True[/b] If you don't want to write an endless spawn list for the endless mode (lol) use a cyclic spawn. Set parameter [b]bCyclicalSpawn=True[/b]
@ -72,21 +86,15 @@ Use the [b][ZedSpawner.SpawnListBossWaves][/b] and [b][ZedSpawner.SpawnListSpeci
[h1]Spawn logic[/h1] [h1]Spawn logic[/h1]
I really tried to describe in text how it works, but every time I got some kind of crap. Therefore, I decided to explain it a little differently and made a small calculator for this. It is interactive, you can change the parameters and see what happens. It has all the necessary explanations, so I think you will quickly figure out how the spawner works. I really tried to describe in text how it works, but every time I got some kind of crap. Therefore, I decided to explain it a little differently and made a small calculator for this. It is interactive, you can change the parameters and see what happens. It has all the necessary explanations, so I think you will quickly figure out how the spawner works.
[url=https://redirect.genzmey.su/kf2-zedspawner-calc][img]https://img.shields.io/static/v1?message=Spawn%20Calculator&logo=Google%20Sheets&labelColor=34A853&color=gray&logoColor=white&label=Google%20Sheets%20[/img][/url] [b]Link (remove spaces):[/b]
[code]
htt ps://docs .google .com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=drive_link
[/code]
[i]Just please try not to interfere with each other if you see that someone is already using a calculator.[/i] [i]Just please try not to interfere with each other if you see that someone is already using a calculator.[/i]
[h1]Notes[/h1] [h1]Notes[/h1]
📌 Mutator does not contain custom zeds. You must have the required zeds in your subscriptions to be able to spawn them. 📌 Mutator does not contain custom zeds. You must have the required zeds in your subscriptions to be able to spawn them.
📌 If you are using this mutator to add zeds, you should [b]not[/b] use mutators from zed packs (just having them in subscriptions is enough). 📌 If you are using this mutator to add zeds, you should [b]not[/b] use mutators from zed packs (just having them in subscriptions is enough).
[h1]Troubleshooting[/h1]
📌 [b](*)[/b] If your config is not created for some reason, create it manually with the following content:
[b][ZedSpawner.ZedSpawner]
Version=0
[/b]
Then start the server and check the file again - config content should be generated.
📌 If the spawner's behavior differs from what you expect, check the server logs first. ZedSpawner writes in the logs everything it does (and describes why), most likely you will find an explanation of what is happening there. If not, feel free to report bugs :) 📌 If the spawner's behavior differs from what you expect, check the server logs first. ZedSpawner writes in the logs everything it does (and describes why), most likely you will find an explanation of what is happening there. If not, feel free to report bugs :)
[h1]Sources[/h1] [h1]Sources[/h1]

View File

@ -1,28 +1,29 @@
# ZedSpawner # ZedSpawner
[![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=2811290931) [![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=2811290931)
[![Steam Downloads](https://img.shields.io/steam/downloads/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Favorites](https://img.shields.io/steam/favorites/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [![Steam Favorites](https://img.shields.io/steam/favorites/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
[![Steam Update Date](https://img.shields.io/steam/update-date/2811290931)](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [![MegaLinter](https://github.com/GenZmeY/KF2-ZedSpawner/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-ZedSpawner/actions/workflows/mega-linter.yml)
[![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner)](https://github.com/GenZmeY/KF2-ZedSpawner/tags) [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/GenZmeY/KF2-ZedSpawner)](https://github.com/GenZmeY/KF2-ZedSpawner/tags)
[![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner)](LICENSE) [![GitHub](https://img.shields.io/github/license/GenZmeY/KF2-ZedSpawner)](LICENSE)
# Description ## Description
Spawner for zeds. Started as a modification of the [this version](https://steamcommunity.com/sharedfiles/filedetails/?id=2488241348), but now there is almost nothing left of the previous mutator, lol Spawner for zeds. Started as a modification of the [this version](https://steamcommunity.com/sharedfiles/filedetails/?id=2488241348), but now there is almost nothing left of the previous mutator, lol
# Features ## Features
- spawn without increasing zed counter; - spawn without increasing zed counter;
- spawn depends on the number of players; - spawn depends on the number of players;
- cyclic spawn (useful for endless mode); - cyclic spawn (useful for endless mode);
- separate spawn for special waves and boss waves; - separate spawn for special waves and boss waves;
- spawn after a certain percentage of killed zeds. - spawn after a certain percentage of killed zeds.
# Usage & Setup ## Usage & Setup
[See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931) [See steam workshop page](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
# Spawn calculator ## Spawn calculator
[Spawn Calculator](https://docs.google.com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=sharing) [Spawn Calculator](https://docs.google.com/spreadsheets/d/1q67WJ36jhj6Y0lPNO5tS2bU79Wphu4Xmi62me6DAwtM/edit?usp=sharing)
# 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. **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 and go to any folder where you want to store sources:
@ -36,17 +37,10 @@ Spawner for zeds. Started as a modification of the [this version](https://steamc
5. The compiled files will be here: 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 ## Bug reports
Open git-bash in the source folder and run command:
`./tools/builder -t`
(or `./tools/builder -ct` if you haven't compiled the mutator yet)
A local single-user test will be launched with parameters from `builder.cfg` (edit this file if you want to test mutator with different parameters).
# Bug reports
If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ZedSpawner/issues) and check if there is a description of your bug. If not, create a new issue. If you find a bug, go to the [issue page](https://github.com/GenZmeY/KF2-ZedSpawner/issues) and check if there is a description of your bug. If not, create a new issue.
Describe what the bug looks like and how reproduce it. Describe what the bug looks like and how reproduce it.
Attaching your KFZedSpawner.ini and Launch.log can also be helpful. Attaching your KFZedSpawner.ini and Launch.log can also be helpful.
# License ## License
[GNU GPLv3](LICENSE) [![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE)

61
ZedSpawner/Classes/Mut.uc Normal file
View File

@ -0,0 +1,61 @@
class Mut extends KFMutator
dependson(ZedSpawner);
var private ZedSpawner ZS;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
{
break;
}
if (ZS == None)
{
ZS = WorldInfo.Spawn(class'ZedSpawner');
}
if (ZS == None)
{
`Log_Base("FATAL: Can't Spawn 'ZedSpawner'");
SafeDestroy();
}
}
public function AddMutator(Mutator M)
{
if (M == Self) return;
if (M.Class == Class)
Mut(M).SafeDestroy();
else
Super.AddMutator(M);
}
public function NotifyLogin(Controller C)
{
ZS.NotifyLogin(C);
Super.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
ZS.NotifyLogout(C);
Super.NotifyLogout(C);
}
defaultproperties
{
}

View File

@ -1,7 +1,7 @@
class ZedSpawner extends Info class ZedSpawner extends Info
config(ZedSpawner); config(ZedSpawner);
const LatestVersion = 4; const LatestVersion = 5;
const CfgSpawn = class'Spawn'; const CfgSpawn = class'Spawn';
const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart'; const CfgSpawnAtPlayerStart = class'SpawnAtPlayerStart';
@ -32,6 +32,8 @@ struct S_SpawnEntry
var private config int Version; var private config int Version;
var private config E_LogLevel LogLevel; var private config E_LogLevel LogLevel;
var private config float Tickrate; var private config float Tickrate;
var private config bool bPreloadContentServer;
var private config bool bPreloadContentClient;
var private float dt; var private float dt;
@ -111,6 +113,9 @@ private function PreInit()
case 2: case 2:
case 3: case 3:
case 4:
bPreloadContentServer = true;
bPreloadContentClient = true;
case MaxInt: case MaxInt:
`Log_Info("Config updated to version"@LatestVersion); `Log_Info("Config updated to version"@LatestVersion);
@ -222,7 +227,17 @@ private function PostInit()
CycleWaveSize = CycleWaveSize - CycleWaveShift + 1; CycleWaveSize = CycleWaveSize - CycleWaveShift + 1;
} }
PreloadContent(); if (bPreloadContentServer || bPreloadContentClient)
{
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
}
if (bPreloadContentServer)
{
PreloadContent();
}
SetTimer(dt, true, nameof(SpawnTimer)); SetTimer(dt, true, nameof(SpawnTimer));
} }
@ -233,10 +248,6 @@ private function PreloadContent()
`Log_Trace(); `Log_Trace();
ExtractCustomZedsFromSpawnList(SpawnListRW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListBW, CustomZeds);
ExtractCustomZedsFromSpawnList(SpawnListSW, CustomZeds);
foreach CustomZeds(PawnClass) foreach CustomZeds(PawnClass)
{ {
`Log_Info("Preload content:" @ PawnClass); `Log_Info("Preload content:" @ PawnClass);
@ -244,7 +255,7 @@ private function PreloadContent()
} }
} }
private function ExtractCustomZedsFromSpawnList(Array<S_SpawnEntry> SpawnList, out Array<class<KFPawn_Monster> > Out) private function ExtractCustomZedsFromSpawnList(const out Array<S_SpawnEntry> SpawnList, out Array<class<KFPawn_Monster> > Out)
{ {
local S_SpawnEntry SE; local S_SpawnEntry SE;
@ -268,7 +279,7 @@ private function SpawnTimer()
`Log_Trace(); `Log_Trace();
if (KFGIS.WaveNum != 0 && CurrentWave < KFGIS.WaveNum) if (KFGIS.WaveNum != 0 && CurrentWave != KFGIS.WaveNum)
{ {
SetupWave(); SetupWave();
} }
@ -767,6 +778,8 @@ public function NotifyLogin(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (!bPreloadContentClient) return;
if (!CreateRepInfo(C)) if (!CreateRepInfo(C))
{ {
`Log_Error("Can't create RepInfo for:" @ C); `Log_Error("Can't create RepInfo for:" @ C);
@ -777,6 +790,8 @@ public function NotifyLogout(Controller C)
{ {
`Log_Trace(); `Log_Trace();
if (!bPreloadContentClient) return;
DestroyRepInfo(C); DestroyRepInfo(C);
} }

View File

@ -1,56 +1 @@
class ZedSpawnerMut extends KFMutator class ZedSpawnerMut extends Mut; // backward compatibility
dependson(ZedSpawner);
var private ZedSpawner ZS;
public event PreBeginPlay()
{
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'ZedSpawner', ZS)
{
break;
}
if (ZS == None)
{
ZS = WorldInfo.Spawn(class'ZedSpawner');
}
if (ZS == None)
{
`Log_Base("FATAL: Can't Spawn 'ZedSpawner'");
Destroy();
}
}
public function AddMutator(Mutator Mut)
{
if (Mut == Self) return;
if (Mut.Class == Class)
Mut.Destroy();
else
Super.AddMutator(Mut);
}
public function NotifyLogin(Controller C)
{
ZS.NotifyLogin(C);
Super.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
ZS.NotifyLogout(C);
Super.NotifyLogout(C);
}
defaultproperties
{
}

2
tools

@ -1 +1 @@
Subproject commit 88b35bd7ebb7e30448579f1564220398f990541c Subproject commit fb458ac61f7e6c6426b8dff366dd5e7499e0d95f