Fix toggle subfloor (#8225)
This commit is contained in:
@@ -13,7 +13,8 @@ namespace Content.Client.Atmos.EntitySystems;
|
||||
public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly IResourceCache _resCache = default!;
|
||||
|
||||
[Dependency] private readonly SubFloorHideSystem _subfloorSys = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
@@ -46,15 +47,12 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
|
||||
private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (!TryComp(uid, out SpriteComponent? sprite))
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if (args.Component.TryGetData(SubFloorVisuals.Covered, out bool isUnderCover)
|
||||
&& isUnderCover
|
||||
&& args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool revealed)
|
||||
&& !revealed)
|
||||
if (!args.Sprite.Visible)
|
||||
{
|
||||
// This entity is below a floor and is not even visible to the user -> don't bother updating sprite data.
|
||||
// This entity is probably below a floor and is not even visible to the user -> don't bother updating sprite data.
|
||||
// Note that if the subfloor visuals change, then another AppearanceChangeEvent will get triggered.
|
||||
return;
|
||||
}
|
||||
@@ -70,10 +68,10 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
|
||||
|
||||
foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer)))
|
||||
{
|
||||
if (!sprite.LayerMapTryGet(layerKey, out var key))
|
||||
if (!args.Sprite.LayerMapTryGet(layerKey, out var key))
|
||||
continue;
|
||||
|
||||
var layer = sprite[key];
|
||||
var layer = args.Sprite[key];
|
||||
var dir = (PipeDirection) layerKey;
|
||||
var visible = connectedDirections.HasDirection(dir);
|
||||
|
||||
|
||||
@@ -19,12 +19,9 @@ public sealed partial class CableVisualizerSystem : EntitySystem
|
||||
if (args.Sprite == null)
|
||||
return;
|
||||
|
||||
if (args.Component.TryGetData(SubFloorVisuals.Covered, out bool isUnderCover)
|
||||
&& isUnderCover
|
||||
&& args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool revealed)
|
||||
&& !revealed)
|
||||
if (!args.Sprite.Visible)
|
||||
{
|
||||
// This entity is below a floor and is not even visible to the user -> don't bother updating sprite data.
|
||||
// This entity is probably below a floor and is not even visible to the user -> don't bother updating sprite data.
|
||||
// Note that if the subfloor visuals change, then another AppearanceChangeEvent will get triggered.
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user