Skip to content

Commit

Permalink
Merge pull request #222 from gendelo3/bait_show_kill_flash
Browse files Browse the repository at this point in the history
Show an orange flash to the killer of the bait, can be turned off in settings.
  • Loading branch information
Eisbison authored Dec 1, 2021
2 parents 23688a7 + 5a75350 commit b184098
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions TheOtherRoles/CustomOptionHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ public class CustomOptionHolder {
public static CustomOption baitSpawnRate;
public static CustomOption baitHighlightAllVents;
public static CustomOption baitReportDelay;
public static CustomOption baitShowKillFlash;

public static CustomOption vultureSpawnRate;
public static CustomOption vultureCooldown;
Expand Down Expand Up @@ -412,6 +413,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);

mediumSpawnRate = CustomOption.Create(360, cs(Medium.color, "Medium"), rates, null, true);
mediumCooldown = CustomOption.Create(361, "Medium Questioning Cooldown", 30f, 5f, 120f, 5f, mediumSpawnRate);
Expand Down
20 changes: 20 additions & 0 deletions TheOtherRoles/Patches/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,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<float>((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;
})));
}
}
}

Expand Down

0 comments on commit b184098

Please sign in to comment.