From 72182cdc08ef95945128d959f5d0fafedf341c05 Mon Sep 17 00:00:00 2001
From: Mike <146554836+MikeSus1@users.noreply.github.com>
Date: Fri, 11 Apr 2025 15:00:37 +0200
Subject: [PATCH 1/3] initial push
---
.../Scp939/SettingMimicPointEventArgs.cs | 48 +++++++++++++++++++
EXILED/Exiled.Events/Handlers/Scp939.cs | 11 +++++
.../Events/Scp939/SettingMimicPoint.cs | 45 +++++++++++++++++
3 files changed, 104 insertions(+)
create mode 100644 EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
create mode 100644 EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
new file mode 100644
index 0000000000..cf611943a5
--- /dev/null
+++ b/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
@@ -0,0 +1,48 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) ExMod Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.Events.EventArgs.Scp939
+{
+ using API.Features;
+ using Exiled.API.Features.Roles;
+ using Interfaces;
+
+ ///
+ /// Contains all information before SCP-939 plays a stolen player's voice.
+ ///
+ public class SettingMimicPointEventArgs : IScp939Event, IDeniableEvent
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ ///
+ ///
+ /// ///
+ /// Indicates whether the mimic point can be placed or not.
+ ///
+ public SettingMimicPointEventArgs(ReferenceHub player, bool isAllowed = true)
+ {
+ Player = Player.Get(player);
+ Scp939 = Player.Role.As();
+ IsAllowed = isAllowed;
+ }
+
+ ///
+ /// Gets or sets a value indicating whether SCP-939 can play the stolen voice.
+ ///
+ public bool IsAllowed { get; set; }
+
+ ///
+ /// Gets the player who's controlling SCP-939.
+ ///
+ public Player Player { get; }
+
+ ///
+ public Scp939Role Scp939 { get; }
+ }
+}
\ No newline at end of file
diff --git a/EXILED/Exiled.Events/Handlers/Scp939.cs b/EXILED/Exiled.Events/Handlers/Scp939.cs
index d2ca5e4533..ba94aa3b1d 100644
--- a/EXILED/Exiled.Events/Handlers/Scp939.cs
+++ b/EXILED/Exiled.Events/Handlers/Scp939.cs
@@ -74,6 +74,11 @@ public static class Scp939
///
public static Event ValidatingVisibility { get; set; } = new();
+ ///
+ /// Invoked before SCP-939 places a mimic point.
+ ///
+ public static Event SettingMimicPoint { get; set; } = new();
+
///
/// Called before SCP-939 changes its target focus.
///
@@ -139,5 +144,11 @@ public static class Scp939
///
/// The instance.
public static void OnValidatingVisibility(ValidatingVisibilityEventArgs ev) => ValidatingVisibility.InvokeSafely(ev);
+
+ ///
+ /// Invoked before SCP-939 places a mimic point.
+ ///
+ /// The instance.
+ public static void OnSettingMimicPoint(SettingMimicPointEventArgs ev) => SettingMimicPoint.InvokeSafely(ev);
}
}
\ No newline at end of file
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
new file mode 100644
index 0000000000..83ea81c340
--- /dev/null
+++ b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
@@ -0,0 +1,45 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) ExMod Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
+
+namespace Exiled.Events.Patches.Events.Scp939
+{
+ using Attributes;
+ using HarmonyLib;
+ using Mirror;
+ using PlayerRoles.PlayableScps.Scp939.Mimicry;
+ using RelativePositioning;
+
+ ///
+ /// Patches .
+ /// Adds the event.
+ ///
+ [EventPatch(typeof(Handlers.Scp939), nameof(Handlers.Scp939.SettingMimicPoint))]
+ [HarmonyPatch(typeof(MimicPointController), nameof(MimicPointController.ServerProcessCmd))]
+ internal static class SettingMimicPoint
+ {
+ private static bool Prefix(ref MimicPointController __instance, ref NetworkReader reader)
+ {
+ __instance.ServerProcessCmd(reader);
+ if (__instance.Active)
+ {
+ __instance._syncMessage = MimicPointController.RpcStateMsg.RemovedByUser;
+ __instance.Active = false;
+ }
+ else
+ {
+ __instance._syncMessage = MimicPointController.RpcStateMsg.PlacedByUser;
+ __instance._syncPos = new RelativePosition(__instance.CastRole.FpcModule.Position);
+ __instance.Active = true;
+ }
+
+ __instance.ServerSendRpc(true);
+ return true;
+ }
+ }
+}
\ No newline at end of file
From 7bae231651dd63e675bd9fa49e297276ab9bfb34 Mon Sep 17 00:00:00 2001
From: Mike <146554836+MikeSus1@users.noreply.github.com>
Date: Fri, 11 Apr 2025 15:18:31 +0200
Subject: [PATCH 2/3] w8
---
.../Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
index 83ea81c340..4ed4e968a7 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
@@ -5,6 +5,8 @@
//
// -----------------------------------------------------------------------
+using Exiled.Events.EventArgs.Scp939;
+
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
namespace Exiled.Events.Patches.Events.Scp939
@@ -25,6 +27,8 @@ internal static class SettingMimicPoint
{
private static bool Prefix(ref MimicPointController __instance, ref NetworkReader reader)
{
+ SettingMimicPointEventArgs ev = new(API.Features.Player.Get(__instance.Owner));
+ Handlers.Scp1344.OnChangingStatus(ev);
__instance.ServerProcessCmd(reader);
if (__instance.Active)
{
From 527bd5384abd0caf7a426b203f896256f7ccf6cd Mon Sep 17 00:00:00 2001
From: Mike <146554836+MikeSus1@users.noreply.github.com>
Date: Fri, 11 Apr 2025 15:52:57 +0200
Subject: [PATCH 3/3] idk
---
.../Scp939/SettingMimicPointEventArgs.cs | 6 +++---
.../Events/Scp939/SettingMimicPoint.cs | 19 +++++++++++++------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
index cf611943a5..6c6bd51a64 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp939/SettingMimicPointEventArgs.cs
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
-//
+//
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
//
@@ -25,9 +25,9 @@ public class SettingMimicPointEventArgs : IScp939Event, IDeniableEvent
/// ///
/// Indicates whether the mimic point can be placed or not.
///
- public SettingMimicPointEventArgs(ReferenceHub player, bool isAllowed = true)
+ public SettingMimicPointEventArgs(Player player, bool isAllowed = true)
{
- Player = Player.Get(player);
+ Player = player;
Scp939 = Player.Role.As();
IsAllowed = isAllowed;
}
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
index 4ed4e968a7..f377f187a1 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp939/SettingMimicPoint.cs
@@ -5,13 +5,12 @@
//
// -----------------------------------------------------------------------
-using Exiled.Events.EventArgs.Scp939;
-
#pragma warning disable SA1313 // Parameter names should begin with lower-case letter
namespace Exiled.Events.Patches.Events.Scp939
{
using Attributes;
+ using Exiled.Events.EventArgs.Scp939;
using HarmonyLib;
using Mirror;
using PlayerRoles.PlayableScps.Scp939.Mimicry;
@@ -25,11 +24,19 @@ namespace Exiled.Events.Patches.Events.Scp939
[HarmonyPatch(typeof(MimicPointController), nameof(MimicPointController.ServerProcessCmd))]
internal static class SettingMimicPoint
{
- private static bool Prefix(ref MimicPointController __instance, ref NetworkReader reader)
+ private static bool Prefix(MimicPointController __instance, ref NetworkReader reader)
{
- SettingMimicPointEventArgs ev = new(API.Features.Player.Get(__instance.Owner));
- Handlers.Scp1344.OnChangingStatus(ev);
- __instance.ServerProcessCmd(reader);
+ if (!__instance.Active)
+ {
+ SettingMimicPointEventArgs ev = new SettingMimicPointEventArgs(API.Features.Player.Get(__instance.Owner));
+ Handlers.Scp939.OnSettingMimicPoint(ev);
+
+ if (!ev.IsAllowed)
+ {
+ return false;
+ }
+ }
+
if (__instance.Active)
{
__instance._syncMessage = MimicPointController.RpcStateMsg.RemovedByUser;