From 56c0f1b2ccff33cb8bce90b87ab279d9456173f4 Mon Sep 17 00:00:00 2001 From: IRacle Date: Sun, 21 Jul 2024 22:03:27 +0300 Subject: [PATCH 1/7] scp079 recantain feat --- EXILED/Exiled.Events/Config.cs | 6 +++ .../Patches/Generic/Scp079Recontain.cs | 54 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs index 006be02b2..86e21c7de 100644 --- a/EXILED/Exiled.Events/Config.cs +++ b/EXILED/Exiled.Events/Config.cs @@ -80,6 +80,12 @@ public sealed class Config : IConfig [Description("Indicates whether thrown keycards can affect doors that don't require any permissions")] public bool CanKeycardThrowAffectDoors { get; set; } = false; + /// + /// Gets or sets a value indicating whether the SCP079 will recontained if there are no SCPs left. + /// + [Description("Indicates whether the SCP079 will recontained if there are no SCPs left.")] + public bool ShouldScp079RecontainedWhenNoScps { get; set; } = true; + /// /// Gets or sets a value indicating whether configs has to be reloaded every time a round restarts. /// diff --git a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs new file mode 100644 index 000000000..68f48d30d --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs @@ -0,0 +1,54 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Generic.Scp079API +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using API.Features.Pools; + + using HarmonyLib; + + using PlayerRoles.PlayableScps.Scp079; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Adds the support. + /// + [HarmonyPatch(typeof(Scp079Recontainer), nameof(Scp079Recontainer.OnServerRoleChanged))] + internal class Scp079Recontain + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + Label ret = generator.DefineLabel(); + + newInstructions.InsertRange( + 0, + new[] + { + // if (!Events.Instance.Config.ShouldScp079RecontainedWhenNoScps) + // return; + new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(Exiled.Events.Events), nameof(Exiled.Events.Events.Instance))), + new(OpCodes.Callvirt, PropertyGetter(typeof(Exiled.Events.Events), nameof(Exiled.Events.Events.Config))), + new(OpCodes.Callvirt, PropertyGetter(typeof(Exiled.Events.Config), nameof(Exiled.Events.Config.ShouldScp079RecontainedWhenNoScps))), + new(OpCodes.Brfalse_S, ret), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(ret); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From 991e24bc76eacc57b737ac7b67c61ef837a34689 Mon Sep 17 00:00:00 2001 From: IRacle Date: Sun, 21 Jul 2024 22:03:32 +0300 Subject: [PATCH 2/7] eh --- EXILED/Exiled.Events/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs index 86e21c7de..207335eb5 100644 --- a/EXILED/Exiled.Events/Config.cs +++ b/EXILED/Exiled.Events/Config.cs @@ -96,7 +96,7 @@ public sealed class Config : IConfig /// Gets or sets a value indicating whether translations has to be reloaded every time a round restarts. /// [Description("Indicates whether translations has to be reloaded every round restart")] - public bool ShouldReloadTranslationsAtRoundRestart { get; set; } + public bool ShouldReloadTranslationsAtRoundRestart { get; set; } = false; /// /// Gets a value indicating whether bans should be logged or not. From 6908cfd9b5f38363f70e7ca4bab87338aef3edbb Mon Sep 17 00:00:00 2001 From: IRacle Date: Sun, 21 Jul 2024 22:03:45 +0300 Subject: [PATCH 3/7] labels.add --- .../Patches/Events/Player/ActivatingWorkstation.cs | 2 +- .../Exiled.Events/Patches/Events/Player/ChangingDangerState.cs | 2 +- EXILED/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs | 2 +- EXILED/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs | 2 +- EXILED/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs | 2 +- EXILED/Exiled.Events/Patches/Events/Server/AddingUnitName.cs | 2 +- EXILED/Exiled.Events/Patches/Generic/ParseVisionInformation.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs index 4ee58f8ec..28edd3803 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs @@ -78,7 +78,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Sat, 3 Aug 2024 00:35:30 +0200 Subject: [PATCH 4/7] Update EXILED/Exiled.Events/Config.cs --- EXILED/Exiled.Events/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs index 207335eb5..8808f8210 100644 --- a/EXILED/Exiled.Events/Config.cs +++ b/EXILED/Exiled.Events/Config.cs @@ -84,7 +84,7 @@ public sealed class Config : IConfig /// Gets or sets a value indicating whether the SCP079 will recontained if there are no SCPs left. /// [Description("Indicates whether the SCP079 will recontained if there are no SCPs left.")] - public bool ShouldScp079RecontainedWhenNoScps { get; set; } = true; + public bool ShouldRecontainScp079IfNoScpsLeft { get; set; } = true; /// /// Gets or sets a value indicating whether configs has to be reloaded every time a round restarts. From 04d53cd9a78506b53ac36e6cacb5dead81c1c717 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sun, 4 Aug 2024 12:24:02 +0200 Subject: [PATCH 5/7] Update EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs --- EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs index 68f48d30d..19fb229cd 100644 --- a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs +++ b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs @@ -39,7 +39,7 @@ private static IEnumerable Transpiler(IEnumerable Date: Sun, 4 Aug 2024 12:36:40 +0200 Subject: [PATCH 6/7] Update EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs --- EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs index 19fb229cd..99e448cd4 100644 --- a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs +++ b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs @@ -20,7 +20,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API /// /// Patches . - /// Adds the support. + /// Adds the support. /// [HarmonyPatch(typeof(Scp079Recontainer), nameof(Scp079Recontainer.OnServerRoleChanged))] internal class Scp079Recontain From c182ebfec70a9afb784a55ec86ae9fdda6179b05 Mon Sep 17 00:00:00 2001 From: IRacle Date: Sat, 17 Aug 2024 18:06:04 +0300 Subject: [PATCH 7/7] `RecontainScp079IfNoScpsLeft` --- EXILED/Exiled.Events/Config.cs | 2 +- EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs index 8808f8210..b141cd17e 100644 --- a/EXILED/Exiled.Events/Config.cs +++ b/EXILED/Exiled.Events/Config.cs @@ -84,7 +84,7 @@ public sealed class Config : IConfig /// Gets or sets a value indicating whether the SCP079 will recontained if there are no SCPs left. /// [Description("Indicates whether the SCP079 will recontained if there are no SCPs left.")] - public bool ShouldRecontainScp079IfNoScpsLeft { get; set; } = true; + public bool RecontainScp079IfNoScpsLeft { get; set; } = true; /// /// Gets or sets a value indicating whether configs has to be reloaded every time a round restarts. diff --git a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs index 99e448cd4..3b319f31c 100644 --- a/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs +++ b/EXILED/Exiled.Events/Patches/Generic/Scp079Recontain.cs @@ -20,7 +20,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API /// /// Patches . - /// Adds the support. + /// Adds the support. /// [HarmonyPatch(typeof(Scp079Recontainer), nameof(Scp079Recontainer.OnServerRoleChanged))] internal class Scp079Recontain @@ -39,7 +39,7 @@ private static IEnumerable Transpiler(IEnumerable