Dynamic anomaly scanner texture (#37585)

This commit is contained in:
Quantum-cross
2025-09-04 15:11:03 -04:00
committed by GitHub
parent 12e8697648
commit 52c903cab8
25 changed files with 720 additions and 289 deletions

View File

@@ -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);
}