if (!NetEntity.TryParse(args[0], out var uidNet) || !TryGetEntity(uidNet, out var uid))
return;
- if (!HasComp<AnomalyComponent>(uid))
+ if (!TryComp<AnomalyComponent>(uid, out var anomaly))
return;
- StartSupercriticalEvent(uid.Value);
+ StartSupercriticalEvent((uid.Value, anomaly));
}
private CompletionResult GetAnomalyCompletion(IConsoleShell shell, string[] args)
/// <summary>
/// Begins the animation for going supercritical
/// </summary>
- /// <param name="uid"></param>
- public void StartSupercriticalEvent(EntityUid uid)
+ /// <param name="ent">Entity to go supercritical</param>
+ public void StartSupercriticalEvent(Entity<AnomalyComponent?> ent)
{
// don't restart it if it's already begun
- if (HasComp<AnomalySupercriticalComponent>(uid))
+ if (HasComp<AnomalySupercriticalComponent>(ent))
+ return;
+
+ if(!Resolve(ent, ref ent.Comp))
return;
- AdminLog.Add(LogType.Anomaly, LogImpact.High, $"Anomaly {ToPrettyString(uid)} began to go supercritical.");
+ AdminLog.Add(LogType.Anomaly, LogImpact.High, $"Anomaly {ToPrettyString(ent.Owner)} began to go supercritical.");
if (_net.IsServer)
- Log.Info($"Anomaly is going supercritical. Entity: {ToPrettyString(uid)}");
+ Log.Info($"Anomaly is going supercritical. Entity: {ToPrettyString(ent.Owner)}");
+
+ Audio.PlayPvs(ent.Comp.SupercriticalSoundAtAnimationStart, Transform(ent).Coordinates);
- var super = AddComp<AnomalySupercriticalComponent>(uid);
+ var super = AddComp<AnomalySupercriticalComponent>(ent);
super.EndTime = Timing.CurTime + super.SupercriticalDuration;
- Appearance.SetData(uid, AnomalyVisuals.Supercritical, true);
- Dirty(uid, super);
+ Appearance.SetData(ent, AnomalyVisuals.Supercritical, true);
+ Dirty(ent, super);
}
/// <summary>
var newVal = component.Severity + change;
if (newVal >= 1)
- StartSupercriticalEvent(uid);
+ StartSupercriticalEvent((uid, component));
component.Severity = Math.Clamp(newVal, 0, 1);
Dirty(uid, component);