update style

This commit is contained in:
GenZmeY 2023-05-14 04:41:54 +03:00
parent 64893b7484
commit 42c844fffd
11 changed files with 584 additions and 584 deletions

92
DEV.md
View File

@ -2,7 +2,7 @@
**SML compatible mutator development guide**
# Mutator template
## Mutator template
You can use this template to make the mutator compatible with SML.
Here I will use `Example` as mutator name. **Replace it with yours.**
@ -15,59 +15,59 @@ var private Example Example;
public simulated function bool SafeDestroy()
{
return (bPendingDelete || bDeleteMe || Destroy());
return (bPendingDelete || bDeleteMe || Destroy());
}
public event PreBeginPlay()
{
Super.PreBeginPlay();
Super.PreBeginPlay();
if (WorldInfo.NetMode == NM_Client) return;
if (WorldInfo.NetMode == NM_Client) return;
foreach WorldInfo.DynamicActors(class'Example', Example)
{
break;
}
foreach WorldInfo.DynamicActors(class'Example', Example)
{
break;
}
if (Example == None)
{
Example = WorldInfo.Spawn(class'Example');
}
if (Example == None)
{
Example = WorldInfo.Spawn(class'Example');
}
if (Example == None)
{
`Log("Example: FATAL: Can't Spawn 'Example'");
SafeDestroy();
}
if (Example == None)
{
`Log("Example: FATAL: Can't Spawn 'Example'");
SafeDestroy();
}
}
public function AddMutator(Mutator Mut)
{
if (Mut == Self) return;
if (Mut == Self) return;
if (Mut.Class == Class)
ExampleMut(Mut).SafeDestroy();
else
Super.AddMutator(Mut);
if (Mut.Class == Class)
ExampleMut(Mut).SafeDestroy();
else
Super.AddMutator(Mut);
}
public function NotifyLogin(Controller C)
{
Example.NotifyLogin(C);
Example.NotifyLogin(C);
Super.NotifyLogin(C);
Super.NotifyLogin(C);
}
public function NotifyLogout(Controller C)
{
Example.NotifyLogout(C);
Example.NotifyLogout(C);
Super.NotifyLogout(C);
Super.NotifyLogout(C);
}
static function String GetLocalString(optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2)
{
return String(class'Example');
return String(class'Example');
}
defaultproperties
@ -82,34 +82,34 @@ class Example extends Info;
public event PreBeginPlay()
{
Super.PreBeginPlay();
Super.PreBeginPlay();
// do some initialization here
// do some initialization here
}
public event PostBeginPlay()
{
Super.PostBeginPlay();
Super.PostBeginPlay();
// do some initialization here
// do some initialization here
}
public function NotifyLogin(Controller C)
{
// Do what you need here when the player log in
// Do what you need here when the player log in
}
public function NotifyLogout(Controller C)
{
// Do what you need here when the player log out
// Do what you need here when the player log out
}
public simulated function vector GetTargetLocation(optional actor RequestedBy, optional bool bRequestAlternateLoc)
{
local Controller C;
C = Controller(RequestedBy);
if (C != None) { bRequestAlternateLoc ? NotifyLogout(C) : NotifyLogin(C); }
return Super.GetTargetLocation(RequestedBy, bRequestAlternateLoc);
local Controller C;
C = Controller(RequestedBy);
if (C != None) { bRequestAlternateLoc ? NotifyLogout(C) : NotifyLogin(C); }
return Super.GetTargetLocation(RequestedBy, bRequestAlternateLoc);
}
defaultproperties
@ -120,21 +120,21 @@ defaultproperties
That's all. You can create new classes and add any code to `Example.uc` (yay!), but refrain from implementing anything else in `ExampleMut.uc` because it will not be used.
# Limitations
## Limitations
❌ Can't make ranked game mode this way;
❌ SML can only emulate [`NotifyLogin(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/Engine/Classes/Mutator.uc#L147) and [`NotifyLogout(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/Engine/Classes/Mutator.uc#L141), other functions of the [`Mutator`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/master/Engine/Classes/Mutator.uc) and [`KFMutator`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/master/KFGame/Classes/KFMutator.uc) classes are not supported - look for workarounds in this case.
# Tips
## Tips
## Alternative to the InitMutator(...) function
Even though the [`InitMutator(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/KFGame/Classes/KFMutator.uc#L22) function is not supported, you can still parse the startup string if you need to:
Refer to [`WorldInfo.GetLocalURL()`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/Engine/Classes/WorldInfo.uc#L1315) and get the option from there. It's best to do this in `PreBeginPlay()` or `PostBeginPlay()` of your `Example.uc` (as well as other initializations).
## XP for custom Zeds / Weapons
### XP for custom Zeds / Weapons
While custom weapons and zeds won't make your server unranked, the [`ValidateForXP(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/KFGame/Classes/KFGameInfo.uc#L2564) function will not allow you to gain experience if it detects a custom zed or custom damage type.
Therefore, if you want to gain experience - make sure that [`ValidateForXP(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/KFGame/Classes/KFGameInfo.uc#L2564) does not receive custom zed classes or custom damage types.
For example you can change your custom weapon to use only default damage types or try changing the `DamageHistory` and/or `MonsterClass` before it gets into [`DistributeMoneyAndXP(...)`](https://github.com/GenZmeY/KF2-Dev-Scripts/blob/23d1ca3a9a2f62692741e77039f03fe0a913be1d/KFGame/Classes/KFGameInfo.uc#L2489).
## Replacing base classes to bypass restrictions
### Replacing base classes to bypass restrictions
In some cases, changing the base classes of the game can help. For example, we cannot make [TAWOD](https://steamcommunity.com/sharedfiles/filedetails/?id=2379769040) and SML compatible because the [PreventDeath(...)](https://github.com/GenZmeY/KF2-TAWOD/blob/master/TAWOD/Classes/TAWODMut.uc#L19) function is not supported. But this can be bypassed by replacing the player's Pawn base class with custom Pawn class:
```unrealscript
WorldInfo.Game.DefaultPawnClass = class'ExamplePawn_Human'; // Put this to `PostBeginPlay()` of your Example.uc
@ -146,13 +146,13 @@ class ExamplePawn_Human extends KFPawn_Human;
public function ThrowWeaponOnDeath()
{
local KFWeapon KFW;
local KFWeapon KFW;
if (InvManager == None) return;
if (InvManager == None) return;
foreach InvManager.InventoryActors(class'KFWeapon', KFW)
if (KFW.bDropOnDeath && KFW.CanThrow())
KFP.TossInventory(KFW);
foreach InvManager.InventoryActors(class'KFWeapon', KFW)
if (KFW.bDropOnDeath && KFW.CanThrow())
KFP.TossInventory(KFW);
}
```

View File

@ -1,19 +1,19 @@
# KF2-SafeMutLoader
Use non-whitelisted mutators and stay ranked.
# Disclaimer
## Disclaimer
**SML only uses KF2 and UnrealScript features, it doesn't change game executables or RAM or anything like that, so it's not a hack and it doesn't violate [Killing Floor 2 EULA](https://store.steampowered.com/eula/232090_eula_0).**
However, [AccessPlus](https://forums.tripwireinteractive.com/index.php?threads/utility-admin-access-plus-manager.118740) is also not a hack for the same reason, but it is constantly banned in the steam workshop. Why? I dont know.
**So use this at your own risk!**
# Usage (server only)
## Usage (server only)
1. Add SML to your server. There are two ways:
* **without workshop:** download `SML.u` from [releases](https://github.com/GenZmeY/KF2-SafeMutLoader/releases) and put it to `KFGame/BrewedPC`
* **with workshop:** Use the [instructions below](https://github.com/GenZmeY/KF2-SafeMutLoader#build--upload) to build the SML and upload it to your workshop, then subscribe your server to SML
2. Add `SML.Mut` **first** to your list of mutators, example:
```
```text
?Mutator=SML.Mut,UnofficialKFPatch.UKFPMutator,AAL.AALMut,DiscordMessage.DMMutator,YAS.YASMut,CTI.CTIMut,CVC.CVCMut,ZedSpawner.ZedSpawnerMut
```
(add/remove **compatible** mutators you need)
@ -24,7 +24,7 @@ However, [AccessPlus](https://forums.tripwireinteractive.com/index.php?threads/u
⚠️ SML is a server-side mutator, clients never download it. Therefore, no one will know about you using SML if you dont tell yourself (or if you share with the whole world the `BrewedPC` folder where you put the SML, lol).
⚠️ SML is incompatible with [AccessPlus](https://github.com/th3-z/kf2-acpp) and other mods based on it. If you need something from there, implement it as an SML compatible mutator using [developer guide](https://github.com/GenZmeY/KF2-SafeMutLoader/blob/master/DEV.md).
# Compatible mutators
## Compatible mutators
🟢 Any whitelisted mutators
🟢 [Admin Auto Login](https://steamcommunity.com/sharedfiles/filedetails/?id=2848836389)
🟢 [Controlled Vote Collector](https://steamcommunity.com/sharedfiles/filedetails/?id=2847465899)
@ -38,10 +38,10 @@ Since KF2 [v1133](https://wiki.killingfloor2.com/index.php?title=Update_1133_(Ki
🟡 [Zed Spawner](https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931)
Since KF2 [v1133](https://wiki.killingfloor2.com/index.php?title=Update_1133_(Killing_Floor_2)) zed preload causes the server to unrank for some reason. Disable it in ZedSpawner settings (`bPreloadContentServer=False`) to stay ranked.
# Making SML-compatible mutators
## Making SML-compatible mutators
See [developer guide](https://github.com/GenZmeY/KF2-SafeMutLoader/blob/master/DEV.md)
# Build & Upload
## Build & Upload
**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:
@ -54,9 +54,9 @@ See [developer guide](https://github.com/GenZmeY/KF2-SafeMutLoader/blob/master/D
`./tools/builder -cbu`
6. Find `SafeMutLoader` in your workshop and change `Visibility` to `Unlisted` so your server can download it (don't use `Public` visibility)
# Contributing
## Contributing
If you make a mod compatible with SML I'll be happy to add it to the list of compatible mutators.
Contact me in any convenient way (for example, create an [issue](https://github.com/GenZmeY/KF2-SafeMutLoader/issues))
# License
[GNU GPLv3](LICENSE)
## License
[![license](https://www.gnu.org/graphics/gplv3-with-text-136x68.png)](LICENSE)