From 97528b4380a574371a38b1a8e4ca928c25a64661 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Mon, 19 Jan 2026 19:31:31 -0600 Subject: [PATCH] Add alternative Murder RPC for meeting checks --- .../Vanilla/Gameplay/BeforeMurderEvent.cs | 19 +++++++ MiraAPI/MiraApiSettings.cs | 2 +- MiraAPI/Networking/CustomMurderRpc.cs | 51 +++++++++++++++++++ MiraAPI/Networking/MiraRpc.cs | 5 ++ 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs b/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs index 82694f7..42d816d 100644 --- a/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs +++ b/MiraAPI/Events/Vanilla/Gameplay/BeforeMurderEvent.cs @@ -15,6 +15,24 @@ public sealed class BeforeMurderEvent : MiraCancelableEvent /// public PlayerControl Target { get; } + /// + /// Gets whether the murder was meant to be done in a meeting. + /// + public bool? InMeeting { get; } + + /// + /// Initializes a new instance of the class. + /// + /// The player that is killing the target. + /// The player that is being killed. + /// Whether the murder is intended to be triggered in a meeting. + public BeforeMurderEvent(PlayerControl source, PlayerControl target, bool inMeeting) + { + Source = source; + Target = target; + InMeeting = inMeeting; + } + /// /// Initializes a new instance of the class. /// @@ -24,5 +42,6 @@ public sealed class BeforeMurderEvent : MiraCancelableEvent { Source = source; Target = target; + InMeeting = null; } } diff --git a/MiraAPI/MiraApiSettings.cs b/MiraAPI/MiraApiSettings.cs index 0898eed..a2a8d86 100644 --- a/MiraAPI/MiraApiSettings.cs +++ b/MiraAPI/MiraApiSettings.cs @@ -79,7 +79,7 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config) /// [LocalSliderSetting(min: 60f, max: 240f, suffixType: MiraNumberSuffixes.None, formatString: "0", displayValue: true, roundValue: true)] public ConfigEntry SetFpsSlider { get; private set; } = - config.Bind("Visuals/UI", "Frames Per Seconds", 120f); + config.Bind("Visuals/UI", "Target Framerate", 120f); /// /// Gets whether to apply cosmetic changes to the TaskAdder. diff --git a/MiraAPI/Networking/CustomMurderRpc.cs b/MiraAPI/Networking/CustomMurderRpc.cs index 710791a..8022b7e 100644 --- a/MiraAPI/Networking/CustomMurderRpc.cs +++ b/MiraAPI/Networking/CustomMurderRpc.cs @@ -65,6 +65,57 @@ public static class CustomMurderRpc playKillSound); } + /// + /// Networked Custom Murder method, which checks for meetings as well. + /// + /// The killer. + /// The player to murder. + /// Whether the murder is intended to be triggered in a meeting. + /// Whether the murder was successful or not. + /// Should the kill timer be reset. + /// Should a dead body be created. + /// Should the killer be snapped to the dead player. + /// Should the kill animation be shown. + /// Should the kill sound be played. + [MethodRpc((uint)MiraRpc.AltCustomMurder, LocalHandling = RpcLocalHandling.Before)] + public static void RpcAltCustomMurder( + this PlayerControl source, + PlayerControl target, + bool inMeeting, + bool didSucceed = true, + bool resetKillTimer = true, + bool createDeadBody = true, + bool teleportMurderer = true, + bool showKillAnim = true, + bool playKillSound = true) + { + var murderResultFlags = didSucceed ? MurderResultFlags.Succeeded : MurderResultFlags.FailedError; + + var beforeMurderEvent = new BeforeMurderEvent(source, target, inMeeting); + MiraEventManager.InvokeEvent(beforeMurderEvent); + var isMeetingActive = MeetingHud.Instance != null || ExileController.Instance != null; + if ((inMeeting && !isMeetingActive) || (!inMeeting && isMeetingActive)) + { + beforeMurderEvent.Cancel(); + } + + if (beforeMurderEvent.IsCancelled) + { + murderResultFlags = MurderResultFlags.FailedError; + } + + var murderResultFlags2 = MurderResultFlags.DecisionByHost | murderResultFlags; + + source.CustomMurder( + target, + murderResultFlags2, + resetKillTimer, + createDeadBody, + teleportMurderer, + showKillAnim, + playKillSound); + } + /// /// Custom Murder method without networking. If you need a networked version, use . /// diff --git a/MiraAPI/Networking/MiraRpc.cs b/MiraAPI/Networking/MiraRpc.cs index 28c6c7a..5317565 100644 --- a/MiraAPI/Networking/MiraRpc.cs +++ b/MiraAPI/Networking/MiraRpc.cs @@ -35,6 +35,11 @@ public enum MiraRpc : uint /// CustomMurder, + /// + /// Alternate Custom Murder RPC. + /// + AltCustomMurder, + /// /// Custom Game Over RPC. ///