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