From 80a0a9060e68009af69a1ebf1e78ead7a216ed47 Mon Sep 17 00:00:00 2001 From: gendelo3 Date: Sat, 11 Sep 2021 11:45:09 +0200 Subject: [PATCH] Show an orange flash to the killer of the bait, can be turned of in settings --- TheOtherRoles/CustomOptions.cs | 2 ++ TheOtherRoles/Patches/PlayerControlPatch.cs | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/TheOtherRoles/CustomOptions.cs b/TheOtherRoles/CustomOptions.cs index e63afc0b3..041f7ef90 100644 --- a/TheOtherRoles/CustomOptions.cs +++ b/TheOtherRoles/CustomOptions.cs @@ -165,6 +165,7 @@ public class CustomOptionHolder { public static CustomOption baitSpawnRate; public static CustomOption baitHighlightAllVents; public static CustomOption baitReportDelay; + public static CustomOption baitShowKillFlash; public static CustomOption maxNumberOfMeetings; public static CustomOption blockSkippingInEmergencyMeetings; @@ -339,6 +340,7 @@ public static void Load() { baitSpawnRate = CustomOption.Create(330, cs(Bait.color, "Bait"), rates, null, true); baitHighlightAllVents = CustomOption.Create(331, "Highlight All Vents If A Vent Is Occupied", false, baitSpawnRate); baitReportDelay = CustomOption.Create(332, "Bait Report Delay", 0f, 0f, 10f, 1f, baitSpawnRate); + baitShowKillFlash = CustomOption.Create(335, "Show Flash to Baits Killer", true, baitSpawnRate); // Other options maxNumberOfMeetings = CustomOption.Create(3, "Number Of Meetings (excluding Mayor meeting)", 10, 0, 15, 1, null, true); diff --git a/TheOtherRoles/Patches/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs index 96f07872a..bfc7e6f09 100644 --- a/TheOtherRoles/Patches/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -790,6 +790,26 @@ public static void Postfix(PlayerControl __instance, [HarmonyArgument(0)]PlayerC else BountyHunter.bountyHunter.SetKillTimer(PlayerControl.GameOptions.KillCooldown + BountyHunter.punishmentTime); } + + // Show flash on bait kill to the killer if enabled + if (Bait.bait != null && PlayerControl.LocalPlayer == deadPlayer.killerIfExisting && target == Bait.bait + && CustomOptionHolder.baitShowKillFlash.getBool() && __instance == PlayerControl.LocalPlayer) { + HudManager.Instance.FullScreen.enabled = true; + HudManager.Instance.StartCoroutine(Effects.Lerp(1f, new Action((p) => { + var renderer = HudManager.Instance.FullScreen; + if (p < 0.5) + { + if (renderer != null) + renderer.color = new Color(204f / 255f, 102f / 255f, 0f / 255f, Mathf.Clamp01(p * 2 * 0.75f)); + } + else + { + if (renderer != null) + renderer.color = new Color(204f / 255f, 102f / 255f, 0f / 255f, Mathf.Clamp01((1 - p) * 2 * 0.75f)); + } + if (p == 1f && renderer != null) renderer.enabled = false; + }))); + } } }