diff --git a/PublicationContent/description.txt b/PublicationContent/description.txt index 5c6b65b..0950008 100644 --- a/PublicationContent/description.txt +++ b/PublicationContent/description.txt @@ -5,7 +5,7 @@ [*]Subscribe your server to this. [*]Add [b]SML.Mut[/b] [u]first[/u] to your list of mutators, example: [code] -?Mutator=SML.Mut,AAL.AALMut,YAS.YASMut,CTI.CTIMut,CVC.CVCMut,ZedSpawner.ZedSpawnerMut +?Mutator=SML.Mut,UnofficialKFPatch.UKFPMutator,AAL.AALMut,DiscordMessage.DMMutator,YAS.YASMut,CTI.CTIMut,CVC.CVCMut,ZedSpawner.ZedSpawnerMut [/code] (add/remove [b]compatible[/b] mutators you need) [/olist] @@ -25,11 +25,14 @@ [*]Purchasing a DLC weapon will unrank the server if currently there is no player with the purchased DLC. This can be bypassed by replacing all DLC weapons with their clones. [*]Since [url=https://wiki.killingfloor2.com/index.php?title=Update_1133_(Killing_Floor_2)]KF2 v1133[/url] the content preload causes the server to unrank for some reason. Disable it in CTI settings ([b]bPreloadContent=False[/b]) to stay ranked. [/list] +🟢 [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2891475864]Discord Link [Edited][/url] +🟢 [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2875147606]Unofficial Killing Floor 2 Patch[/url] +🟢 [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2521826524]Yet Another Scoreboard[/url] 🟡 [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2811290931]Zed Spawner[/url] [list] [*]Since [url=https://wiki.killingfloor2.com/index.php?title=Update_1133_(Killing_Floor_2)]KF2 v1133[/url] zed preload causes the server to unrank for some reason. Disable it in ZedSpawner settings ([b]bPreloadContentServer=False[/b]) to stay ranked. [/list] -🟢 [url=https://steamcommunity.com/sharedfiles/filedetails/?id=2521826524]Yet Another Scoreboard[/url] + [h1]Sources[/h1] [url=https://github.com/GenZmeY/KF2-SafeMutLoader]https://github.com/GenZmeY/KF2-SafeMutLoader[/url] [b](GNU GPLv3)[/b] diff --git a/README.md b/README.md index 1caa637..8a81a3e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ However, [AccessPlus](https://forums.tripwireinteractive.com/index.php?threads/u * **with workshop:** Use the instructions below 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: ``` -?Mutator=SML.Mut,AAL.AALMut,DiscordMessage.DMMutator,YAS.YASMut,CTI.CTIMut,CVC.CVCMut,ZedSpawner.ZedSpawnerMut +?Mutator=SML.Mut,UnofficialKFPatch.UKFPMutator,AAL.AALMut,DiscordMessage.DMMutator,YAS.YASMut,CTI.CTIMut,CVC.CVCMut,ZedSpawner.ZedSpawnerMut ``` (add/remove **compatible** mutators you need) @@ -32,9 +32,10 @@ However, [AccessPlus](https://forums.tripwireinteractive.com/index.php?threads/u Purchasing a DLC weapon will unrank the server if currently there is no player with the purchased DLC. This can be bypassed by replacing all DLC weapons with their clones. Since KF2 [v1133](https://wiki.killingfloor2.com/index.php?title=Update_1133_(Killing_Floor_2)) the content preload causes the server to unrank for some reason. Disable it in CTI settings (`bPreloadContent=False`) to stay ranked. 🟢 [Discord Link [Edited]](https://steamcommunity.com/sharedfiles/filedetails/?id=2891475864) +🟢 [Unofficial Killing Floor 2 Patch](https://steamcommunity.com/sharedfiles/filedetails/?id=2875147606) +🟢 [Yet Another Scoreboard](https://steamcommunity.com/sharedfiles/filedetails/?id=2521826524) 🟡 [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. -🟢 [Yet Another Scoreboard](https://steamcommunity.com/sharedfiles/filedetails/?id=2521826524) # Making SML-compatible mutators See [developer guide](https://github.com/GenZmeY/KF2-SafeMutLoader/blob/master/DEV.md) diff --git a/SML/Classes/SafeMutLoader.uc b/SML/Classes/SafeMutLoader.uc index 62706ef..d645c52 100644 --- a/SML/Classes/SafeMutLoader.uc +++ b/SML/Classes/SafeMutLoader.uc @@ -1,7 +1,14 @@ class SafeMutLoader extends KFAccessControl config(SML); +struct CMR +{ + var String Mutator; + var String Replacement; +}; + var private Array ServerActors; +var private Array CustomMutReplacements; var private config E_LogLevel LogLevel; var private config Array Mutators; @@ -89,6 +96,13 @@ public static function String GetName(optional Object O) } } +public static function String GetMutName(class CMut) +{ + if (CMut == None) return ""; + + return CMut.GetPackageName() $ "." $ String(CMut); +} + public function PostLogin(PlayerController C) { local Actor A; @@ -138,10 +152,26 @@ public static function E_LogLevel GetLogLevel() private static function class GetMutReplacement(class MutClass) { - if (MutClass == None || MutClass.static.GetLocalString() == "") return None; - return class(DynamicLoadObject( - MutClass.GetPackageName() $ "." $ - MutClass.static.GetLocalString(), class'Class')); + local int Index; + local String Replacement; + + if (MutClass == None) return None; + + Index = default.CustomMutReplacements.Find('Mutator', GetMutName(MutClass)); + if (Index != INDEX_NONE) + { + Replacement = default.CustomMutReplacements[Index].Replacement; + } + else if (MutClass.static.GetLocalString() == "") + { + return None; + } + else + { + Replacement = MutClass.GetPackageName() $ "." $ MutClass.static.GetLocalString(); + } + + return class(DynamicLoadObject(Replacement, class'Class')); } private static function class GetMutStringReplacement(String MutString) @@ -151,5 +181,12 @@ private static function class GetMutStringReplacement(String MutString) defaultproperties { - + CustomMutReplacements.Add({( + Mutator="UnofficialKFPatch.UKFPMutator", + Replacement="UnofficialKFPatch.UKFPReplicationInfo" + )}) + CustomMutReplacements.Add({( + Mutator="UnofficialKFPatch.UKFPMutatorNW", + Replacement="UnofficialKFPatch.UKFPReplicationInfo" + )}) } \ No newline at end of file