From 7d8eaf68520ceb3267ad5bafd1f058e7ad7a6494 Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Mon, 19 Aug 2024 21:57:58 +0300
Subject: [PATCH 01/14] Scp 173 Being Observed event
Co-Authored-By: ZeroTwo <63092138+notzer0two@users.noreply.github.com>
---
.../Scp173/Scp173BeingObservedEventArgs.cs | 56 ++++++++++++++
EXILED/Exiled.Events/Handlers/Scp173.cs | 11 +++
.../Events/Scp173/Scp173BeingObserved.cs | 77 +++++++++++++++++++
EXILED/Exiled.Example/Events/Scp173Handler.cs | 26 +++++++
EXILED/Exiled.Example/Example.cs | 7 ++
5 files changed, 177 insertions(+)
create mode 100644 EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
create mode 100644 EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
create mode 100644 EXILED/Exiled.Example/Events/Scp173Handler.cs
diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
new file mode 100644
index 000000000..c7661b3ac
--- /dev/null
+++ b/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
@@ -0,0 +1,56 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.Events.EventArgs.Scp173
+{
+ using Exiled.API.Features.Roles;
+ using Exiled.Events.EventArgs.Interfaces;
+
+ ///
+ /// Contains all the information before being observed.
+ ///
+ public class Scp173BeingObservedEventArgs : IScp173Event, IDeniableEvent
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Scp173BeingObservedEventArgs(API.Features.Player target, API.Features.Player scp173, bool isAllowed = true)
+ {
+ Target = target;
+ Player = scp173;
+ Scp173 = scp173.Role.As();
+ IsAllowed = isAllowed;
+ }
+
+ ///
+ /// Gets the player who's observing the Scp 173.
+ ///
+ public API.Features.Player Target { get; }
+
+ ///
+ /// Gets the player who's being observed.
+ ///
+ public API.Features.Player Player { get; }
+
+ ///
+ public Scp173Role Scp173 { get; }
+
+ ///
+ /// Gets or sets a value indicating whether or not the player can be counted as staring.
+ ///
+ public bool IsAllowed { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/EXILED/Exiled.Events/Handlers/Scp173.cs b/EXILED/Exiled.Events/Handlers/Scp173.cs
index bf844714b..bd2eb09e8 100644
--- a/EXILED/Exiled.Events/Handlers/Scp173.cs
+++ b/EXILED/Exiled.Events/Handlers/Scp173.cs
@@ -37,6 +37,11 @@ public static class Scp173
///
public static Event UsingBreakneckSpeeds { get; set; } = new();
+ ///
+ /// Invoked before Scp 173 is observed.
+ ///
+ public static Event Scp173BeingObserved { get; set; } = new();
+
///
/// Called before players near SCP-173 blink.
///
@@ -60,5 +65,11 @@ public static class Scp173
///
/// The instance.
public static void OnUsingBreakneckSpeeds(UsingBreakneckSpeedsEventArgs ev) => UsingBreakneckSpeeds.InvokeSafely(ev);
+
+ ///
+ /// Called before Scp 173 is observed.
+ ///
+ /// The instance.
+ public static void OnScp173BeingObserved(Scp173BeingObservedEventArgs ev) => Scp173BeingObserved.InvokeSafely(ev);
}
}
\ No newline at end of file
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
new file mode 100644
index 000000000..d66add335
--- /dev/null
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
@@ -0,0 +1,77 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.Events.Patches.Events.Scp173
+{
+ using System.Collections.Generic;
+ using System.Reflection.Emit;
+
+ using Exiled.API.Features.Pools;
+ using Exiled.Events.Attributes;
+ using Exiled.Events.EventArgs.Scp173;
+ using HarmonyLib;
+ using PlayerRoles.PlayableScps.Scp173;
+ using PlayerRoles.Subroutines;
+ using PluginAPI.Events;
+
+ using static HarmonyLib.AccessTools;
+
+ ///
+ /// Patches .
+ /// Adds the event.
+ ///
+ [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.Scp173BeingObserved))]
+ [HarmonyPatch(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.IsObservedBy))]
+ internal static class Scp173BeingObserved
+ {
+ private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator)
+ {
+ List newInstructions = ListPool.Pool.Get(instructions);
+
+ Label continueLabel = generator.DefineLabel();
+
+ const int offset = -4;
+ int index = newInstructions.FindIndex(i => i.Is(OpCodes.Call, Field(typeof(EventManager), nameof(EventManager.ExecuteEvent)))) + offset;
+
+ newInstructions.InsertRange(
+ index,
+ new CodeInstruction[]
+ {
+ // Player.Get(target)
+ new(OpCodes.Ldarg_1),
+ new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get))),
+
+ // Player.Get(base.Owner)
+ new(OpCodes.Ldarg_0),
+ new(OpCodes.Call, PropertyGetter(typeof(StandardSubroutine), nameof(StandardSubroutine.Owner))),
+ new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get))),
+
+ // true
+ new(OpCodes.Ldc_I4_1),
+
+ // Scp173BeingObservedEventArgs ev = new(Player, Player, bool)
+ new(OpCodes.Newobj, GetDeclaredConstructors(typeof(Scp173BeingObservedEventArgs))[0]),
+ new(OpCodes.Dup),
+
+ new(OpCodes.Call, Method(typeof(Handlers.Scp173), nameof(Handlers.Scp173.OnScp173BeingObserved))),
+
+ new(OpCodes.Callvirt, PropertyGetter(typeof(Scp173BeingObservedEventArgs), nameof(Scp173BeingObservedEventArgs.IsAllowed))),
+ new(OpCodes.Brtrue, continueLabel),
+
+ new(OpCodes.Ldc_I4_0),
+ new(OpCodes.Ret),
+
+ new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel),
+ });
+
+ for (int z = 0; z < newInstructions.Count; z++)
+ yield return newInstructions[z];
+
+ ListPool.Pool.Return(newInstructions);
+ }
+ }
+}
\ No newline at end of file
diff --git a/EXILED/Exiled.Example/Events/Scp173Handler.cs b/EXILED/Exiled.Example/Events/Scp173Handler.cs
new file mode 100644
index 000000000..36b513293
--- /dev/null
+++ b/EXILED/Exiled.Example/Events/Scp173Handler.cs
@@ -0,0 +1,26 @@
+// -----------------------------------------------------------------------
+//
+// Copyright (c) Exiled Team. All rights reserved.
+// Licensed under the CC BY-SA 3.0 license.
+//
+// -----------------------------------------------------------------------
+
+namespace Exiled.Example.Events
+{
+ using Exiled.API.Features;
+ using Exiled.Events.EventArgs.Scp173;
+
+ ///
+ /// Handles Scp-173 events.
+ ///
+ public class Scp173Handler
+ {
+ /// .
+ public void Scp173BeingObserved(Scp173BeingObservedEventArgs ev)
+ {
+ Log.Info($"Target: {ev.Target.ToString()}");
+ Log.Info($"173: {ev.Player}");
+ ev.IsAllowed = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/EXILED/Exiled.Example/Example.cs b/EXILED/Exiled.Example/Example.cs
index abbb0d7ab..1b8cdb89f 100644
--- a/EXILED/Exiled.Example/Example.cs
+++ b/EXILED/Exiled.Example/Example.cs
@@ -25,6 +25,7 @@ public class Example : Plugin
private ItemHandler itemHandler;
private Scp914Handler scp914Handler;
private Scp096Handler scp096Handler;
+ private Scp173Handler scp173Handler;
private Example()
{
@@ -69,6 +70,7 @@ private void RegisterEvents()
itemHandler = new ItemHandler();
scp914Handler = new Scp914Handler();
scp096Handler = new Scp096Handler();
+ scp173Handler = new Scp173Handler();
Exiled.Events.Handlers.Server.WaitingForPlayers += serverHandler.OnWaitingForPlayers;
Exiled.Events.Handlers.Server.RoundStarted += serverHandler.OnRoundStarted;
@@ -112,6 +114,8 @@ private void RegisterEvents()
Exiled.Events.Handlers.Scp914.UpgradingPickup += scp914Handler.OnUpgradingItem;
Exiled.Events.Handlers.Scp096.AddingTarget += scp096Handler.OnAddingTarget;
+
+ Exiled.Events.Handlers.Scp173.Scp173BeingObserved += scp173Handler.Scp173BeingObserved;
}
///
@@ -153,6 +157,8 @@ private void UnregisterEvents()
Exiled.Events.Handlers.Scp096.AddingTarget -= scp096Handler.OnAddingTarget;
+ Exiled.Events.Handlers.Scp173.Scp173BeingObserved -= scp173Handler.Scp173BeingObserved;
+
serverHandler = null;
playerHandler = null;
warheadHandler = null;
@@ -160,6 +166,7 @@ private void UnregisterEvents()
itemHandler = null;
scp914Handler = null;
scp096Handler = null;
+ scp173Handler = null;
}
}
}
\ No newline at end of file
From 457f90350e077f6305506ee1e8d0ef7332137bdc Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Mon, 19 Aug 2024 22:04:34 +0300
Subject: [PATCH 02/14] comments
---
.../Patches/Events/Scp173/Scp173BeingObserved.cs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
index d66add335..d0325cd6c 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
@@ -57,14 +57,19 @@ private static IEnumerable Transpiler(IEnumerable
Date: Mon, 19 Aug 2024 22:09:57 +0300
Subject: [PATCH 03/14] deleted the example for the event
this is peak
---
EXILED/Exiled.Example/Events/Scp173Handler.cs | 26 -------------------
EXILED/Exiled.Example/Example.cs | 7 -----
2 files changed, 33 deletions(-)
delete mode 100644 EXILED/Exiled.Example/Events/Scp173Handler.cs
diff --git a/EXILED/Exiled.Example/Events/Scp173Handler.cs b/EXILED/Exiled.Example/Events/Scp173Handler.cs
deleted file mode 100644
index 36b513293..000000000
--- a/EXILED/Exiled.Example/Events/Scp173Handler.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-// -----------------------------------------------------------------------
-//
-// Copyright (c) Exiled Team. All rights reserved.
-// Licensed under the CC BY-SA 3.0 license.
-//
-// -----------------------------------------------------------------------
-
-namespace Exiled.Example.Events
-{
- using Exiled.API.Features;
- using Exiled.Events.EventArgs.Scp173;
-
- ///
- /// Handles Scp-173 events.
- ///
- public class Scp173Handler
- {
- /// .
- public void Scp173BeingObserved(Scp173BeingObservedEventArgs ev)
- {
- Log.Info($"Target: {ev.Target.ToString()}");
- Log.Info($"173: {ev.Player}");
- ev.IsAllowed = false;
- }
- }
-}
\ No newline at end of file
diff --git a/EXILED/Exiled.Example/Example.cs b/EXILED/Exiled.Example/Example.cs
index 1b8cdb89f..abbb0d7ab 100644
--- a/EXILED/Exiled.Example/Example.cs
+++ b/EXILED/Exiled.Example/Example.cs
@@ -25,7 +25,6 @@ public class Example : Plugin
private ItemHandler itemHandler;
private Scp914Handler scp914Handler;
private Scp096Handler scp096Handler;
- private Scp173Handler scp173Handler;
private Example()
{
@@ -70,7 +69,6 @@ private void RegisterEvents()
itemHandler = new ItemHandler();
scp914Handler = new Scp914Handler();
scp096Handler = new Scp096Handler();
- scp173Handler = new Scp173Handler();
Exiled.Events.Handlers.Server.WaitingForPlayers += serverHandler.OnWaitingForPlayers;
Exiled.Events.Handlers.Server.RoundStarted += serverHandler.OnRoundStarted;
@@ -114,8 +112,6 @@ private void RegisterEvents()
Exiled.Events.Handlers.Scp914.UpgradingPickup += scp914Handler.OnUpgradingItem;
Exiled.Events.Handlers.Scp096.AddingTarget += scp096Handler.OnAddingTarget;
-
- Exiled.Events.Handlers.Scp173.Scp173BeingObserved += scp173Handler.Scp173BeingObserved;
}
///
@@ -157,8 +153,6 @@ private void UnregisterEvents()
Exiled.Events.Handlers.Scp096.AddingTarget -= scp096Handler.OnAddingTarget;
- Exiled.Events.Handlers.Scp173.Scp173BeingObserved -= scp173Handler.Scp173BeingObserved;
-
serverHandler = null;
playerHandler = null;
warheadHandler = null;
@@ -166,7 +160,6 @@ private void UnregisterEvents()
itemHandler = null;
scp914Handler = null;
scp096Handler = null;
- scp173Handler = null;
}
}
}
\ No newline at end of file
From 72283a70fedd843aaac1450f582a9f2ce6090145 Mon Sep 17 00:00:00 2001
From: 6hundred9 <96420090+6hundred9@users.noreply.github.com>
Date: Mon, 19 Aug 2024 23:10:41 +0300
Subject: [PATCH 04/14] being sleep deprived is doing things to me :pray:
---
.../EventArgs/Scp173/Scp173BeingObservedEventArgs.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
index c7661b3ac..79b75b0b3 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
@@ -49,8 +49,8 @@ public Scp173BeingObservedEventArgs(API.Features.Player target, API.Features.Pla
public Scp173Role Scp173 { get; }
///
- /// Gets or sets a value indicating whether or not the player can be counted as staring.
+ /// Gets or sets a value indicating whether or not the player can be counted as observing.
///
public bool IsAllowed { get; set; }
}
-}
\ No newline at end of file
+}
From ce6c6d23430607493615e62017bd217cdcb32d57 Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 20 Aug 2024 15:36:21 +0300
Subject: [PATCH 05/14] fix
---
.../Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
index d0325cd6c..f88587643 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
@@ -35,7 +35,7 @@ private static IEnumerable Transpiler(IEnumerable i.Is(OpCodes.Call, Field(typeof(EventManager), nameof(EventManager.ExecuteEvent)))) + offset;
+ int index = newInstructions.FindIndex(i => i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent)))) + offset;
newInstructions.InsertRange(
index,
From c76fe121cc088fb11f2f7c500759706330c6623a Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 20 Aug 2024 15:37:28 +0300
Subject: [PATCH 06/14] fix
---
.../Patches/Events/Scp173/Scp173BeingObserved.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
index f88587643..15f994407 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
@@ -43,12 +43,12 @@ private static IEnumerable Transpiler(IEnumerable), nameof(StandardSubroutine.Owner))),
- new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get))),
+ new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })),
// true
new(OpCodes.Ldc_I4_1),
From 8a19fa0f1dd82ffb42ecf65f32e0ce7a1ad293f0 Mon Sep 17 00:00:00 2001
From: 6hundred9 <96420090+6hundred9@users.noreply.github.com>
Date: Wed, 28 Aug 2024 20:25:36 +0300
Subject: [PATCH 07/14] a
---
...eingObservedEventArgs.cs => BeingObservedEventArgs.cs} | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
rename EXILED/Exiled.Events/EventArgs/Scp173/{Scp173BeingObservedEventArgs.cs => BeingObservedEventArgs.cs} (80%)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
similarity index 80%
rename from EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
rename to EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
index 79b75b0b3..6f4ad4863 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp173/Scp173BeingObservedEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
-//
+//
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
//
@@ -13,10 +13,10 @@ namespace Exiled.Events.EventArgs.Scp173
///
/// Contains all the information before being observed.
///
- public class Scp173BeingObservedEventArgs : IScp173Event, IDeniableEvent
+ public class BeingObservedEventArgs : IScp173Event, IDeniableEvent
{
///
- /// Initializes a new instance of the class.
+ /// Initializes a new instance of the class.
///
///
///
@@ -27,7 +27,7 @@ public class Scp173BeingObservedEventArgs : IScp173Event, IDeniableEvent
///
///
///
- public Scp173BeingObservedEventArgs(API.Features.Player target, API.Features.Player scp173, bool isAllowed = true)
+ public BeingObservedEventArgs(API.Features.Player target, API.Features.Player scp173, bool isAllowed = true)
{
Target = target;
Player = scp173;
From a061faab87c8b5123e03f4bb279fe8911553ae9a Mon Sep 17 00:00:00 2001
From: 6hundred9 <96420090+6hundred9@users.noreply.github.com>
Date: Wed, 28 Aug 2024 20:26:27 +0300
Subject: [PATCH 08/14] Update Scp173.cs
---
EXILED/Exiled.Events/Handlers/Scp173.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/EXILED/Exiled.Events/Handlers/Scp173.cs b/EXILED/Exiled.Events/Handlers/Scp173.cs
index bd2eb09e8..5eeac5e1d 100644
--- a/EXILED/Exiled.Events/Handlers/Scp173.cs
+++ b/EXILED/Exiled.Events/Handlers/Scp173.cs
@@ -40,7 +40,7 @@ public static class Scp173
///
/// Invoked before Scp 173 is observed.
///
- public static Event Scp173BeingObserved { get; set; } = new();
+ public static Event BeingObserved { get; set; } = new();
///
/// Called before players near SCP-173 blink.
@@ -69,7 +69,7 @@ public static class Scp173
///
/// Called before Scp 173 is observed.
///
- /// The instance.
- public static void OnScp173BeingObserved(Scp173BeingObservedEventArgs ev) => Scp173BeingObserved.InvokeSafely(ev);
+ /// The instance.
+ public static void OnBeingObserved(BeingObservedEventArgs ev) => BeingObserved.InvokeSafely(ev);
}
-}
\ No newline at end of file
+}
From c1bb53b5702567f128545b236e6ca4c55b890521 Mon Sep 17 00:00:00 2001
From: 6hundred9 <96420090+6hundred9@users.noreply.github.com>
Date: Wed, 28 Aug 2024 20:28:33 +0300
Subject: [PATCH 09/14] Update and rename Scp173BeingObserved.cs to
BeingObserved.cs
---
...Scp173BeingObserved.cs => BeingObserved.cs} | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
rename EXILED/Exiled.Events/Patches/Events/Scp173/{Scp173BeingObserved.cs => BeingObserved.cs} (85%)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
similarity index 85%
rename from EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
rename to EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index 15f994407..a237a3557 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/Scp173BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -22,11 +22,11 @@ namespace Exiled.Events.Patches.Events.Scp173
///
/// Patches .
- /// Adds the event.
+ /// Adds the event.
///
- [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.Scp173BeingObserved))]
+ [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.BeingObserved))]
[HarmonyPatch(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.IsObservedBy))]
- internal static class Scp173BeingObserved
+ internal static class BeingObserved
{
private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator)
{
@@ -53,16 +53,16 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions);
}
}
-}
\ No newline at end of file
+}
From 14ee8e59cd1548e28fed072a6a2e9e1a78f5d1eb Mon Sep 17 00:00:00 2001
From: 6hundred9 <96420090+6hundred9@users.noreply.github.com>
Date: Wed, 28 Aug 2024 20:31:37 +0300
Subject: [PATCH 10/14] build error
---
EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index a237a3557..8486639fc 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
-//
+//
// Copyright (c) Exiled Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
//
From d0d5df9906cafdfe295d67837fb8b63d54bb85e3 Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 3 Sep 2024 18:46:50 +0300
Subject: [PATCH 11/14] Fix
---
.../EventArgs/Scp173/BeingObservedEventArgs.cs | 15 ++++++++-------
EXILED/Exiled.Events/Handlers/Scp173.cs | 2 +-
.../Patches/Events/Scp173/BeingObserved.cs | 4 +++-
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
index 6f4ad4863..2d736b374 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
@@ -7,11 +7,12 @@
namespace Exiled.Events.EventArgs.Scp173
{
+ using Exiled.API.Features;
using Exiled.API.Features.Roles;
using Exiled.Events.EventArgs.Interfaces;
///
- /// Contains all the information before being observed.
+ /// Contains all the information before SCP-173 is observed.
///
public class BeingObservedEventArgs : IScp173Event, IDeniableEvent
{
@@ -19,13 +20,13 @@ public class BeingObservedEventArgs : IScp173Event, IDeniableEvent
/// Initializes a new instance of the class.
///
///
- ///
+ /// The instance of the target.
///
///
- ///
+ /// The instance of the SCP-173.
///
///
- ///
+ /// Whether or not the target will be counted as observing the SCP-173
///
public BeingObservedEventArgs(API.Features.Player target, API.Features.Player scp173, bool isAllowed = true)
{
@@ -36,14 +37,14 @@ public BeingObservedEventArgs(API.Features.Player target, API.Features.Player sc
}
///
- /// Gets the player who's observing the Scp 173.
+ /// Gets the player who's observing the SCP-173.
///
- public API.Features.Player Target { get; }
+ public Player Target { get; }
///
/// Gets the player who's being observed.
///
- public API.Features.Player Player { get; }
+ public Player Player { get; }
///
public Scp173Role Scp173 { get; }
diff --git a/EXILED/Exiled.Events/Handlers/Scp173.cs b/EXILED/Exiled.Events/Handlers/Scp173.cs
index 5eeac5e1d..93e11329b 100644
--- a/EXILED/Exiled.Events/Handlers/Scp173.cs
+++ b/EXILED/Exiled.Events/Handlers/Scp173.cs
@@ -38,7 +38,7 @@ public static class Scp173
public static Event UsingBreakneckSpeeds { get; set; } = new();
///
- /// Invoked before Scp 173 is observed.
+ /// Invoked before SCP-173 is observed.
///
public static Event BeingObserved { get; set; } = new();
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index 8486639fc..cf3e4c7de 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -5,6 +5,8 @@
//
// -----------------------------------------------------------------------
+using System;
+
namespace Exiled.Events.Patches.Events.Scp173
{
using System.Collections.Generic;
@@ -35,7 +37,7 @@ private static IEnumerable Transpiler(IEnumerable i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent)))) + offset;
+ int index = newInstructions.FindIndex(i => i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent), new Type[] { typeof(ReferenceHub), typeof(ReferenceHub) }))) + offset;
newInstructions.InsertRange(
index,
From f18452c03c2892cdfd2d2d67fbe4f84be5bfbb16 Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 3 Sep 2024 18:47:27 +0300
Subject: [PATCH 12/14] Fix of the fix
---
.../Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs | 2 +-
EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
index 2d736b374..15f248e80 100644
--- a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
+++ b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs
@@ -26,7 +26,7 @@ public class BeingObservedEventArgs : IScp173Event, IDeniableEvent
/// The instance of the SCP-173.
///
///
- /// Whether or not the target will be counted as observing the SCP-173
+ /// Whether or not the target will be counted as observing the SCP-173.
///
public BeingObservedEventArgs(API.Features.Player target, API.Features.Player scp173, bool isAllowed = true)
{
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index cf3e4c7de..b7a220167 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -5,10 +5,9 @@
//
// -----------------------------------------------------------------------
-using System;
-
namespace Exiled.Events.Patches.Events.Scp173
{
+ using System;
using System.Collections.Generic;
using System.Reflection.Emit;
From ec51b28b35ed1f5cf9bd38837d9fe8342203619e Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 3 Sep 2024 19:07:01 +0300
Subject: [PATCH 13/14] .
---
EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index b7a220167..bf5517c8e 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -35,7 +35,7 @@ private static IEnumerable Transpiler(IEnumerable i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent), new Type[] { typeof(ReferenceHub), typeof(ReferenceHub) }))) + offset;
newInstructions.InsertRange(
From 97b9b6a50e2991ba8e2ecd6d36fa777e7fc33944 Mon Sep 17 00:00:00 2001
From: 6hundred9 <66hundred99@gmail.com>
Date: Tue, 3 Sep 2024 19:59:02 +0300
Subject: [PATCH 14/14] Hello machine, pls fix code, thx (PS: NO BUGS)
---
EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
index bf5517c8e..d26c97205 100644
--- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
+++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs
@@ -35,8 +35,8 @@ private static IEnumerable Transpiler(IEnumerable i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent), new Type[] { typeof(ReferenceHub), typeof(ReferenceHub) }))) + offset;
+ const int offset = -4;
+ int index = newInstructions.FindIndex(i => i.Is(OpCodes.Call, Method(typeof(EventManager), nameof(EventManager.ExecuteEvent), new Type[] { typeof(IEventArguments) }))) + offset;
newInstructions.InsertRange(
index,