diff --git a/Directory.Build.props b/Directory.Build.props index f53e715..4b87d91 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -8,7 +8,7 @@ true - 0.3.7 + 0.3.8 dev All Of Us, XtraCube, Angxl diff --git a/MiraAPI/Networking/CustomMurderRpc.cs b/MiraAPI/Networking/CustomMurderRpc.cs index 329b7dd..7629ebc 100644 --- a/MiraAPI/Networking/CustomMurderRpc.cs +++ b/MiraAPI/Networking/CustomMurderRpc.cs @@ -77,6 +77,10 @@ public static class CustomMurderRpc bool showKillAnim = true, bool playKillSound = true) { + if (LobbyBehaviour.Instance) + { + return; + } var murderResultFlags = didSucceed ? MurderResultFlags.Succeeded : MurderResultFlags.FailedError; var beforeMurderEvent = new BeforeMurderEvent(source, target, inMeeting); @@ -126,7 +130,7 @@ public static class CustomMurderRpc bool playKillSound = true) { source.isKilling = false; - if (resultFlags.HasFlag(MurderResultFlags.FailedError)) + if (resultFlags.HasFlag(MurderResultFlags.FailedError) || LobbyBehaviour.Instance) { return; } @@ -249,6 +253,10 @@ public static class CustomMurderRpc bool createDeadBody = true, bool teleportMurderer = true) { + if (LobbyBehaviour.Instance) + { + yield break; + } var cam = Camera.main?.GetComponent(); var isParticipant = source.AmOwner || target.AmOwner; var sourcePhys = source.MyPhysics; diff --git a/MiraAPI/Patches/PlayerControlPatches.cs b/MiraAPI/Patches/PlayerControlPatches.cs index 659c52f..946b6f2 100644 --- a/MiraAPI/Patches/PlayerControlPatches.cs +++ b/MiraAPI/Patches/PlayerControlPatches.cs @@ -117,6 +117,20 @@ internal static class PlayerControlPatches __instance.RpcMurderPlayer(target, true); } + [HarmonyPrefix] + [HarmonyPatch(nameof(PlayerControl.RpcMurderPlayer))] + [HarmonyPatch(nameof(PlayerControl.MurderPlayer))] + // ReSharper disable once InconsistentNaming + public static bool MurderPlayerPrefix(PlayerControl __instance) + { + if (LobbyBehaviour.Instance) + { + return false; + } + + return true; + } + [HarmonyPostfix] [HarmonyPatch(nameof(PlayerControl.FixedUpdate))] // ReSharper disable once InconsistentNaming