Dynamic anomaly scanner texture (#37585)
This commit is contained in:
@@ -22,20 +22,7 @@ public sealed partial class AnomalySystem
|
||||
SubscribeLocalEvent<AnomalyVesselComponent, InteractUsingEvent>(OnVesselInteractUsing);
|
||||
SubscribeLocalEvent<AnomalyVesselComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<AnomalyVesselComponent, ResearchServerGetPointsPerSecondEvent>(OnVesselGetPointsPerSecond);
|
||||
SubscribeLocalEvent<AnomalyShutdownEvent>(OnShutdown);
|
||||
SubscribeLocalEvent<AnomalyStabilityChangedEvent>(OnStabilityChanged);
|
||||
}
|
||||
|
||||
private void OnStabilityChanged(ref AnomalyStabilityChangedEvent args)
|
||||
{
|
||||
OnVesselAnomalyStabilityChanged(ref args);
|
||||
OnScannerAnomalyStabilityChanged(ref args);
|
||||
}
|
||||
|
||||
private void OnShutdown(ref AnomalyShutdownEvent args)
|
||||
{
|
||||
OnVesselAnomalyShutdown(ref args);
|
||||
OnScannerAnomalyShutdown(ref args);
|
||||
SubscribeLocalEvent<AnomalyShutdownEvent>(OnVesselAnomalyShutdown);
|
||||
}
|
||||
|
||||
private void OnExamined(EntityUid uid, AnomalyVesselComponent component, ExaminedEvent args)
|
||||
@@ -141,21 +128,10 @@ public sealed partial class AnomalySystem
|
||||
if (_pointLight.TryGetLight(uid, out var pointLightComponent))
|
||||
_pointLight.SetEnabled(uid, on, pointLightComponent);
|
||||
|
||||
// arbitrary value for the generic visualizer to use.
|
||||
// i didn't feel like making an enum for this.
|
||||
var value = 1;
|
||||
if (TryComp<AnomalyComponent>(component.Anomaly, out var anomalyComp))
|
||||
{
|
||||
if (anomalyComp.Stability <= anomalyComp.DecayThreshold)
|
||||
{
|
||||
value = 2;
|
||||
}
|
||||
else if (anomalyComp.Stability >= anomalyComp.GrowthThreshold)
|
||||
{
|
||||
value = 3;
|
||||
}
|
||||
}
|
||||
Appearance.SetData(uid, AnomalyVesselVisuals.AnomalyState, value, appearanceComponent);
|
||||
if (component.Anomaly == null || !TryGetStabilityVisual(component.Anomaly.Value, out var visual))
|
||||
visual = AnomalyStabilityVisuals.Stable;
|
||||
|
||||
Appearance.SetData(uid, AnomalyVesselVisuals.AnomalySeverity, visual, appearanceComponent);
|
||||
|
||||
_ambient.SetAmbience(uid, on);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user