Nemanja
2023-01-17 19:38:12 -05:00
committed by GitHub
parent 2c1c1c45c3
commit 4d57226335
11 changed files with 28 additions and 25 deletions

View File

@@ -91,6 +91,7 @@ public abstract class SharedAnomalySystem : EntitySystem
if (!Resolve(uid, ref component))
return;
DebugTools.Assert(component.MinPulseLength > TimeSpan.FromSeconds(3)); // this is just to prevent lagspikes mispredicting pulses
var variation = Random.NextFloat(-component.PulseVariation, component.PulseVariation) + 1;
component.NextPulseTime = Timing.CurTime + GetPulseLength(component) * variation;
@@ -107,7 +108,8 @@ public abstract class SharedAnomalySystem : EntitySystem
}
Log.Add(LogType.Anomaly, LogImpact.Medium, $"Anomaly {ToPrettyString(uid)} pulsed with severity {component.Severity}.");
Audio.PlayPvs(component.PulseSound, uid);
if (_net.IsServer)
Audio.PlayPvs(component.PulseSound, uid);
var pulse = EnsureComp<AnomalyPulsingComponent>(uid);
pulse.EndTime = Timing.CurTime + pulse.PulseDuration;