From e6def1ebb9fdf234f54999f77a0bbfe695247ad8 Mon Sep 17 00:00:00 2001 From: xNexus-ACS <83370388+xNexus-ACS@users.noreply.github.com> Date: Sun, 30 Oct 2022 17:38:52 +0100 Subject: [PATCH] ScpVoiceChat Feature --- ExiledUtils_REMAKE/EventHandlers.cs | 7 --- ExiledUtils_REMAKE/ExiledUtils_REMAKE.csproj | 48 +++++++++++-------- ExiledUtils_REMAKE/MainClass.cs | 14 ++++-- .../Patches/ScpVoiceChatPatch.cs | 16 +++++++ 4 files changed, 53 insertions(+), 32 deletions(-) create mode 100644 ExiledUtils_REMAKE/Patches/ScpVoiceChatPatch.cs diff --git a/ExiledUtils_REMAKE/EventHandlers.cs b/ExiledUtils_REMAKE/EventHandlers.cs index 2a70510..d0a2880 100644 --- a/ExiledUtils_REMAKE/EventHandlers.cs +++ b/ExiledUtils_REMAKE/EventHandlers.cs @@ -33,13 +33,6 @@ public void OnAddingTarget(AddingTargetEventArgs ev) ev.Scp096.ShowHint(plugin.Config.AddingTarget096Hint, plugin.Config.AddingTargetHintDuration); ev.Target.ShowHint(plugin.Config.AddingTargetHint, plugin.Config.AddingTargetHintDuration); } - public void OnEnteringEnvironmentalHazard(EnteringEnvironmentalHazardEventArgs ev) - { - if (ev.EnvironmentalHazard is TantrumEnvironmentalHazard hazard) - { - hazard.SCPImmune = MainClass.hub.Config.SCPInmuneToTantrum; - } - } public void OnFlippingCoin(FlippingCoinEventArgs ev) { if (plugin.Config.EnableCoinFeatures) diff --git a/ExiledUtils_REMAKE/ExiledUtils_REMAKE.csproj b/ExiledUtils_REMAKE/ExiledUtils_REMAKE.csproj index aab728a..6a201e5 100644 --- a/ExiledUtils_REMAKE/ExiledUtils_REMAKE.csproj +++ b/ExiledUtils_REMAKE/ExiledUtils_REMAKE.csproj @@ -31,48 +31,54 @@ 4 + + ..\..\..\..\Desktop\EXILED VISUAL STUDIO\EXILED 5\5.2\dependencies\0Harmony.dll + - ..\..\..\..\Desktop\EXILED VISUAL STUDIO\EXILED 5\5.1.0\Assembly-CSharp-Publicized.dll + ..\..\..\..\Desktop\EXILED VISUAL STUDIO\EXILED 5\5.2\Assembly-CSharp-PublicizedX.dll + + + ..\packages\EXILED.5.3.1\lib\net472\Assembly-CSharp-Publicized.dll ..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp-firstpass.dll - ..\packages\EXILED.5.3.0\lib\net472\CommandSystem.Core.dll + ..\packages\EXILED.5.3.1\lib\net472\CommandSystem.Core.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.API.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.API.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.Bootstrap.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.Bootstrap.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.CreditTags.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.CreditTags.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.CustomItems.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.CustomItems.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.CustomRoles.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.CustomRoles.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.Events.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.Events.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.Loader.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.Loader.dll - - ..\packages\EXILED.5.3.0\lib\net472\Exiled.Permissions.dll + + ..\packages\EXILED.5.3.1\lib\net472\Exiled.Permissions.dll - ..\packages\EXILED.5.3.0\lib\net472\Exiled.Updater.dll + ..\packages\EXILED.5.3.1\lib\net472\Exiled.Updater.dll False D:\Steam Biblioteca\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll - ..\packages\EXILED.5.3.0\lib\net472\NorthwoodLib.dll + ..\packages\EXILED.5.3.1\lib\net472\NorthwoodLib.dll @@ -95,9 +101,11 @@ + + diff --git a/ExiledUtils_REMAKE/MainClass.cs b/ExiledUtils_REMAKE/MainClass.cs index 699b918..8ba6354 100644 --- a/ExiledUtils_REMAKE/MainClass.cs +++ b/ExiledUtils_REMAKE/MainClass.cs @@ -5,6 +5,7 @@ using ExiledUtilsRemake_Scp049Handler = Exiled.Events.Handlers.Scp049; using ExiledUtilsRemake_Scp106Handler = Exiled.Events.Handlers.Scp106; using ExiledUtils_REMAKE.Enums; +using HarmonyLib; namespace ExiledUtils_REMAKE { @@ -14,11 +15,13 @@ public class MainClass : Plugin public override string Author { get; } = "xNexus-ACS"; public override string Name { get; } = "ExiledUtils-Remake"; public override string Prefix { get; } = "exiled_utils_remake"; - public override Version Version { get; } = new Version(4, 0, 0); + public override Version Version { get; } = new Version(4, 1, 0); public override Version RequiredExiledVersion { get; } = new Version(5, 3, 0); public const VersionType type = VersionType.Remake; + + private static Harmony harmony; - public EventHandlers Ev; + public EventHandlers Ev { get; private set; } public override void OnEnabled() { @@ -29,10 +32,11 @@ public override void OnEnabled() Ev = new EventHandlers(this); hub = this; + harmony = new Harmony($"exiledutils-remake"); + harmony.PatchAll(); ExiledUtilsRemake_PlayerHandler.UsingRadioBattery += Ev.OnUsingRadioBattery; ExiledUtilsRemake_PlayerHandler.Shooting += Ev.OnShooting; - ExiledUtilsRemake_PlayerHandler.EnteringEnvironmentalHazard += Ev.OnEnteringEnvironmentalHazard; ExiledUtilsRemake_PlayerHandler.FlippingCoin += Ev.OnFlippingCoin; ExiledUtilsRemake_PlayerHandler.UsingMicroHIDEnergy += Ev.OnUsingMicroEnergy; ExiledUtilsRemake_PlayerHandler.PreAuthenticating += Ev.OnPreAuthenticating; @@ -47,7 +51,6 @@ public override void OnDisabled() { ExiledUtilsRemake_PlayerHandler.UsingRadioBattery -= Ev.OnUsingRadioBattery; ExiledUtilsRemake_PlayerHandler.Shooting -= Ev.OnShooting; - ExiledUtilsRemake_PlayerHandler.EnteringEnvironmentalHazard -= Ev.OnEnteringEnvironmentalHazard; ExiledUtilsRemake_PlayerHandler.FlippingCoin -= Ev.OnFlippingCoin; ExiledUtilsRemake_PlayerHandler.UsingMicroHIDEnergy -= Ev.OnUsingMicroEnergy; ExiledUtilsRemake_PlayerHandler.PreAuthenticating -= Ev.OnPreAuthenticating; @@ -55,9 +58,10 @@ public override void OnDisabled() ExiledUtilsRemake_Scp096Handler.AddingTarget -= Ev.OnAddingTarget; ExiledUtilsRemake_Scp049Handler.FinishingRecall -= Ev.OnRevived; ExiledUtilsRemake_Scp049Handler.StartingRecall -= Ev.OnReviving; - + Ev = null; hub = null; + harmony.UnpatchAll(harmony.Id); base.OnDisabled(); } } diff --git a/ExiledUtils_REMAKE/Patches/ScpVoiceChatPatch.cs b/ExiledUtils_REMAKE/Patches/ScpVoiceChatPatch.cs new file mode 100644 index 0000000..dd1197e --- /dev/null +++ b/ExiledUtils_REMAKE/Patches/ScpVoiceChatPatch.cs @@ -0,0 +1,16 @@ +using Exiled.API.Features; +using HarmonyLib; + +namespace ExiledUtils_REMAKE.Patches +{ + [HarmonyPatch(typeof(Radio), nameof(Radio.UserCode_CmdSyncTransmissionStatus))] + public class ScpVoiceChatPatch + { + public static bool Prefix(Radio __instance, bool b) + { + if (Player.Get(__instance._hub).IsScp) + __instance._dissonanceSetup.MimicAs939 = b; + return true; + } + } +} \ No newline at end of file