diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs index a86f3269f2..9fc693b7ee 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs @@ -18,6 +18,23 @@ namespace Exiled.API.Features.Core.UserSettings /// public class KeybindSetting : SettingBase, IWrapper { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// + [Obsolete("This method will be removed next major version because of a new feature. Use the constructor with \"allowSpectator\" instead.")] + public KeybindSetting(int id, string label, KeyCode suggested, bool preventInteractionOnGUI, string hintDescription, HeaderSetting header, Action onChanged) + : base(new SSKeybindSetting(id, label, suggested, preventInteractionOnGUI, false, hintDescription), header, onChanged) + { + Base = (SSKeybindSetting)base.Base; + } + /// /// Initializes a new instance of the class. /// diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 6bb4124324..4dfcf09409 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -1163,11 +1163,6 @@ public bool IsSpawnProtected /// protected HealthStat CustomHealthStat { get; set; } - /// - /// Gets or sets a . - /// - protected FpcScaleController ScaleController { get; set; } - /// /// Converts LabApi player to EXILED player. /// @@ -2077,7 +2072,7 @@ public void SetScale(Vector3 scale, IEnumerable viewers) try { - ScaleController.Scale = scale; + ReferenceHub.transform.localScale = scale; foreach (Player target in viewers) Server.SendSpawnMessage?.Invoke(null, new object[] { NetworkIdentity, target.Connection }); @@ -2099,12 +2094,12 @@ public void SetFakeScale(Vector3 fakeScale, IEnumerable viewers) try { - ScaleController.Scale = fakeScale; + ReferenceHub.transform.localScale = fakeScale; foreach (Player target in viewers) Server.SendSpawnMessage.Invoke(null, new object[] { NetworkIdentity, target.Connection }); - ScaleController.Scale = currentScale; + ReferenceHub.transform.localScale = currentScale; } catch (Exception ex) { diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index 65a9abf52a..fba037de79 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -66,8 +66,8 @@ private static IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Ldloc_S, 20), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, jmp), }); diff --git a/EXILED/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs b/EXILED/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs index 02596adcbc..bbcdd724e7 100644 --- a/EXILED/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs +++ b/EXILED/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs @@ -22,33 +22,32 @@ namespace Exiled.Events.Patches.Events.Warhead using Warhead = Handlers.Warhead; /// - /// Patches . + /// Patches . /// Adds the event. /// [EventPatch(typeof(Warhead), nameof(Warhead.ChangingLeverStatus))] - // [HarmonyPatch(typeof(PlayerInteract), nameof(PlayerInteract.UserCode_CmdUsePanel__AlphaPanelOperations))] + [HarmonyPatch(typeof(AlphaWarheadNukesitePanel), nameof(AlphaWarheadNukesitePanel.ServerInteract))] internal static class ChangingLeverStatus { - /*private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { List newInstructions = ListPool.Pool.Get(instructions); Label returnLabel = generator.DefineLabel(); - int offset = 2; - int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Brtrue_S) + offset; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Call); newInstructions.InsertRange( index, new[] { // Player.Get(component) - new CodeInstruction(OpCodes.Ldloc_0).MoveLabelsFrom(newInstructions[index]), + new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // nukeside.Networkenabled - new(OpCodes.Ldloc_1), + new(OpCodes.Ldarg_0), new(OpCodes.Call, PropertyGetter(typeof(AlphaWarheadNukesitePanel), nameof(AlphaWarheadNukesitePanel.Networkenabled))), // true @@ -73,6 +72,6 @@ internal static class ChangingLeverStatus yield return newInstructions[z]; ListPool.Pool.Return(newInstructions); - }*/ + } } } \ No newline at end of file