mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-20 01:46:21 +00:00
Fix 2 kill button bugs (#7)
Co-authored-by: js6pak <kubastaron@hotmail.com>
This commit is contained in:
1 parent
e39deea11e
commit
ad25d1f19c
1 file changed
+33
@@ -0,0 +1,33 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace Reactor.Patches
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Fixes kill cooldown resetting for a few frames if anyone on the map got the kill
|
||||||
|
/// Also fixes invisible kill button if KillCooldown is set to 0
|
||||||
|
/// </summary>
|
||||||
|
internal class KillButtonPatches
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.SetKillTimer))]
|
||||||
|
[HarmonyPriority(Priority.First)]
|
||||||
|
public static class SetKillTimerPatch
|
||||||
|
{
|
||||||
|
public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] float time)
|
||||||
|
{
|
||||||
|
__instance.killTimer = time;
|
||||||
|
|
||||||
|
// Patched because of this - game doesn't check if you're the killer
|
||||||
|
if (__instance.AmOwner)
|
||||||
|
{
|
||||||
|
HudManager.Instance.KillButton.SetCoolDown(
|
||||||
|
time,
|
||||||
|
// if MaxTimer is 0, kill button disappears
|
||||||
|
PlayerControl.GameOptions.KillCooldown <= 0 ? 1 : PlayerControl.GameOptions.KillCooldown
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user