Client LuaCsForBarotrauma
HealingCooldownClient.cs
1 #nullable enable
2 
3 using System;
4 
5 namespace Barotrauma
6 {
7  internal static class HealingCooldown
8  {
9  public static float NormalizedCooldown => MathF.Min((float) (DateTimeOffset.UtcNow - OnCooldownUntil).TotalSeconds / CooldownDuration, 0f);
10  public static bool IsOnCooldown => DateTimeOffset.UtcNow < OnCooldownUntil;
11 
12  private static DateTimeOffset OnCooldownUntil = DateTimeOffset.MinValue;
13  private const float CooldownDuration = 0.5f;
14 
15  public static void PutOnCooldown()
16  {
17  OnCooldownUntil = DateTimeOffset.UtcNow.AddSeconds(CooldownDuration);
18  }
19  }
20 }