diff --git a/MiraAPI/Events/Vanilla/ReportDeadBodyEvent.cs b/MiraAPI/Events/Vanilla/StartMeetingEvent.cs similarity index 51% rename from MiraAPI/Events/Vanilla/ReportDeadBodyEvent.cs rename to MiraAPI/Events/Vanilla/StartMeetingEvent.cs index c5c0648..2e3d8c2 100644 --- a/MiraAPI/Events/Vanilla/ReportDeadBodyEvent.cs +++ b/MiraAPI/Events/Vanilla/StartMeetingEvent.cs @@ -1,32 +1,32 @@ namespace MiraAPI.Events.Vanilla; /// -/// The event that is invoked when a player reports a dead body. +/// The event that is invoked when a meeting is called /// -public class ReportDeadBodyEvent : MiraCancelableEvent +public class StartMeetingEvent : MiraCancelableEvent { /// - /// Gets the player that is reporting the body. + /// Gets the player that is calling the meeting. /// public PlayerControl Reporter { get; } /// - /// Gets the player that is being reported. + /// Gets the player that is being reported. Will be null for emergency meeting. /// - public NetworkedPlayerInfo Target { get; } + public NetworkedPlayerInfo? Target { get; } /// - /// Gets the body that is being reported. + /// Gets the body that is being reported. Will be null for emergency meeting. /// public DeadBody? Body { get; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who reported the body. /// The player being reported. /// The body being reported. - public ReportDeadBodyEvent(PlayerControl reporter, NetworkedPlayerInfo target, DeadBody? body) + public StartMeetingEvent(PlayerControl reporter, NetworkedPlayerInfo? target, DeadBody? body) { Reporter = reporter; Target = target; diff --git a/MiraAPI/Patches/Events/ReportDeadBodyEventPatch.cs b/MiraAPI/Patches/Events/StartMeetingEventPatch.cs similarity index 62% rename from MiraAPI/Patches/Events/ReportDeadBodyEventPatch.cs rename to MiraAPI/Patches/Events/StartMeetingEventPatch.cs index 8e53eab..f818363 100644 --- a/MiraAPI/Patches/Events/ReportDeadBodyEventPatch.cs +++ b/MiraAPI/Patches/Events/StartMeetingEventPatch.cs @@ -6,14 +6,14 @@ using MiraAPI.Utilities; namespace MiraAPI.Patches.Events; [HarmonyPatch] -public static class ReportDeadBodyEventPatch +public static class StartMeetingEventPatch { [HarmonyPrefix] [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.ReportDeadBody))] - public static bool PlayerControlReportDeadBodyPrefix(PlayerControl __instance, NetworkedPlayerInfo target) + public static bool PlayerControlReportDeadBodyPrefix(PlayerControl __instance, NetworkedPlayerInfo? target) { - var body = Helpers.GetBodyById(target.PlayerId); - var @event = new ReportDeadBodyEvent(__instance, target, body); + var body = target != null ? Helpers.GetBodyById(target.PlayerId) : null; + var @event = new StartMeetingEvent(__instance, target, body); MiraEventManager.InvokeEvent(@event); return !@event.IsCancelled; }