diff --git a/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs
new file mode 100644
index 0000000..5c51576
--- /dev/null
+++ b/MiraAPI/Events/Vanilla/Meeting/ReportBodyEvent.cs
@@ -0,0 +1,36 @@
+namespace MiraAPI.Events.Vanilla.Meeting;
+
+///
+/// The event that is invoked when a body is reported.
+/// This is invoked in CmdReportBody.
+///
+public class ReportBodyEvent : MiraCancelableEvent
+{
+ ///
+ /// Gets the player that is reporting the body.
+ ///
+ public PlayerControl Reporter { get; }
+
+ ///
+ /// Gets the player that is being reported. Will be null for emergency meeting.
+ ///
+ public NetworkedPlayerInfo? Target { get; }
+
+ ///
+ /// Gets the body that is being reported. Will be null for emergency meeting.
+ ///
+ public DeadBody? Body { get; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The player who reported the body.
+ /// The player being reported.
+ /// The body being reported.
+ public ReportBodyEvent(PlayerControl reporter, NetworkedPlayerInfo? target, DeadBody? body)
+ {
+ Reporter = reporter;
+ Target = target;
+ Body = body;
+ }
+}
diff --git a/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs b/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs
index b988b2f..78e58f3 100644
--- a/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs
+++ b/MiraAPI/Events/Vanilla/Meeting/StartMeetingEvent.cs
@@ -1,35 +1,22 @@
namespace MiraAPI.Events.Vanilla.Meeting;
///
-/// The event that is invoked when a meeting is called.
+/// The event that is invoked when a meeting is called. This event is not cancelable.
+/// This event is called after Mira resets votes, so if you plan on adding votes to a specific player, do it with this event.
///
-public class StartMeetingEvent : MiraCancelableEvent
+public class StartMeetingEvent : MiraEvent
{
///
- /// Gets the player that is calling the meeting.
+ /// Gets the MeetingHud instance.
///
- public PlayerControl Reporter { get; }
-
- ///
- /// Gets the player that is being reported. Will be null for emergency meeting.
- ///
- public NetworkedPlayerInfo? Target { get; }
-
- ///
- /// Gets the body that is being reported. Will be null for emergency meeting.
- ///
- public DeadBody? Body { get; }
+ public MeetingHud MeetingHud { get; }
///
/// Initializes a new instance of the class.
///
- /// The player who reported the body.
- /// The player being reported.
- /// The body being reported.
- public StartMeetingEvent(PlayerControl reporter, NetworkedPlayerInfo? target, DeadBody? body)
+ /// The MeetingHud instance.
+ public StartMeetingEvent(MeetingHud meetingHud)
{
- Reporter = reporter;
- Target = target;
- Body = body;
+ MeetingHud = meetingHud;
}
}
diff --git a/MiraAPI/Patches/Events/ReportBodyEventPatch.cs b/MiraAPI/Patches/Events/ReportBodyEventPatch.cs
new file mode 100644
index 0000000..1598436
--- /dev/null
+++ b/MiraAPI/Patches/Events/ReportBodyEventPatch.cs
@@ -0,0 +1,19 @@
+using HarmonyLib;
+using MiraAPI.Events;
+using MiraAPI.Events.Vanilla.Meeting;
+using MiraAPI.Utilities;
+
+namespace MiraAPI.Patches.Events;
+
+[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CmdReportDeadBody))]
+public static class ReportBodyEventPatch
+{
+ public static bool Prefix(PlayerControl __instance, NetworkedPlayerInfo? target)
+ {
+ var body = target != null ? Helpers.GetBodyById(target.PlayerId) : null;
+
+ var @event = new ReportBodyEvent(__instance, target, body);
+ MiraEventManager.InvokeEvent(@event);
+ return !@event.IsCancelled;
+ }
+}
diff --git a/MiraAPI/Patches/Events/StartMeetingEventPatch.cs b/MiraAPI/Patches/Events/StartMeetingEventPatch.cs
index 2012b5d..04eea6f 100644
--- a/MiraAPI/Patches/Events/StartMeetingEventPatch.cs
+++ b/MiraAPI/Patches/Events/StartMeetingEventPatch.cs
@@ -1,21 +1,15 @@
using HarmonyLib;
using MiraAPI.Events;
using MiraAPI.Events.Vanilla.Meeting;
-using MiraAPI.Utilities;
namespace MiraAPI.Patches.Events;
-[HarmonyPatch]
+[HarmonyPatch(typeof(MeetingHud), nameof(MeetingHud.Start))]
public static class StartMeetingEventPatch
{
- [HarmonyPrefix]
- [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CmdReportDeadBody))]
- public static bool PlayerControlCmdReportDeadBodyPrefix(PlayerControl __instance, NetworkedPlayerInfo? target)
+ public static void Postfix(MeetingHud __instance)
{
- var body = target != null ? Helpers.GetBodyById(target.PlayerId) : null;
-
- var @event = new StartMeetingEvent(__instance, target, body);
+ var @event = new StartMeetingEvent(__instance);
MiraEventManager.InvokeEvent(@event);
- return !@event.IsCancelled;
}
}