diff --git a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs new file mode 100644 index 0000000000..38076ef5a6 --- /dev/null +++ b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -0,0 +1,83 @@ +using Content.Client.SubFloor; +using Content.Shared.Atmos; +using Content.Shared.Atmos.Components; +using Content.Shared.Atmos.Piping; +using JetBrains.Annotations; +using Robust.Client.GameObjects; +using Robust.Client.ResourceManagement; + +namespace Content.Client.Atmos.EntitySystems; + +[UsedImplicitly] +public sealed class AtmosPipeAppearanceSystem : EntitySystem +{ + [Dependency] private readonly IResourceCache _resCache = default!; + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnInit); + SubscribeLocalEvent(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) }); + } + + private void OnInit(EntityUid uid, PipeAppearanceComponent component, ComponentInit args) + { + if (!TryComp(uid, out SpriteComponent? sprite)) + return; + + if (!_resCache.TryGetResource(SharedSpriteComponent.TextureRoot / component.RsiPath, out RSIResource? rsi)) + { + Logger.Error($"{nameof(AtmosPipeAppearanceSystem)} could not load to load RSI {component.RsiPath}."); + return; + } + + foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer))) + { + sprite.LayerMapReserveBlank(layerKey); + var layer = sprite.LayerMapGet(layerKey); + sprite.LayerSetRSI(layer, rsi.RSI); + var layerState = component.BaseState + (PipeDirection) layerKey; + sprite.LayerSetState(layer, layerState); + } + } + + private void OnAppearanceChanged(EntityUid uid, PipeAppearanceComponent component, ref AppearanceChangeEvent args) + { + if (!TryComp(uid, out SpriteComponent? sprite)) + return; + + if (!args.Component.TryGetData(PipeColorVisuals.Color, out Color color)) + color = Color.White; + + if (!args.Component.TryGetData(PipeVisuals.VisualState, out PipeDirection connectedDirections)) + return; + + var rotation = Transform(uid).LocalRotation; + + foreach (PipeConnectionLayer layerKey in Enum.GetValues(typeof(PipeConnectionLayer))) + { + if (!sprite.LayerMapTryGet(layerKey, out var key)) + continue; + + var layer = sprite[key]; + var dir = (PipeDirection) layerKey; + var visible = connectedDirections.HasDirection(dir); + + layer.Visible &= visible; + + if (!visible) continue; + + layer.Rotation = -rotation; + layer.Color = color; + } + } + + private enum PipeConnectionLayer : byte + { + NorthConnection = PipeDirection.North, + SouthConnection = PipeDirection.South, + EastConnection = PipeDirection.East, + WestConnection = PipeDirection.West, + } +} diff --git a/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs b/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs index d3da329cc0..7434317b88 100644 --- a/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs +++ b/Content.Client/Atmos/Visualizers/PipeColorVisualizer.cs @@ -1,14 +1,11 @@ using Content.Shared.Atmos.Piping; using JetBrains.Annotations; using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Maths; namespace Content.Client.Atmos.Visualizers { [UsedImplicitly] - public class PipeColorVisualizer : AppearanceVisualizer + public sealed class PipeColorVisualizer : AppearanceVisualizer { public override void OnChangeData(AppearanceComponent component) { @@ -19,7 +16,9 @@ namespace Content.Client.Atmos.Visualizers if (component.TryGetData(PipeColorVisuals.Color, out Color color)) { - sprite.LayerSetColor(Layers.Pipe, color); + // T-ray scanner / sub floor runs after this visualizer. Lets not bulldoze transparency. + var layer = sprite[Layers.Pipe]; + layer.Color = color.WithAlpha(layer.Color.A); } } diff --git a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs b/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs deleted file mode 100644 index 2aa0a523ab..0000000000 --- a/Content.Client/Atmos/Visualizers/PipeConnectorVisualizer.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using Content.Shared.Atmos; -using Content.Shared.Atmos.Piping; -using Content.Shared.SubFloor; -using JetBrains.Annotations; -using Robust.Client.GameObjects; -using Robust.Client.Graphics; -using Robust.Client.ResourceManagement; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Log; -using Robust.Shared.Maths; -using Robust.Shared.Serialization; -using Robust.Shared.Serialization.Manager.Attributes; - -namespace Content.Client.Atmos.Visualizers -{ - [UsedImplicitly] - public class PipeConnectorVisualizer : AppearanceVisualizer, ISerializationHooks - { - [DataField("rsi")] - private string _rsi = "Structures/Piping/Atmospherics/pipe.rsi"; - - [DataField("baseState")] - private string _baseState = "pipeConnector"; - - private RSI? _connectorRsi; - - void ISerializationHooks.AfterDeserialization() - { - var rsiString = SharedSpriteComponent.TextureRoot / _rsi; - var resourceCache = IoCManager.Resolve(); - - if (resourceCache.TryGetResource(rsiString, out RSIResource? rsi)) - _connectorRsi = rsi.RSI; - else - Logger.Error($"{nameof(PipeConnectorVisualizer)} could not load to load RSI {rsiString}."); - } - - public override void InitializeEntity(EntityUid entity) - { - base.InitializeEntity(entity); - - var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(entity, out var sprite)) - return; - - if (_connectorRsi == null) - return; - - foreach (Layer layerKey in Enum.GetValues(typeof(Layer))) - { - sprite.LayerMapReserveBlank(layerKey); - var layer = sprite.LayerMapGet(layerKey); - sprite.LayerSetRSI(layer, _connectorRsi); - var layerState = _baseState + ((PipeDirection) layerKey); - sprite.LayerSetState(layer, layerState); - } - } - - public override void OnChangeData(AppearanceComponent component) - { - base.OnChangeData(component); - - var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out var xform)) - return; - - if (!entities.TryGetComponent(component.Owner, out var sprite)) - return; - - if (!component.TryGetData(PipeColorVisuals.Color, out Color color)) - color = Color.White; - - if (!component.TryGetData(PipeVisuals.VisualState, out PipeDirection connectedDirections)) - return; - - if(!component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor)) - subfloor = true; - - var rotation = xform.LocalRotation; - - foreach (Layer layerKey in Enum.GetValues(typeof(Layer))) - { - var layer = sprite.LayerMapGet(layerKey); - var dir = (PipeDirection) layerKey; - var visible = subfloor && connectedDirections.HasDirection(dir); - sprite.LayerSetVisible(layer, visible); - - if (!visible) continue; - - sprite.LayerSetRotation(layer, -rotation); - sprite.LayerSetColor(layer, color); - } - } - - private enum Layer : byte - { - NorthConnection = PipeDirection.North, - SouthConnection = PipeDirection.South, - EastConnection = PipeDirection.East, - WestConnection = PipeDirection.West, - } - } -} diff --git a/Content.Client/Commands/DebugCommands.cs b/Content.Client/Commands/DebugCommands.cs index 0562447586..32ff1cf0f7 100644 --- a/Content.Client/Commands/DebugCommands.cs +++ b/Content.Client/Commands/DebugCommands.cs @@ -1,11 +1,9 @@ -using System; using Content.Client.Markers; using Content.Client.Popups; +using Content.Client.SubFloor; using Content.Shared.SubFloor; using Robust.Client.GameObjects; using Robust.Shared.Console; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; using DrawDepth = Content.Shared.DrawDepth.DrawDepth; namespace Content.Client.Commands @@ -33,8 +31,7 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get() - .ShowAll ^= true; + EntitySystem.Get().ShowAll ^= true; } } @@ -47,8 +44,7 @@ namespace Content.Client.Commands public void Execute(IConsoleShell shell, string argStr, string[] args) { - EntitySystem.Get() - .ShowAll = true; + EntitySystem.Get().ShowAll = true; var entMan = IoCManager.Resolve(); var components = entMan.EntityQuery(true); diff --git a/Content.Client/Sandbox/SandboxManager.cs b/Content.Client/Sandbox/SandboxManager.cs index 003c4ed12c..fcc705d27a 100644 --- a/Content.Client/Sandbox/SandboxManager.cs +++ b/Content.Client/Sandbox/SandboxManager.cs @@ -2,6 +2,7 @@ using System; using Content.Client.Decals.UI; using Content.Client.HUD; using Content.Client.Markers; +using Content.Client.SubFloor; using Content.Shared.Input; using Content.Shared.Sandbox; using Content.Shared.SubFloor; diff --git a/Content.Client/SubFloor/SubFloorHideSystem.cs b/Content.Client/SubFloor/SubFloorHideSystem.cs new file mode 100644 index 0000000000..066403adff --- /dev/null +++ b/Content.Client/SubFloor/SubFloorHideSystem.cs @@ -0,0 +1,80 @@ +using Content.Shared.SubFloor; +using Robust.Client.GameObjects; + +namespace Content.Client.SubFloor; + +public sealed class SubFloorHideSystem : SharedSubFloorHideSystem +{ + [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; + + private bool _showAll; + + [ViewVariables(VVAccess.ReadWrite)] + public bool ShowAll + { + get => _showAll; + set + { + if (_showAll == value) return; + _showAll = value; + + UpdateAll(); + } + } + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnAppearanceChanged); + } + + private void OnAppearanceChanged(EntityUid uid, SubFloorHideComponent component, ref AppearanceChangeEvent args) + { + if (!TryComp(uid, out SpriteComponent? sprite)) + return; + + args.Component.TryGetData(SubFloorVisuals.Covered, out bool covered); + args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool scannerRevealed); + + scannerRevealed &= !ShowAll; // no transparency for show-subfloor mode. + + var revealed = !covered || ShowAll || scannerRevealed; + var transparency = scannerRevealed ? component.ScannerTransparency : 1f; + + // set visibility & color of each layer + foreach (var layer in sprite.AllLayers) + { + // pipe connection visuals are updated AFTER this, and may re-hide some layers + layer.Visible = revealed; + + if (layer.Visible) + layer.Color = layer.Color.WithAlpha(transparency); + } + + // Is there some layer that is always visible? + if (sprite.LayerMapTryGet(SubfloorLayers.FirstLayer, out var firstLayer)) + { + var layer = sprite[firstLayer]; + layer.Visible = true; + layer.Color = layer.Color.WithAlpha(1f); + sprite.Visible = true; + return; + } + + sprite.Visible = revealed; + } + + private void UpdateAll() + { + foreach (var (_, appearance) in EntityManager.EntityQuery(true)) + { + _appearanceSystem.MarkDirty(appearance); + } + } +} + +public enum SubfloorLayers : byte +{ + FirstLayer, // always visible. E.g. vent part of a vent.. +} diff --git a/Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs b/Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs deleted file mode 100644 index aec3c9e32c..0000000000 --- a/Content.Client/SubFloor/SubFloorShowLayerVisualizer.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Content.Shared.SubFloor; -using JetBrains.Annotations; -using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; - -namespace Content.Client.SubFloor -{ - [UsedImplicitly] - public class SubFloorShowLayerVisualizer : AppearanceVisualizer - { - public override void OnChangeData(AppearanceComponent component) - { - base.OnChangeData(component); - - var entities = IoCManager.Resolve(); - if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite)) - return; - - if (!component.TryGetData(SubFloorVisuals.SubFloor, out bool subfloor)) - return; - - foreach (var layer in sprite.AllLayers) - { - layer.Visible = subfloor; - } - - if (!sprite.LayerMapTryGet(Layers.FirstLayer, out var firstLayer)) - { - sprite.Visible = subfloor; - return; - } - - // show the top part of the sprite. E.g. the grille-part of a vent, but not the connecting pipes. - sprite.LayerSetVisible(firstLayer, true); - sprite.Visible = true; - } - - public enum Layers : byte - { - FirstLayer, - } - } -} diff --git a/Content.Client/SubFloor/TrayScannerSubFloorVisualizer.cs b/Content.Client/SubFloor/TrayScannerSubFloorVisualizer.cs deleted file mode 100644 index f4d2a9c124..0000000000 --- a/Content.Client/SubFloor/TrayScannerSubFloorVisualizer.cs +++ /dev/null @@ -1,45 +0,0 @@ -using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; -using Robust.Shared.Maths; - -namespace Content.Client.SubFloor; - -public class TrayScannerSubFloorVisualizer : AppearanceVisualizer -{ - [Dependency] IEntityManager _entityManager = default!; - - public override void InitializeEntity(EntityUid uid) - { - base.InitializeEntity(uid); - - IoCManager.InjectDependencies(this); - } - - public override void OnChangeData(AppearanceComponent component) - { - base.OnChangeData(component); - - if (!_entityManager.TryGetComponent(component.Owner, out SpriteComponent? sprite)) - return; - - if (!component.TryGetData(TrayScannerTransparency.Key, out bool transparent)) - return; - - foreach (var layer in sprite.AllLayers) - { - var transparency = transparent == true ? 0.8f : 1f; - layer.Color = layer.Color.WithAlpha(transparency); - } - - if (sprite.LayerMapTryGet(SubFloorShowLayerVisualizer.Layers.FirstLayer, out var firstLayer)) - { - sprite.LayerSetColor(firstLayer, Color.White); - } - } -} - -public enum TrayScannerTransparency -{ - Key, -} diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeNodeAppearanceSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs similarity index 74% rename from Content.Server/Atmos/Piping/EntitySystems/AtmosPipeNodeAppearanceSystem.cs rename to Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs index fc1f27218e..7ac264c618 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeNodeAppearanceSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -2,14 +2,12 @@ using Content.Server.NodeContainer; using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos; -using Robust.Shared.GameObjects; -using Robust.Shared.IoC; +using Content.Shared.Atmos.Components; using Robust.Shared.Map; -using System.Collections.Generic; namespace Content.Server.Atmos.Piping.EntitySystems; -public sealed class AtmosPipeNodeAppearanceSystem : EntitySystem +public sealed class AtmosPipeAppearanceSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; @@ -17,17 +15,12 @@ public sealed class AtmosPipeNodeAppearanceSystem : EntitySystem { base.Initialize(); - // This should probably just be a directed event, but that would require a weird component that exists only to - // receive directed events (*cough* *cough* CableVisComponent *cough*). - // - // Really I want to target any entity with a PipeConnectorVisualizer or a NodeContainerComponent that contains a - // pipe-node. But I don't know of nice way of doing that. - SubscribeLocalEvent(OnNodeUpdate); + SubscribeLocalEvent(OnNodeUpdate); } - private void OnNodeUpdate(ref NodeGroupsRebuilt ev) + private void OnNodeUpdate(EntityUid uid, PipeAppearanceComponent component, ref NodeGroupsRebuilt args) { - UpdateAppearance(ev.NodeOwner); + UpdateAppearance(args.NodeOwner); } private void UpdateAppearance(EntityUid uid, AppearanceComponent? appearance = null, NodeContainerComponent? container = null, diff --git a/Content.Server/SubFloor/SubFloorHideSystem.cs b/Content.Server/SubFloor/SubFloorHideSystem.cs new file mode 100644 index 0000000000..1caaacb2ab --- /dev/null +++ b/Content.Server/SubFloor/SubFloorHideSystem.cs @@ -0,0 +1,7 @@ +using Content.Shared.SubFloor; + +namespace Content.Server.SubFloor; + +public sealed class SubFloorHideSystem : SharedSubFloorHideSystem +{ +} diff --git a/Content.Server/SubFloor/TrayScannerSystem.cs b/Content.Server/SubFloor/TrayScannerSystem.cs deleted file mode 100644 index a67c7122ce..0000000000 --- a/Content.Server/SubFloor/TrayScannerSystem.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Content.Shared.SubFloor; - -namespace Content.Server.SubFloor; - -public sealed class TrayScannerSystem : SharedTrayScannerSystem -{ - public override void Initialize() - { - base.Initialize(); - } -} diff --git a/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs new file mode 100644 index 0000000000..b7e4ac477c --- /dev/null +++ b/Content.Shared/Atmos/Components/PipeAppearanceComponent.cs @@ -0,0 +1,11 @@ +namespace Content.Shared.Atmos.Components; + +[RegisterComponent] +public sealed class PipeAppearanceComponent : Component +{ + [DataField("rsi")] + public string RsiPath = "Structures/Piping/Atmospherics/pipe.rsi"; + + [DataField("baseState")] + public string BaseState = "pipeConnector"; +} diff --git a/Content.Shared/SubFloor/SubFloorHideSystem.cs b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs similarity index 62% rename from Content.Shared/SubFloor/SubFloorHideSystem.cs rename to Content.Shared/SubFloor/SharedSubFloorHideSystem.cs index 99b4019b04..6691be3d67 100644 --- a/Content.Shared/SubFloor/SubFloorHideSystem.cs +++ b/Content.Shared/SubFloor/SharedSubFloorHideSystem.cs @@ -1,7 +1,6 @@ using Content.Shared.Interaction; using Content.Shared.Maps; using JetBrains.Annotations; -using Robust.Shared.GameStates; using Robust.Shared.Map; using Robust.Shared.Serialization; @@ -11,26 +10,11 @@ namespace Content.Shared.SubFloor /// Entity system backing . /// [UsedImplicitly] - public sealed class SubFloorHideSystem : EntitySystem + public abstract class SharedSubFloorHideSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!; - [Dependency] private readonly SharedTrayScannerSystem _trayScannerSystem = default!; - - private bool _showAll; - - [ViewVariables(VVAccess.ReadWrite)] - public bool ShowAll - { - get => _showAll; - set - { - if (_showAll == value) return; - _showAll = value; - - UpdateAll(); - } - } + [Dependency] private readonly TrayScannerSystem _trayScannerSystem = default!; public override void Initialize() { @@ -42,7 +26,6 @@ namespace Content.Shared.SubFloor SubscribeLocalEvent(OnSubFloorStarted); SubscribeLocalEvent(OnSubFloorTerminating); SubscribeLocalEvent(HandleAnchorChanged); - SubscribeLocalEvent(HandleComponentState); SubscribeLocalEvent(OnInteractionAttempt); } @@ -54,13 +37,6 @@ namespace Content.Shared.SubFloor _mapManager.TileChanged -= MapManagerOnTileChanged; } - public void SetEnabled(SubFloorHideComponent subFloor, bool enabled) - { - subFloor.Enabled = enabled; - Dirty(subFloor); - UpdateAppearance(subFloor.Owner); - } - private void OnInteractionAttempt(EntityUid uid, SubFloorHideComponent component, InteractUsingEvent args) { // TODO make this use an interact attempt event or something. Handling an InteractUsing is not going to work in general. @@ -103,17 +79,14 @@ namespace Content.Shared.SubFloor } } - private void HandleComponentState(EntityUid uid, SubFloorHideComponent component, ref ComponentHandleState args) - { - if (args.Current is not SubFloorHideComponentState state) - return; - - component.Enabled = state.Enabled; - UpdateAppearance(uid, component); - } - private void MapManagerOnTileChanged(object? sender, TileChangedEventArgs e) { + if (e.OldTile.IsEmpty) + return; // Nothing is anchored here anyways. + + if (e.NewTile.Tile.IsEmpty) + return; // Anything that was here will be unanchored anyways. + UpdateTile(_mapManager.GetGrid(e.NewTile.GridIndex), e.NewTile.GridIndices); } @@ -138,7 +111,6 @@ namespace Content.Shared.SubFloor else component.IsUnderCover = false; - // Update normally. UpdateAppearance(uid, component); } @@ -149,14 +121,6 @@ namespace Content.Shared.SubFloor return !tileDef.IsSubFloor; } - private void UpdateAll() - { - foreach (var comp in EntityManager.EntityQuery(true)) - { - UpdateAppearance(comp.Owner, comp); - } - } - private void UpdateTile(IMapGrid grid, Vector2i position) { var covered = HasFloorCover(grid, position); @@ -177,7 +141,7 @@ namespace Content.Shared.SubFloor /// /// This function is used by T-Ray scanners or other sub-floor revealing entities to toggle visibility. /// - public void SetEntitiesRevealed(IEnumerable entities, EntityUid revealer, bool visible, IEnumerable? appearanceKeys = null) + public void SetEntitiesRevealed(IEnumerable entities, EntityUid revealer, bool visible) { foreach (var uid in entities) { @@ -188,77 +152,40 @@ namespace Content.Shared.SubFloor /// /// This function is used by T-Ray scanners or other sub-floor revealing entities to toggle visibility. /// - public void SetEntityRevealed(EntityUid uid, EntityUid revealer, bool visible, - SubFloorHideComponent? hideComp = null, - IEnumerable? appearanceKeys = null) + public void SetEntityRevealed(EntityUid uid, EntityUid revealer, bool visible, SubFloorHideComponent? hideComp = null) { - if (!Resolve(uid, ref hideComp)) + if (!Resolve(uid, ref hideComp, false)) return; if (visible) { if (hideComp.RevealedBy.Add(revealer) && hideComp.RevealedBy.Count == 1) - UpdateAppearance(uid, hideComp, appearanceKeys); + UpdateAppearance(uid, hideComp); return; } if (hideComp.RevealedBy.Remove(revealer) && hideComp.RevealedBy.Count == 0) - UpdateAppearance(uid, hideComp, appearanceKeys); + UpdateAppearance(uid, hideComp); } - public void UpdateAppearance(EntityUid uid, SubFloorHideComponent? hideComp = null, IEnumerable? appearanceKeys = null) + public void UpdateAppearance( + EntityUid uid, + SubFloorHideComponent? hideComp = null, + AppearanceComponent? appearance = null) { - if (!Resolve(uid, ref hideComp)) + if (!Resolve(uid, ref hideComp, ref appearance, false)) return; - var revealedWithoutEntity = ShowAll || !hideComp.IsUnderCover; - var revealed = revealedWithoutEntity || hideComp.RevealedBy.Count != 0; - - // if there are no keys given, - // or if the subfloor is already revealed, - // set the keys to the default: - // - // the reason why it's set to default when the subfloor is - // revealed without an entity is because the appearance keys - // should only apply if the visualizer is underneath a subfloor - if (appearanceKeys == null || revealedWithoutEntity) appearanceKeys = _defaultVisualizerKeys; - - ShowSubfloorSprite(uid, revealed, appearanceKeys); + appearance.SetData(SubFloorVisuals.Covered, hideComp.IsUnderCover); + appearance.SetData(SubFloorVisuals.ScannerRevealed, hideComp.RevealedBy.Count != 0); } - - private void ShowSubfloorSprite(EntityUid uid, bool revealed, IEnumerable appearanceKeys) - { - // Show sprite - if (EntityManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent)) - { - spriteComponent.Visible = revealed; - } - - // Set an appearance data value so visualizers can use this as needed. - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) - { - foreach (var key in appearanceKeys) - { - switch (key) - { - case Enum enumKey: - appearanceComponent.SetData(enumKey, revealed); - break; - case string stringKey: - appearanceComponent.SetData(stringKey, revealed); - break; - } - } - } - } - - private static List _defaultVisualizerKeys = new List{ SubFloorVisuals.SubFloor }; } [Serializable, NetSerializable] public enum SubFloorVisuals : byte { - SubFloor, + Covered, // is there a floor tile over this entity + ScannerRevealed, // is this entity revealed by a scanner or some other entity? } } diff --git a/Content.Shared/SubFloor/SharedTrayScannerSystem.cs b/Content.Shared/SubFloor/SharedTrayScannerSystem.cs deleted file mode 100644 index b64640fc62..0000000000 --- a/Content.Shared/SubFloor/SharedTrayScannerSystem.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Content.Shared.Interaction; -using Robust.Shared.GameStates; -using Robust.Shared.Serialization; - -namespace Content.Shared.SubFloor; - -public abstract class SharedTrayScannerSystem : EntitySystem -{ - public override void Initialize() - { - base.Initialize(); - - SubscribeLocalEvent(OnTrayScannerGetState); - SubscribeLocalEvent(OnTrayScannerHandleState); - SubscribeLocalEvent(OnTrayScannerActivate); - } - - private void OnTrayScannerActivate(EntityUid uid, TrayScannerComponent scanner, ActivateInWorldEvent args) - { - ActivateTray(uid, scanner); - } - - private void ActivateTray(EntityUid uid, TrayScannerComponent? scanner = null) - { - if (!Resolve(uid, ref scanner)) - return; - - ToggleTrayScanner(uid, !scanner.Toggled, scanner); - if (EntityManager.TryGetComponent(uid, out var appearance)) - { - appearance.SetData(TrayScannerVisual.Visual, scanner.Toggled == true ? TrayScannerVisual.On : TrayScannerVisual.Off); - } - } - - public virtual void ToggleTrayScanner(EntityUid uid, bool state, TrayScannerComponent? scanner = null) - { - if (!Resolve(uid, ref scanner)) - return; - - scanner.Toggled = state; - scanner.Dirty(); - } - - private void OnTrayScannerGetState(EntityUid uid, TrayScannerComponent scanner, ref ComponentGetState args) - { - args.State = new TrayScannerState(scanner.Toggled); - } - - private void OnTrayScannerHandleState(EntityUid uid, TrayScannerComponent scanner, ref ComponentHandleState args) - { - if (args.Current is not TrayScannerState state) - return; - - ToggleTrayScanner(uid, state.Toggled, scanner); - } - - public virtual void OnSubfloorAnchored(EntityUid uid, SubFloorHideComponent? hideComp = null, TransformComponent? xform = null) - { - } -} - -[Serializable, NetSerializable] -public enum TrayScannerVisual : sbyte -{ - Visual, - On, - Off -} diff --git a/Content.Shared/SubFloor/SubFloorHideComponent.cs b/Content.Shared/SubFloor/SubFloorHideComponent.cs index 3e6fbfa5ca..a0b97992f4 100644 --- a/Content.Shared/SubFloor/SubFloorHideComponent.cs +++ b/Content.Shared/SubFloor/SubFloorHideComponent.cs @@ -5,49 +5,26 @@ namespace Content.Shared.SubFloor { /// /// Simple component that automatically hides the sibling - /// when the tile it's on is not a sub floor + /// when the tile it's on is not a sub floor /// (plating). /// /// [NetworkedComponent] [RegisterComponent] - [Friend(typeof(SubFloorHideSystem))] + [Friend(typeof(SharedSubFloorHideSystem))] public sealed class SubFloorHideComponent : Component { - /// - /// Whether the entity will be hid when not in subfloor. - /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("enabled")] - public bool Enabled { get; set; } = true; - /// /// Whether the entity's current position has a "Floor-type" tile above its current position. /// + [ViewVariables] public bool IsUnderCover { get; set; } = false; - /* - * An un-anchored hiding entity would require listening to on-move events in case it moves into a sub-floor - * tile. Also T-Ray scanner headaches. /// - /// This entity needs to be anchored to be hid when not in subfloor. + /// When revealed using some scanning tool, what transparency should be used to draw this item? /// - [ViewVariables(VVAccess.ReadWrite)] - [DataField("requireAnchored")] - public bool RequireAnchored { get; set; } = true; - */ - - public override ComponentState GetComponentState() - { - return new SubFloorHideComponentState(Enabled); - } - - /// - /// Whether or not this entity is supposed - /// to be visible. - /// - [ViewVariables] - public bool Visible { get; set; } + [DataField("scannerTransparency")] + public float ScannerTransparency = 0.8f; /// /// The entities this subfloor is revealed by. @@ -55,15 +32,4 @@ namespace Content.Shared.SubFloor [ViewVariables] public HashSet RevealedBy { get; set; } = new(); } - - [Serializable, NetSerializable] - public sealed class SubFloorHideComponentState : ComponentState - { - public bool Enabled { get; } - - public SubFloorHideComponentState(bool enabled) - { - Enabled = enabled; - } - } } diff --git a/Content.Shared/SubFloor/TrayScannerComponent.cs b/Content.Shared/SubFloor/TrayScannerComponent.cs index da5d8d004d..c6bc3d46f3 100644 --- a/Content.Shared/SubFloor/TrayScannerComponent.cs +++ b/Content.Shared/SubFloor/TrayScannerComponent.cs @@ -1,31 +1,33 @@ -using System; -using System.Collections.Generic; -using Robust.Shared.GameObjects; using Robust.Shared.GameStates; -using Robust.Shared.Maths; using Robust.Shared.Serialization; -using Robust.Shared.Serialization.Manager.Attributes; -using Robust.Shared.ViewVariables; namespace Content.Shared.SubFloor; [RegisterComponent] [NetworkedComponent] -public class TrayScannerComponent : Component +public sealed class TrayScannerComponent : Component { + /// + /// Whether the scanner is currently on. + /// [ViewVariables] - public bool Toggled { get; set; } + public bool Enabled { get; set; } - // this should always be rounded + /// + /// Last position of the scanner. Rounded to integers to avoid excessive entity lookups when moving. + /// [ViewVariables] - public Vector2 LastLocation { get; set; } + public Vector2i? LastLocation { get; set; } - // range of the scanner itself + /// + /// Radius in which the scanner will reveal entities. Centered on the . + /// [DataField("range")] - public float Range { get; set; } = 2f; + public float Range { get; set; } = 2.5f; - // exclude entities that are not the set - // of entities in range & entities already revealed + /// + /// The sub-floor entities that this scanner is currently revealing. + /// [ViewVariables] public HashSet RevealedSubfloors = new(); } @@ -33,10 +35,10 @@ public class TrayScannerComponent : Component [Serializable, NetSerializable] public sealed class TrayScannerState : ComponentState { - public bool Toggled { get; } + public bool Enabled; - public TrayScannerState(bool toggle) + public TrayScannerState(bool enabled) { - Toggled = toggle; + Enabled = enabled; } } diff --git a/Content.Client/SubFloor/TrayScannerSystem.cs b/Content.Shared/SubFloor/TrayScannerSystem.cs similarity index 65% rename from Content.Client/SubFloor/TrayScannerSystem.cs rename to Content.Shared/SubFloor/TrayScannerSystem.cs index d75b7672cf..00b7e92a97 100644 --- a/Content.Client/SubFloor/TrayScannerSystem.cs +++ b/Content.Shared/SubFloor/TrayScannerSystem.cs @@ -1,48 +1,88 @@ -using System.Linq; -using Content.Shared.SubFloor; +using Content.Shared.Interaction; using Robust.Shared.Containers; +using Robust.Shared.GameStates; using Robust.Shared.Map; +using Robust.Shared.Serialization; +using Robust.Shared.Timing; using Robust.Shared.Utility; +using System.Linq; -namespace Content.Client.SubFloor; +namespace Content.Shared.SubFloor; -public sealed class TrayScannerSystem : SharedTrayScannerSystem +public sealed class TrayScannerSystem : EntitySystem { [Dependency] private IMapManager _mapManager = default!; - [Dependency] private SubFloorHideSystem _subfloorSystem = default!; + [Dependency] private IGameTiming _gameTiming = default!; + [Dependency] private SharedSubFloorHideSystem _subfloorSystem = default!; [Dependency] private SharedContainerSystem _containerSystem = default!; + private HashSet _activeScanners = new(); + private RemQueue _invalidScanners = new(); + public override void Initialize() { base.Initialize(); - UpdatesOutsidePrediction = true; - SubscribeLocalEvent(OnComponentShutdown); + SubscribeLocalEvent(OnTrayScannerGetState); + SubscribeLocalEvent(OnTrayScannerHandleState); + SubscribeLocalEvent(OnTrayScannerActivate); } - public void OnComponentShutdown(EntityUid uid, TrayScannerComponent scanner, ComponentShutdown args) + private void OnTrayScannerActivate(EntityUid uid, TrayScannerComponent scanner, ActivateInWorldEvent args) { - _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false, _visualizerKeys); - _invalidScanners.Add(uid); + SetScannerEnabled(uid, !scanner.Enabled, scanner); } - public override void ToggleTrayScanner(EntityUid uid, bool toggle, TrayScannerComponent? scanner = null) + private void SetScannerEnabled(EntityUid uid, bool enabled, TrayScannerComponent? scanner = null) { if (!Resolve(uid, ref scanner)) return; - scanner.Toggled = toggle; - UpdateTrayScanner(uid, scanner); + scanner.Enabled = enabled; + scanner.Dirty(); - if (toggle) _activeScanners.Add(uid); + if (scanner.Enabled) + _activeScanners.Add(uid); + + // We don't remove from _activeScanners on disabled, because the update function will handle that, as well as + // managing the revealed subfloor entities + + if (EntityManager.TryGetComponent(uid, out var appearance)) + { + appearance.SetData(TrayScannerVisual.Visual, scanner.Enabled == true ? TrayScannerVisual.On : TrayScannerVisual.Off); + } } - private HashSet _activeScanners = new(); - private RemQueue _invalidScanners = new(); + private void OnTrayScannerGetState(EntityUid uid, TrayScannerComponent scanner, ref ComponentGetState args) + { + args.State = new TrayScannerState(scanner.Enabled); + } + + private void OnTrayScannerHandleState(EntityUid uid, TrayScannerComponent scanner, ref ComponentHandleState args) + { + if (args.Current is not TrayScannerState state) + return; + + SetScannerEnabled(uid, scanner.Enabled, scanner); + + // This is hacky and somewhat inefficient for the client. But when resetting predicted entities we have to unset + // last position. This is because appearance data gets reset, but if the position isn't reset the scanner won't + // re-reveal entities leading to odd visuals. + scanner.LastLocation = null; + } + + public void OnComponentShutdown(EntityUid uid, TrayScannerComponent scanner, ComponentShutdown args) + { + _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false); + _activeScanners.Remove(uid); + } public override void Update(float frameTime) { + if (!_gameTiming.IsFirstTimePredicted) + return; + if (!_activeScanners.Any()) return; foreach (var scanner in _activeScanners) @@ -58,17 +98,17 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem foreach (var invalidScanner in _invalidScanners) _activeScanners.Remove(invalidScanner); - if (_invalidScanners.List != null) _invalidScanners.List.Clear(); + _invalidScanners.List?.Clear(); } /// /// When a subfloor entity gets anchored (which includes spawning & coming into PVS range), Check for nearby scanners. /// - public override void OnSubfloorAnchored(EntityUid uid, SubFloorHideComponent? hideComp = null, TransformComponent? xform = null) + public void OnSubfloorAnchored(EntityUid uid, SubFloorHideComponent? hideComp = null, TransformComponent? xform = null) { if (!Resolve(uid, ref hideComp, ref xform)) return; - + var pos = xform.MapPosition; foreach (var entity in _activeScanners) @@ -92,67 +132,62 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem /// true if the update was successful, false otherwise private bool UpdateTrayScanner(EntityUid uid, TrayScannerComponent? scanner = null, TransformComponent? transform = null) { - // whoops? if (!Resolve(uid, ref scanner, ref transform)) - { return false; - } // if the scanner was toggled off recently, // set all the known subfloor to invisible, // and return false so it's removed from // the active scanner list - if (!scanner.Toggled || transform.MapID == MapId.Nullspace) + if (!scanner.Enabled || transform.MapID == MapId.Nullspace) { - _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false, _visualizerKeys); - scanner.LastLocation = Vector2.Zero; + _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false); + scanner.LastLocation = null; scanner.RevealedSubfloors.Clear(); return false; } - // get the rounded position so that small movements don't cause this to - // update every time - Vector2 flooredPos; + var pos = transform.LocalPosition; // zero vector implies container // // this means we should get the entity transform's parent - if (transform.LocalPosition == Vector2.Zero + if (pos == Vector2.Zero && transform.Parent != null && _containerSystem.ContainsEntity(transform.ParentUid, uid)) { - flooredPos = transform.Parent.LocalPosition.Rounded(); + pos = transform.Parent.LocalPosition; // if this is also zero, we can check one more time // // could recurse through fully but i think that's useless, // just attempt to check through the gp's transform and if // that doesn't work, just don't bother any further - if (flooredPos == Vector2.Zero) + if (pos == Vector2.Zero) { var gpTransform = transform.Parent.Parent; if (gpTransform != null && _containerSystem.ContainsEntity(gpTransform.Owner, transform.ParentUid)) { - flooredPos = gpTransform.LocalPosition.Rounded(); + pos = gpTransform.LocalPosition; } } } - else - { - flooredPos = transform.LocalPosition.Rounded(); - } // is the position still logically zero? just clear, // but we need to keep it as 'true' since this t-ray // is still technically on - if (flooredPos == Vector2.Zero) + if (pos == Vector2.Zero) { - _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false, _visualizerKeys); + _subfloorSystem.SetEntitiesRevealed(scanner.RevealedSubfloors, uid, false); scanner.RevealedSubfloors.Clear(); return true; } + // get the rounded position so that small movements don't cause this to + // update every time + var flooredPos = (Vector2i) pos; + // MAYBE redo this. Currently different players can see different entities // // Here we avoid the entity lookup & return early if the scanner's position hasn't appreciably changed. However, @@ -161,7 +196,7 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem // same scanner. The correct fix for this is probably just to network the revealed entity set.... But I CBF // doing that right now.... if (flooredPos == scanner.LastLocation - || (float.IsNaN(flooredPos.X) && float.IsNaN(flooredPos.Y))) + || float.IsNaN(flooredPos.X) && float.IsNaN(flooredPos.Y)) return true; scanner.LastLocation = flooredPos; @@ -186,7 +221,7 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem nearby.Add(entity); if (scanner.RevealedSubfloors.Add(entity)) - _subfloorSystem.SetEntityRevealed(entity, uid, true, hideComp, _visualizerKeys); + _subfloorSystem.SetEntityRevealed(entity, uid, true, hideComp); } } @@ -197,14 +232,16 @@ public sealed class TrayScannerSystem : SharedTrayScannerSystem scanner.RevealedSubfloors.ExceptWith(missing); // and hide them - _subfloorSystem.SetEntitiesRevealed(missing, uid, false, _visualizerKeys); + _subfloorSystem.SetEntitiesRevealed(missing, uid, false); return true; } - - private static IEnumerable _visualizerKeys = new List - { - SubFloorVisuals.SubFloor, - TrayScannerTransparency.Key - }; +} + +[Serializable, NetSerializable] +public enum TrayScannerVisual : sbyte +{ + Visual, + On, + Off } diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml index fe32f84efb..26e00179a9 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/binary.yml @@ -33,11 +33,9 @@ state: pipeStraight map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: pumpPressure - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.PressurePumpVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.PressurePumpVisualizer+Layers.Enabled" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: PressurePumpVisualizer disabledState: pumpPressure @@ -64,11 +62,9 @@ state: pipeStraight map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: pumpVolume - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasVolumePump - type: UserInterface @@ -92,11 +88,9 @@ state: pipeStraight map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: pumpPassiveGate - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasPassiveGate @@ -117,11 +111,9 @@ state: pipeStraight map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: pumpManualValve - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.GasValveVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.GasValveVisualizer+Layers.Enabled" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasValveVisualizer disabledState: pumpManualValve @@ -156,11 +148,9 @@ state: pipeHalf map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: gasCanisterPort - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasPort - type: NodeContainer @@ -187,11 +177,9 @@ state: pipeStraight map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: vent_off - map: [ "enum.VentVisualLayers.Vent", "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.VentVisualLayers.Vent", "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: VentPumpVisualizer - type: GasVentPump diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml index cf9a251241..6442ef021b 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/pipes.yml @@ -40,6 +40,7 @@ damageContainer: Inorganic damageModifierSet: Metallic - type: SubFloorHide + - type: PipeAppearance - type: Anchorable - type: Rotatable - type: Pullable @@ -57,9 +58,7 @@ netsync: false - type: Appearance visuals: - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - - type: TrayScannerSubFloorVisualizer - type: NodeContainer - type: AtmosUnsafeUnanchor - type: AtmosPipeColor diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml index f6cba529c0..299acf45c6 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/trinary.yml @@ -39,11 +39,9 @@ rotation: -90 # fuck you!!! who cares map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: gasFilter - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasFilterVisualizer disabledState: gasFilter @@ -73,13 +71,11 @@ rotation: -90 map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: gasFilterF - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] - type: Flippable mirrorEntity: GasFilter - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasFilterVisualizer disabledState: gasFilterF @@ -116,11 +112,9 @@ rotation: -90 map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: gasMixer - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasFilterVisualizer disabledState: gasMixer @@ -152,11 +146,9 @@ rotation: -90 map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: gasMixerF - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] + map: [ "enum.SubfloorLayers.FirstLayer", "enum.GasFilterVisualizer+Layers.Enabled" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasFilterVisualizer disabledState: gasMixerF diff --git a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml index 2fb387dd5d..d00ebf0bd4 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Atmospherics/unary.yml @@ -39,11 +39,9 @@ state: pipeHalf map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: vent_off - map: [ "enum.VentVisualLayers.Vent", "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.VentVisualLayers.Vent", "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: VentPumpVisualizer - type: GasVentPump @@ -66,11 +64,9 @@ state: pipeHalf map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: vent_off - map: [ "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasPassiveVent @@ -100,11 +96,9 @@ state: pipeHalf map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - state: scrub_off - map: [ "enum.ScrubberVisualLayers.Scrubber", "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.ScrubberVisualLayers.Scrubber", "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: ScrubberVisualizer - type: AtmosDevice @@ -126,11 +120,9 @@ layers: - state: pipeHalf sprite: Structures/Piping/Atmospherics/pipe.rsi - map: [ "enum.PipeColorVisualizer+Layers.Pipe", "enum.SubFloorShowLayerVisualizer+Layers.FirstLayer" ] + map: [ "enum.PipeColorVisualizer+Layers.Pipe", "enum.SubfloorLayers.FirstLayer" ] - type: Appearance visuals: - - type: SubFloorShowLayerVisualizer - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: GasOutletInjector @@ -149,7 +141,6 @@ noRot: true - type: Appearance visuals: - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: Rotatable - type: GasThermoMachine @@ -177,7 +168,6 @@ map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - type: Appearance visuals: - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: ThermoMachineVisualizer disabledState: freezer_off @@ -201,7 +191,6 @@ map: [ "enum.PipeColorVisualizer+Layers.Pipe" ] - type: Appearance visuals: - - type: PipeConnectorVisualizer - type: PipeColorVisualizer - type: ThermoMachineVisualizer disabledState: heater_off diff --git a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml index 7d87371d82..9f4a748975 100644 --- a/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml +++ b/Resources/Prototypes/Entities/Structures/Piping/Disposal/pipes.yml @@ -60,10 +60,6 @@ drawdepth: ThickPipe sprite: Structures/Piping/disposal.rsi state: pipe-b - - type: Appearance - visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: Physics - type: Fixtures fixtures: @@ -88,8 +84,6 @@ - type: DisposalTransit - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-s state_anchored: pipe-s @@ -117,8 +111,6 @@ - type: DisposalTagger - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-tagger state_anchored: pipe-tagger @@ -150,8 +142,6 @@ - type: DisposalEntry - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-t state_anchored: pipe-t @@ -183,8 +173,6 @@ - 180 - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-j1s state_anchored: pipe-j1s @@ -221,8 +209,6 @@ - 180 - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-j2s state_anchored: pipe-j2s @@ -253,8 +239,6 @@ - 180 - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-j1 state_anchored: pipe-j1 @@ -287,8 +271,6 @@ - 180 - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-j2 state_anchored: pipe-j2 @@ -319,8 +301,6 @@ - -90 - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-y state_anchored: pipe-y @@ -348,8 +328,6 @@ - type: DisposalBend - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - - type: SubFloorShowLayerVisualizer - type: DisposalVisualizer state_free: conpipe-c state_anchored: pipe-c diff --git a/Resources/Prototypes/Entities/Structures/Power/cables.yml b/Resources/Prototypes/Entities/Structures/Power/cables.yml index ad7e73a1bb..f4fa729601 100644 --- a/Resources/Prototypes/Entities/Structures/Power/cables.yml +++ b/Resources/Prototypes/Entities/Structures/Power/cables.yml @@ -84,7 +84,6 @@ acts: [ "Destruction" ] - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - type: CableVisualizer base: hvcable_ @@ -131,7 +130,6 @@ acts: [ "Destruction" ] - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - type: CableVisualizer base: mvcable_ @@ -181,6 +179,5 @@ acts: [ "Destruction" ] - type: Appearance visuals: - - type: TrayScannerSubFloorVisualizer - type: CableVisualizer base: lvcable_