Skip to content

Commit

Permalink
Fix anomaly locators frantically beeping when entering detection rang…
Browse files Browse the repository at this point in the history
…e. (space-wizards#21178)

* reset beep timer when out of range

* prevent deficit from impacting beep timing
  • Loading branch information
TemporalOroboros committed Oct 24, 2023
1 parent 7ef9bac commit 4df2f91
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Content.Server/Pinpointer/ProximityBeeperSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ public void UpdateBeep(EntityUid uid, ProximityBeeperComponent? component = null

var scalingFactor = distance / component.MaximumDistance;
var interval = (component.MaxBeepInterval - component.MinBeepInterval) * scalingFactor + component.MinBeepInterval;

component.NextBeepTime += interval;
if (component.NextBeepTime < _timing.CurTime) // Prevents spending time out of range accumulating a deficit which causes a series of very rapid beeps when comeing into range.
component.NextBeepTime = _timing.CurTime + interval;
}

/// <summary>
Expand Down

0 comments on commit 4df2f91

Please sign in to comment.