diff --git a/Content.Client/AME/AMEControllerVisualizerSystem.cs b/Content.Client/AME/AMEControllerVisualizerSystem.cs index f16b22cf62..c80963fc64 100644 --- a/Content.Client/AME/AMEControllerVisualizerSystem.cs +++ b/Content.Client/AME/AMEControllerVisualizerSystem.cs @@ -15,7 +15,7 @@ public sealed class AMEControllerVisualizerSystem : VisualizerSystem(uid, out var sprite)) + if (TryComp(uid, out var sprite)) { sprite.LayerMapSet(AMEControllerVisualLayers.Display, sprite.AddLayerState("control_on")); sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); @@ -26,30 +26,32 @@ public sealed class AMEControllerVisualizerSystem : VisualizerSystem(AMEControllerVisuals.DisplayState, out var state)) + if (args.Sprite == null + || !AppearanceSystem.TryGetData(uid, AMEControllerVisuals.DisplayState, out var state, args.Component)) { - switch(state) - { - case "on": - args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_on"); - args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); - break; - case "critical": - args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_critical"); - args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); - break; - case "fuck": - args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_fuck"); - args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); - break; - case "off": - args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); - break; - default: - args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); - break; - } + return; + } + + switch (state) + { + case "on": + args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_on"); + args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); + break; + case "critical": + args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_critical"); + args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); + break; + case "fuck": + args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_fuck"); + args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, true); + break; + case "off": + args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); + break; + default: + args.Sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); + break; } } } diff --git a/Content.Client/AME/AMEShieldingVisualizerSystem.cs b/Content.Client/AME/AMEShieldingVisualizerSystem.cs index 9659f5ed55..7e225cc4ad 100644 --- a/Content.Client/AME/AMEShieldingVisualizerSystem.cs +++ b/Content.Client/AME/AMEShieldingVisualizerSystem.cs @@ -15,7 +15,7 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem(uid, out var sprite)) + if (TryComp(uid, out var sprite)) { sprite.LayerMapSet(AMEShieldingVisualsLayer.Core, sprite.AddLayerState("core")); sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, false); @@ -26,10 +26,10 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem(AMEShieldVisuals.Core, out var core)) + if (AppearanceSystem.TryGetData(uid, AMEShieldVisuals.Core, out var core, args.Component)) { if (core == "isCore") { @@ -43,9 +43,9 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem(AMEShieldVisuals.CoreState, out var coreState)) + if (AppearanceSystem.TryGetData(uid, AMEShieldVisuals.CoreState, out var coreState, args.Component)) { - switch(coreState) + switch (coreState) { case "weak": args.Sprite.LayerSetState(AMEShieldingVisualsLayer.CoreState, "core_weak"); diff --git a/Content.Client/Anomaly/AnomalySystem.cs b/Content.Client/Anomaly/AnomalySystem.cs index 1884c39628..57f1f90f10 100644 --- a/Content.Client/Anomaly/AnomalySystem.cs +++ b/Content.Client/Anomaly/AnomalySystem.cs @@ -22,10 +22,10 @@ public sealed class AnomalySystem : SharedAnomalySystem if (args.Sprite is not { } sprite) return; - if (!Appearance.TryGetData(uid, AnomalyVisuals.IsPulsing, out bool pulsing, args.Component)) + if (!Appearance.TryGetData(uid, AnomalyVisuals.IsPulsing, out var pulsing, args.Component)) pulsing = false; - if (Appearance.TryGetData(uid, AnomalyVisuals.Supercritical, out bool super, args.Component) && super) + if (Appearance.TryGetData(uid, AnomalyVisuals.Supercritical, out var super, args.Component) && super) pulsing = super; if (HasComp(uid)) diff --git a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs index eac865db92..1d38e24db9 100644 --- a/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs +++ b/Content.Client/Atmos/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -2,7 +2,6 @@ using Content.Client.SubFloor; using Content.Shared.Atmos; using Content.Shared.Atmos.Components; using Content.Shared.Atmos.Piping; -using Content.Shared.SubFloor; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Client.ResourceManagement; @@ -13,6 +12,7 @@ namespace Content.Client.Atmos.EntitySystems; public sealed class AtmosPipeAppearanceSystem : EntitySystem { [Dependency] private readonly IResourceCache _resCache = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -56,10 +56,10 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem return; } - if (!args.Component.TryGetData(PipeColorVisuals.Color, out Color color)) + if (!_appearance.TryGetData(uid, PipeColorVisuals.Color, out var color, args.Component)) color = Color.White; - if (!args.Component.TryGetData(PipeVisuals.VisualState, out PipeDirection worldConnectedDirections)) + if (!_appearance.TryGetData(uid, PipeVisuals.VisualState, out var worldConnectedDirections, args.Component)) return; // transform connected directions to local-coordinates diff --git a/Content.Client/Atmos/EntitySystems/FireVisualizerSystem.cs b/Content.Client/Atmos/EntitySystems/FireVisualizerSystem.cs index b5a96f16f4..6f0dba4bd7 100644 --- a/Content.Client/Atmos/EntitySystems/FireVisualizerSystem.cs +++ b/Content.Client/Atmos/EntitySystems/FireVisualizerSystem.cs @@ -56,8 +56,8 @@ public sealed class FireVisualizerSystem : VisualizerSystem(uid, FireVisuals.OnFire, out var onFire, appearance); + AppearanceSystem.TryGetData(uid, FireVisuals.FireStacks, out var fireStacks, appearance); sprite.LayerSetVisible(index, onFire); if (!onFire) diff --git a/Content.Client/Atmos/EntitySystems/PipeColorVisualizerSystem.cs b/Content.Client/Atmos/EntitySystems/PipeColorVisualizerSystem.cs index 17f90ff4d1..5595f441f7 100644 --- a/Content.Client/Atmos/EntitySystems/PipeColorVisualizerSystem.cs +++ b/Content.Client/Atmos/EntitySystems/PipeColorVisualizerSystem.cs @@ -8,8 +8,8 @@ public sealed class PipeColorVisualizerSystem : VisualizerSystem(uid, out var sprite) - && args.Component.TryGetData(PipeColorVisuals.Color, out var color)) + if (TryComp(uid, out var sprite) + && AppearanceSystem.TryGetData(uid, PipeColorVisuals.Color, out var color, args.Component)) { // T-ray scanner / sub floor runs after this visualizer. Lets not bulldoze transparency. var layer = sprite[PipeVisualLayers.Pipe]; diff --git a/Content.Client/Atmos/Visualizers/PortableScrubberVisualsSystem.cs b/Content.Client/Atmos/Visualizers/PortableScrubberVisualsSystem.cs index 00e25097b3..262c854a47 100644 --- a/Content.Client/Atmos/Visualizers/PortableScrubberVisualsSystem.cs +++ b/Content.Client/Atmos/Visualizers/PortableScrubberVisualsSystem.cs @@ -14,8 +14,8 @@ namespace Content.Client.Atmos.Visualizers if (args.Sprite == null) return; - if (args.Component.TryGetData(PortableScrubberVisuals.IsFull, out bool isFull) - && args.Component.TryGetData(PortableScrubberVisuals.IsRunning, out bool isRunning)) + if (AppearanceSystem.TryGetData(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component) + && AppearanceSystem.TryGetData(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component)) { var runningState = isRunning ? component.RunningState : component.IdleState; args.Sprite.LayerSetState(PortableScrubberVisualLayers.IsRunning, runningState); @@ -24,7 +24,7 @@ namespace Content.Client.Atmos.Visualizers args.Sprite.LayerSetState(PowerDeviceVisualLayers.Powered, fullState); } - if (args.Component.TryGetData(PortableScrubberVisuals.IsDraining, out bool isDraining)) + if (AppearanceSystem.TryGetData(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component)) { args.Sprite.LayerSetVisible(PortableScrubberVisualLayers.IsDraining, isDraining); } diff --git a/Content.Client/BarSign/BarSignSystem.cs b/Content.Client/BarSign/BarSignSystem.cs index ac9347902a..7a28948811 100644 --- a/Content.Client/BarSign/BarSignSystem.cs +++ b/Content.Client/BarSign/BarSignSystem.cs @@ -35,7 +35,7 @@ public sealed class BarSignSystem : VisualizerSystem if (!Resolve(sign.Owner, ref appearance, ref sprite)) return; - appearance.TryGetData(PowerDeviceVisuals.Powered, out bool powered); + AppearanceSystem.TryGetData(sign.Owner, PowerDeviceVisuals.Powered, out var powered, appearance); if (powered && sign.CurrentSign != null diff --git a/Content.Client/Bed/StasisBedSystem.cs b/Content.Client/Bed/StasisBedSystem.cs index 94e20699d2..66ec2f3245 100644 --- a/Content.Client/Bed/StasisBedSystem.cs +++ b/Content.Client/Bed/StasisBedSystem.cs @@ -1,22 +1,21 @@ using Content.Shared.Bed; using Robust.Client.GameObjects; -namespace Content.Client.Bed +namespace Content.Client.Bed; + +public sealed class StasisBedSystem : VisualizerSystem { - public sealed class StasisBedSystem : VisualizerSystem + protected override void OnAppearanceChange(EntityUid uid, StasisBedVisualsComponent component, ref AppearanceChangeEvent args) { - protected override void OnAppearanceChange(EntityUid uid, StasisBedVisualsComponent component, ref AppearanceChangeEvent args) + if (args.Sprite != null + && AppearanceSystem.TryGetData(uid, StasisBedVisuals.IsOn, out var isOn, args.Component)) { - if (args.Sprite != null - && args.Component.TryGetData(StasisBedVisuals.IsOn, out bool isOn)) - { - args.Sprite.LayerSetVisible(StasisBedVisualLayers.IsOn, isOn); - } + args.Sprite.LayerSetVisible(StasisBedVisualLayers.IsOn, isOn); } } - - public enum StasisBedVisualLayers : byte - { - IsOn, - } +} + +public enum StasisBedVisualLayers : byte +{ + IsOn, } diff --git a/Content.Client/Botany/PlantHolderVisualizerSystem.cs b/Content.Client/Botany/PlantHolderVisualizerSystem.cs index ba2d5923c6..963d259c40 100644 --- a/Content.Client/Botany/PlantHolderVisualizerSystem.cs +++ b/Content.Client/Botany/PlantHolderVisualizerSystem.cs @@ -26,8 +26,8 @@ public sealed class PlantHolderVisualizerSystem : VisualizerSystem(PlantHolderVisuals.PlantRsi, out var rsi) - && args.Component.TryGetData(PlantHolderVisuals.PlantState, out var state)) + if (AppearanceSystem.TryGetData(uid, PlantHolderVisuals.PlantRsi, out var rsi, args.Component) + && AppearanceSystem.TryGetData(uid, PlantHolderVisuals.PlantState, out var state, args.Component)) { var valid = !string.IsNullOrWhiteSpace(state); diff --git a/Content.Client/Botany/PotencyVisualsSystem.cs b/Content.Client/Botany/PotencyVisualsSystem.cs index f13c8de600..eac9776423 100644 --- a/Content.Client/Botany/PotencyVisualsSystem.cs +++ b/Content.Client/Botany/PotencyVisualsSystem.cs @@ -11,7 +11,7 @@ public sealed class PotencyVisualsSystem : VisualizerSystem(uid, ProduceVisuals.Potency, out var potency, args.Component)) { var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100); args.Sprite.Scale = new Vector2(scale, scale); diff --git a/Content.Client/Cabinet/ItemCabinetSystem.cs b/Content.Client/Cabinet/ItemCabinetSystem.cs index f81d368182..ec14c4049e 100644 --- a/Content.Client/Cabinet/ItemCabinetSystem.cs +++ b/Content.Client/Cabinet/ItemCabinetSystem.cs @@ -10,8 +10,8 @@ public sealed class ItemCabinetSystem : VisualizerSystem(uid, ItemCabinetVisuals.IsOpen, out var isOpen, args.Component) + && AppearanceSystem.TryGetData(uid, ItemCabinetVisuals.ContainsItem, out var contains, args.Component)) { var state = isOpen ? component.OpenState : component.ClosedState; args.Sprite.LayerSetState(ItemCabinetVisualLayers.Door, state); diff --git a/Content.Client/Cargo/Systems/CargoSystem.Telepad.cs b/Content.Client/Cargo/Systems/CargoSystem.Telepad.cs index 74fdf149d9..6bc0f88007 100644 --- a/Content.Client/Cargo/Systems/CargoSystem.Telepad.cs +++ b/Content.Client/Cargo/Systems/CargoSystem.Telepad.cs @@ -67,7 +67,7 @@ public sealed partial class CargoSystem if (!Resolve(component.Owner, ref sprite)) return; - _appearance.TryGetData(component.Owner, CargoTelepadVisuals.State, out CargoTelepadState? state); + _appearance.TryGetData(component.Owner, CargoTelepadVisuals.State, out var state); AnimationPlayerComponent? player = null; switch (state) diff --git a/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs b/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs index 02fd18899b..78a8d8e284 100644 --- a/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs +++ b/Content.Client/Chat/TypingIndicator/TypingIndicatorVisualizerSystem.cs @@ -13,18 +13,18 @@ public sealed class TypingIndicatorVisualizerSystem : VisualizerSystem(component.Prototype, out var proto)) { Logger.Error($"Unknown typing indicator id: {component.Prototype}"); return; } - args.Component.TryGetData(TypingIndicatorVisuals.IsTyping, out bool isTyping); + AppearanceSystem.TryGetData(uid, TypingIndicatorVisuals.IsTyping, out var isTyping, args.Component); var layerExists = args.Sprite.LayerMapTryGet(TypingIndicatorLayers.Base, out var layer); if (!layerExists) layer = args.Sprite.LayerMapReserveBlank(TypingIndicatorLayers.Base); - + args.Sprite.LayerSetRSI(layer, proto.SpritePath); args.Sprite.LayerSetState(layer, proto.TypingState); args.Sprite.LayerSetShader(layer, proto.Shader); diff --git a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs index a1ec5ac7ac..bf8d4a5cc2 100644 --- a/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs +++ b/Content.Client/Chemistry/Visualizers/SolutionContainerVisualsSystem.cs @@ -5,11 +5,9 @@ namespace Content.Client.Chemistry.Visualizers; public sealed class SolutionContainerVisualsSystem : VisualizerSystem { - [Dependency] private readonly AppearanceSystem _appearance = default!; - protected override void OnAppearanceChange(EntityUid uid, SolutionContainerVisualsComponent component, ref AppearanceChangeEvent args) { - if (!_appearance.TryGetData(uid, SolutionContainerVisuals.FillFraction, out float fraction, args.Component)) + if (!AppearanceSystem.TryGetData(uid, SolutionContainerVisuals.FillFraction, out var fraction, args.Component)) return; if (args.Sprite == null) @@ -39,7 +37,7 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem(uid, SolutionContainerVisuals.Color, out var color, args.Component)) args.Sprite.LayerSetColor(fillLayer, color); } else diff --git a/Content.Client/Clothing/ClientClothingSystem.cs b/Content.Client/Clothing/ClientClothingSystem.cs index 816d51fb19..abf715191f 100644 --- a/Content.Client/Clothing/ClientClothingSystem.cs +++ b/Content.Client/Clothing/ClientClothingSystem.cs @@ -45,7 +45,7 @@ public sealed class ClientClothingSystem : ClothingSystem [Dependency] private readonly IResourceCache _cache = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { diff --git a/Content.Client/Damage/DamageVisualsSystem.cs b/Content.Client/Damage/DamageVisualsSystem.cs index 6dbe8edc1c..aaef798101 100644 --- a/Content.Client/Damage/DamageVisualsSystem.cs +++ b/Content.Client/Damage/DamageVisualsSystem.cs @@ -345,7 +345,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem(DamageVisualizerKeys.Disabled, out var disabledStatus)) + if (AppearanceSystem.TryGetData(uid, DamageVisualizerKeys.Disabled, out var disabledStatus, args.Component)) damageVisComp.Disabled = disabledStatus; if (damageVisComp.Disabled) @@ -366,7 +366,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem(DamageVisualizerKeys.ForceUpdate, out var update) + if (AppearanceSystem.TryGetData(component.Owner, DamageVisualizerKeys.ForceUpdate, out var update, component) && update) { ForceUpdateLayers(damageComponent, spriteComponent, damageVisComp); @@ -377,7 +377,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem(component.Owner, DamageVisualizerKeys.DamageUpdateGroups, out var data, component)) { UpdateDamageVisuals(data.GroupList, damageComponent, spriteComponent, damageVisComp); } @@ -394,7 +394,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem(layer, out var layerStateEnum)) + if (AppearanceSystem.TryGetData(component.Owner, layer, out var layerStateEnum, component)) layerStatus = layerStateEnum; if (layerStatus == null) diff --git a/Content.Client/DamageState/DamageStateVisualizerSystem.cs b/Content.Client/DamageState/DamageStateVisualizerSystem.cs index ab819d3b83..7ecfb4a7eb 100644 --- a/Content.Client/DamageState/DamageStateVisualizerSystem.cs +++ b/Content.Client/DamageState/DamageStateVisualizerSystem.cs @@ -10,7 +10,7 @@ public sealed class DamageStateVisualizerSystem : VisualizerSystem(uid, MobStateVisuals.State, out var data, args.Component)) { return; } diff --git a/Content.Client/Disease/DiseaseMachineSystem.cs b/Content.Client/Disease/DiseaseMachineSystem.cs index e81aadfe73..d831aee507 100644 --- a/Content.Client/Disease/DiseaseMachineSystem.cs +++ b/Content.Client/Disease/DiseaseMachineSystem.cs @@ -14,8 +14,8 @@ namespace Content.Client.Disease if (args.Sprite == null) return; - if (args.Component.TryGetData(DiseaseMachineVisuals.IsOn, out bool isOn) - && args.Component.TryGetData(DiseaseMachineVisuals.IsRunning, out bool isRunning)) + if (AppearanceSystem.TryGetData(uid, DiseaseMachineVisuals.IsOn, out var isOn, args.Component) + && AppearanceSystem.TryGetData(uid, DiseaseMachineVisuals.IsRunning, out var isRunning, args.Component)) { var state = isRunning ? component.RunningState : component.IdleState; args.Sprite.LayerSetVisible(DiseaseMachineVisualLayers.IsOn, isOn); diff --git a/Content.Client/Ensnaring/EnsnareableSystem.cs b/Content.Client/Ensnaring/EnsnareableSystem.cs index dd4c76e6b1..b7a5a45ca0 100644 --- a/Content.Client/Ensnaring/EnsnareableSystem.cs +++ b/Content.Client/Ensnaring/EnsnareableSystem.cs @@ -6,6 +6,8 @@ namespace Content.Client.Ensnaring.Visualizers; public sealed class EnsnareableSystem : SharedEnsnareableSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -28,7 +30,7 @@ public sealed class EnsnareableSystem : SharedEnsnareableSystem if (args.Sprite == null || !args.Sprite.LayerMapTryGet(EnsnaredVisualLayers.Ensnared, out var layer)) return; - if (args.Component.TryGetData(EnsnareableVisuals.IsEnsnared, out bool isEnsnared)) + if (_appearance.TryGetData(uid, EnsnareableVisuals.IsEnsnared, out var isEnsnared, args.Component)) { if (component.Sprite != null) { diff --git a/Content.Client/Explosion/TriggerSystem.Proximity.cs b/Content.Client/Explosion/TriggerSystem.Proximity.cs index 6e76e14631..7c98e1374d 100644 --- a/Content.Client/Explosion/TriggerSystem.Proximity.cs +++ b/Content.Client/Explosion/TriggerSystem.Proximity.cs @@ -9,6 +9,7 @@ namespace Content.Client.Explosion; public sealed partial class TriggerSystem { [Dependency] private readonly AnimationPlayerSystem _player = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; /* * Currently all of the appearance stuff is hardcoded for portable flashers @@ -53,7 +54,7 @@ public sealed partial class TriggerSystem if (!TryComp(uid, out var appearance)) return; // So animation doesn't get spammed if no server state comes in. - appearance.SetData(ProximityTriggerVisualState.State, ProximityTriggerVisuals.Inactive); + _appearance.SetData(uid, ProximityTriggerVisualState.State, ProximityTriggerVisuals.Inactive, appearance); OnChangeData(uid, component, appearance); } @@ -73,7 +74,7 @@ public sealed partial class TriggerSystem return; TryComp(component.Owner, out var player); - appearance.TryGetData(ProximityTriggerVisualState.State, out ProximityTriggerVisuals state); + _appearance.TryGetData(appearance.Owner, ProximityTriggerVisualState.State, out var state, appearance); switch (state) { diff --git a/Content.Client/Fluids/PuddleVisualizerSystem.cs b/Content.Client/Fluids/PuddleVisualizerSystem.cs index 56d652799c..4710caa184 100644 --- a/Content.Client/Fluids/PuddleVisualizerSystem.cs +++ b/Content.Client/Fluids/PuddleVisualizerSystem.cs @@ -22,11 +22,6 @@ namespace Content.Client.Fluids private void OnComponentInit(EntityUid uid, PuddleVisualizerComponent puddleVisuals, ComponentInit args) { - if (!TryComp(uid, out AppearanceComponent? appearance)) - { - return; - } - if (!TryComp(uid, out SpriteComponent? sprite)) { return; @@ -45,10 +40,10 @@ namespace Content.Client.Fluids return; } - if (!args.Component.TryGetData(PuddleVisuals.VolumeScale, out float volumeScale) - || !args.Component.TryGetData(PuddleVisuals.CurrentVolume, out FixedPoint2 currentVolume) - || !args.Component.TryGetData(PuddleVisuals.SolutionColor, out Color solutionColor) - || !args.Component.TryGetData(PuddleVisuals.IsEvaporatingVisual, out bool isEvaporating)) + if (!AppearanceSystem.TryGetData(uid, PuddleVisuals.VolumeScale, out var volumeScale) + || !AppearanceSystem.TryGetData(uid, PuddleVisuals.CurrentVolume, out var currentVolume) + || !AppearanceSystem.TryGetData(uid, PuddleVisuals.SolutionColor, out var solutionColor) + || !AppearanceSystem.TryGetData(uid, PuddleVisuals.IsEvaporatingVisual, out var isEvaporating)) { return; } diff --git a/Content.Client/Kudzu/KudzuVisualizerSystem.cs b/Content.Client/Kudzu/KudzuVisualizerSystem.cs index 143ca09f6c..e26cf014f5 100644 --- a/Content.Client/Kudzu/KudzuVisualizerSystem.cs +++ b/Content.Client/Kudzu/KudzuVisualizerSystem.cs @@ -1,22 +1,20 @@ using Content.Shared.Kudzu; using Robust.Client.GameObjects; -namespace Content.Client.Kudzu +namespace Content.Client.Kudzu; + +public sealed class KudzuVisualsSystem : VisualizerSystem { - - public sealed class KudzuVisualsSystem : VisualizerSystem + protected override void OnAppearanceChange(EntityUid uid, KudzuVisualsComponent component, ref AppearanceChangeEvent args) { - protected override void OnAppearanceChange(EntityUid uid, KudzuVisualsComponent component, ref AppearanceChangeEvent args) - { - if (args.Sprite == null) - return; - if (args.Component.TryGetData(KudzuVisuals.Variant, out int var) - && args.Component.TryGetData(KudzuVisuals.GrowthLevel, out int level)) - { - var index = args.Sprite.LayerMapReserveBlank(component.Layer); - args.Sprite.LayerSetState(index, $"kudzu_{level}{var}"); - } + if (args.Sprite == null) + return; + if (AppearanceSystem.TryGetData(uid, KudzuVisuals.Variant, out var var, args.Component) + && AppearanceSystem.TryGetData(uid, KudzuVisuals.GrowthLevel, out var level, args.Component)) + { + var index = args.Sprite.LayerMapReserveBlank(component.Layer); + args.Sprite.LayerSetState(index, $"kudzu_{level}{var}"); } } } diff --git a/Content.Client/Lathe/LatheSystem.cs b/Content.Client/Lathe/LatheSystem.cs index 24585f312f..c0c3833a85 100644 --- a/Content.Client/Lathe/LatheSystem.cs +++ b/Content.Client/Lathe/LatheSystem.cs @@ -8,7 +8,7 @@ namespace Content.Client.Lathe; public sealed class LatheSystem : SharedLatheSystem { - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -22,14 +22,14 @@ public sealed class LatheSystem : SharedLatheSystem if (args.Sprite == null) return; - if (_appearance.TryGetData(uid, PowerDeviceVisuals.Powered, out bool powered, args.Component) && + if (_appearance.TryGetData(uid, PowerDeviceVisuals.Powered, out var powered, args.Component) && args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out _)) { args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); } // Lathe specific stuff - if (_appearance.TryGetData(uid, LatheVisuals.IsRunning, out bool isRunning, args.Component)) + if (_appearance.TryGetData(uid, LatheVisuals.IsRunning, out var isRunning, args.Component)) { var state = isRunning ? component.RunningState : component.IdleState; args.Sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f); diff --git a/Content.Client/Light/HandheldLightSystem.cs b/Content.Client/Light/HandheldLightSystem.cs index a4bb32f9cd..fb68c7794b 100644 --- a/Content.Client/Light/HandheldLightSystem.cs +++ b/Content.Client/Light/HandheldLightSystem.cs @@ -32,12 +32,12 @@ public sealed class HandheldLightSystem : SharedHandheldLightSystem return; } - if (!_appearance.TryGetData(uid, ToggleableLightVisuals.Enabled, out bool enabled, args.Component)) + if (!_appearance.TryGetData(uid, ToggleableLightVisuals.Enabled, out var enabled, args.Component)) { return; } - if (!_appearance.TryGetData(uid, HandheldLightVisuals.Power, out HandheldLightPowerStates state, args.Component)) + if (!_appearance.TryGetData(uid, HandheldLightVisuals.Power, out var state, args.Component)) { return; } diff --git a/Content.Client/Materials/MaterialStorageSystem.cs b/Content.Client/Materials/MaterialStorageSystem.cs index faad21fcf4..b953331eb0 100644 --- a/Content.Client/Materials/MaterialStorageSystem.cs +++ b/Content.Client/Materials/MaterialStorageSystem.cs @@ -23,7 +23,7 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem if (!args.Sprite.LayerMapTryGet(MaterialStorageVisualLayers.Inserting, out var layer)) return; - if (!_appearance.TryGetData(uid, MaterialStorageVisuals.Inserting, out bool inserting, args.Component)) + if (!_appearance.TryGetData(uid, MaterialStorageVisuals.Inserting, out var inserting, args.Component)) return; if (inserting && TryComp(uid, out var insertingComp)) diff --git a/Content.Client/Mech/MechAssemblyVisualizerSystem.cs b/Content.Client/Mech/MechAssemblyVisualizerSystem.cs index 42a2b5f534..cc89eb71f3 100644 --- a/Content.Client/Mech/MechAssemblyVisualizerSystem.cs +++ b/Content.Client/Mech/MechAssemblyVisualizerSystem.cs @@ -14,7 +14,7 @@ public sealed class MechAssemblyVisualizerSystem : VisualizerSystem(uid, MechAssemblyVisuals.State, out var stage, args.Component)) return; var state = component.StatePrefix + stage; diff --git a/Content.Client/Mech/MechSystem.cs b/Content.Client/Mech/MechSystem.cs index 77a23bc26d..57bdbf87f1 100644 --- a/Content.Client/Mech/MechSystem.cs +++ b/Content.Client/Mech/MechSystem.cs @@ -8,6 +8,8 @@ namespace Content.Client.Mech; /// public sealed class MechSystem : SharedMechSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + /// public override void Initialize() { @@ -26,12 +28,12 @@ public sealed class MechSystem : SharedMechSystem var state = component.BaseState; var drawDepth = DrawDepth.Mobs; - if (component.BrokenState != null && args.Component.TryGetData(MechVisuals.Broken, out bool broken) && broken) + if (component.BrokenState != null && _appearance.TryGetData(uid, MechVisuals.Broken, out var broken, args.Component) && broken) { state = component.BrokenState; drawDepth = DrawDepth.SmallMobs; } - else if (component.OpenState != null && args.Component.TryGetData(MechVisuals.Open, out bool open) && open) + else if (component.OpenState != null && _appearance.TryGetData(uid, MechVisuals.Open, out var open, args.Component) && open) { state = component.OpenState; drawDepth = DrawDepth.SmallMobs; diff --git a/Content.Client/Medical/Cryogenics/CryoPodSystem.cs b/Content.Client/Medical/Cryogenics/CryoPodSystem.cs index 0c6b86aef9..b3aba4e804 100644 --- a/Content.Client/Medical/Cryogenics/CryoPodSystem.cs +++ b/Content.Client/Medical/Cryogenics/CryoPodSystem.cs @@ -9,6 +9,8 @@ namespace Content.Client.Medical.Cryogenics; public sealed class CryoPodSystem: SharedCryoPodSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -54,8 +56,8 @@ public sealed class CryoPodSystem: SharedCryoPodSystem return; } - if (!args.Component.TryGetData(SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out bool isOpen) - || !args.Component.TryGetData(SharedCryoPodComponent.CryoPodVisuals.IsOn, out bool isOn)) + if (!_appearance.TryGetData(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component) + || !_appearance.TryGetData(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component)) { return; } diff --git a/Content.Client/Movement/Systems/JetpackSystem.cs b/Content.Client/Movement/Systems/JetpackSystem.cs index 637de44e09..000687c25a 100644 --- a/Content.Client/Movement/Systems/JetpackSystem.cs +++ b/Content.Client/Movement/Systems/JetpackSystem.cs @@ -14,6 +14,7 @@ public sealed class JetpackSystem : SharedJetpackSystem [Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly ClothingSystem _clothing = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -29,7 +30,7 @@ public sealed class JetpackSystem : SharedJetpackSystem private void OnJetpackAppearance(EntityUid uid, JetpackComponent component, ref AppearanceChangeEvent args) { - args.Component.TryGetData(JetpackVisuals.Enabled, out bool enabled); + _appearance.TryGetData(uid, JetpackVisuals.Enabled, out var enabled, args.Component); var state = "icon" + (enabled ? "-on" : ""); args.Sprite?.LayerSetState(0, state); diff --git a/Content.Client/Paper/UI/PaperSystem.cs b/Content.Client/Paper/UI/PaperSystem.cs index 72606c2811..f75d04a26b 100644 --- a/Content.Client/Paper/UI/PaperSystem.cs +++ b/Content.Client/Paper/UI/PaperSystem.cs @@ -11,10 +11,10 @@ public sealed class PaperSystem : VisualizerSystem if (args.Sprite == null) return; - if (args.Component.TryGetData(PaperVisuals.Status , out PaperStatus writingStatus)) + if (AppearanceSystem.TryGetData(uid, PaperVisuals.Status , out var writingStatus, args.Component)) args.Sprite.LayerSetVisible(PaperVisualLayers.Writing, writingStatus == PaperStatus.Written); - if (args.Component.TryGetData(PaperVisuals.Stamp, out string stampState)) + if (AppearanceSystem.TryGetData(uid, PaperVisuals.Stamp, out var stampState, args.Component)) { args.Sprite.LayerSetState(PaperVisualLayers.Stamp, stampState); args.Sprite.LayerSetVisible(PaperVisualLayers.Stamp, true); diff --git a/Content.Client/Pinpointer/ClientPinpointerSystem.cs b/Content.Client/Pinpointer/ClientPinpointerSystem.cs index afa5b23776..f4e79b0d34 100644 --- a/Content.Client/Pinpointer/ClientPinpointerSystem.cs +++ b/Content.Client/Pinpointer/ClientPinpointerSystem.cs @@ -8,7 +8,7 @@ namespace Content.Client.Pinpointer public sealed class ClientPinpointerSystem : SharedPinpointerSystem { [Dependency] private readonly IEyeManager _eyeManager = default!; - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { diff --git a/Content.Client/Pinpointer/PinpointerVisualizerSystem.cs b/Content.Client/Pinpointer/PinpointerVisualizerSystem.cs index 244dc00f4c..b59a2ab37c 100644 --- a/Content.Client/Pinpointer/PinpointerVisualizerSystem.cs +++ b/Content.Client/Pinpointer/PinpointerVisualizerSystem.cs @@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer return; // check if pinpointer screen is active - if (!args.Component.TryGetData(PinpointerVisuals.IsActive, out bool isActive) || !isActive) + if (!AppearanceSystem.TryGetData(uid, PinpointerVisuals.IsActive, out var isActive, args.Component) || !isActive) { sprite.LayerSetVisible(PinpointerLayers.Screen, false); return; @@ -24,8 +24,8 @@ namespace Content.Client.Pinpointer sprite.LayerSetVisible(PinpointerLayers.Screen, true); // check distance and direction to target - if (!args.Component.TryGetData(PinpointerVisuals.TargetDistance, out Distance dis) || - !args.Component.TryGetData(PinpointerVisuals.ArrowAngle, out Angle angle)) + if (!AppearanceSystem.TryGetData(uid, PinpointerVisuals.TargetDistance, out var dis, args.Component) || + !AppearanceSystem.TryGetData(uid, PinpointerVisuals.ArrowAngle, out var angle, args.Component)) { sprite.LayerSetState(PinpointerLayers.Screen, "pinonnull"); sprite.LayerSetRotation(PinpointerLayers.Screen, Angle.Zero); diff --git a/Content.Client/Power/Visualizers/CableVisualizerSystem.cs b/Content.Client/Power/Visualizers/CableVisualizerSystem.cs index c0f7e0865f..aa518d4019 100644 --- a/Content.Client/Power/Visualizers/CableVisualizerSystem.cs +++ b/Content.Client/Power/Visualizers/CableVisualizerSystem.cs @@ -1,20 +1,17 @@ using Content.Client.SubFloor; -using Content.Shared.SubFloor; using Content.Shared.Wires; using Robust.Client.GameObjects; namespace Content.Client.Power.Visualizers; -public sealed partial class CableVisualizerSystem : EntitySystem +public sealed class CableVisualizerSystem : VisualizerSystem { public override void Initialize() { - base.Initialize(); - - SubscribeLocalEvent(OnAppearanceChanged, after: new[] { typeof(SubFloorHideSystem) }); + SubscribeLocalEvent(OnAppearanceChange, after: new[] { typeof(SubFloorHideSystem) }); } - private void OnAppearanceChanged(EntityUid uid, CableVisualizerComponent component, ref AppearanceChangeEvent args) + protected override void OnAppearanceChange(EntityUid uid, CableVisualizerComponent component, ref AppearanceChangeEvent args) { if (args.Sprite == null) return; @@ -26,10 +23,9 @@ public sealed partial class CableVisualizerSystem : EntitySystem return; } - if (!args.Component.TryGetData(WireVisVisuals.ConnectedMask, out WireVisDirFlags mask)) + if (!AppearanceSystem.TryGetData(uid, WireVisVisuals.ConnectedMask, out var mask, args.Component)) mask = WireVisDirFlags.None; args.Sprite.LayerSetState(0, $"{component.StatePrefix}{(int) mask}"); } - } diff --git a/Content.Client/PowerCell/PowerCellSystem.cs b/Content.Client/PowerCell/PowerCellSystem.cs index eb4e338e78..ec69f0d56b 100644 --- a/Content.Client/PowerCell/PowerCellSystem.cs +++ b/Content.Client/PowerCell/PowerCellSystem.cs @@ -7,6 +7,8 @@ namespace Content.Client.PowerCell; [UsedImplicitly] public sealed class PowerCellSystem : SharedPowerCellSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -21,7 +23,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem if (!args.Sprite.TryGetLayer((int) PowerCellVisualLayers.Unshaded, out var unshadedLayer)) return; - if (args.Component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level)) + if (_appearance.TryGetData(uid, PowerCellVisuals.ChargeLevel, out var level, args.Component)) { if (level == 0) { diff --git a/Content.Client/Revenant/RevenantSystem.cs b/Content.Client/Revenant/RevenantSystem.cs index a074caa0d2..6e7d0d2a1b 100644 --- a/Content.Client/Revenant/RevenantSystem.cs +++ b/Content.Client/Revenant/RevenantSystem.cs @@ -6,6 +6,8 @@ namespace Content.Client.Revenant; public sealed class RevenantSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -18,15 +20,15 @@ public sealed class RevenantSystem : EntitySystem if (args.Sprite == null) return; - if (args.Component.TryGetData(RevenantVisuals.Harvesting, out bool harvesting) && harvesting) + if (_appearance.TryGetData(uid, RevenantVisuals.Harvesting, out var harvesting, args.Component) && harvesting) { args.Sprite.LayerSetState(0, component.HarvestingState); } - else if (args.Component.TryGetData(RevenantVisuals.Stunned, out bool stunned) && stunned) + else if (_appearance.TryGetData(uid, RevenantVisuals.Stunned, out var stunned, args.Component) && stunned) { args.Sprite.LayerSetState(0, component.StunnedState); } - else if (args.Component.TryGetData(RevenantVisuals.Corporeal, out bool corporeal)) + else if (_appearance.TryGetData(uid, RevenantVisuals.Corporeal, out var corporeal, args.Component)) { if (corporeal) args.Sprite.LayerSetState(0, component.CorporealState); diff --git a/Content.Client/Singularity/Systems/EmitterSystem.cs b/Content.Client/Singularity/Systems/EmitterSystem.cs index 599b133326..5eb80928d8 100644 --- a/Content.Client/Singularity/Systems/EmitterSystem.cs +++ b/Content.Client/Singularity/Systems/EmitterSystem.cs @@ -8,7 +8,7 @@ namespace Content.Client.Singularity.Systems; public sealed class EmitterSystem : SharedEmitterSystem { - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; /// public override void Initialize() @@ -23,13 +23,13 @@ public sealed class EmitterSystem : SharedEmitterSystem if (args.Sprite.LayerMapTryGet(StorageVisualLayers.Lock, out var lockLayer)) { - if (!_appearance.TryGetData(uid, StorageVisuals.Locked, out bool locked, args.Component)) + if (!_appearance.TryGetData(uid, StorageVisuals.Locked, out var locked, args.Component)) locked = false; args.Sprite.LayerSetVisible(lockLayer, locked); } - if (!_appearance.TryGetData(uid, EmitterVisuals.VisualState, out EmitterVisualState state, args.Component)) + if (!_appearance.TryGetData(uid, EmitterVisuals.VisualState, out var state, args.Component)) state = EmitterVisualState.Off; if (!args.Sprite.LayerMapTryGet(EmitterVisualLayers.Lights, out var layer)) diff --git a/Content.Client/Sticky/Visualizers/StickyVisualizerSystem.cs b/Content.Client/Sticky/Visualizers/StickyVisualizerSystem.cs index 3dff5c86d4..8bf8ac56ea 100644 --- a/Content.Client/Sticky/Visualizers/StickyVisualizerSystem.cs +++ b/Content.Client/Sticky/Visualizers/StickyVisualizerSystem.cs @@ -24,7 +24,7 @@ public sealed class StickyVisualizerSystem : VisualizerSystem(uid, StickyVisuals.IsStuck, out var isStuck, args.Component)) return; var drawDepth = isStuck ? component.StuckDrawDepth : component.DefaultDrawDepth; diff --git a/Content.Client/Storage/Systems/ItemMapperSystem.cs b/Content.Client/Storage/Systems/ItemMapperSystem.cs index 421713ee8e..5472126ada 100644 --- a/Content.Client/Storage/Systems/ItemMapperSystem.cs +++ b/Content.Client/Storage/Systems/ItemMapperSystem.cs @@ -8,6 +8,8 @@ namespace Content.Client.Storage.Systems; public sealed class ItemMapperSystem : SharedItemMapperSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -38,7 +40,7 @@ public sealed class ItemMapperSystem : SharedItemMapperSystem private void InitLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance) { - if (!appearance.TryGetData(StorageMapVisuals.InitLayers, out var wrapper)) + if (!_appearance.TryGetData(appearance.Owner, StorageMapVisuals.InitLayers, out var wrapper, appearance)) return; component.SpriteLayers.AddRange(wrapper.QueuedEntities); @@ -53,7 +55,7 @@ public sealed class ItemMapperSystem : SharedItemMapperSystem private void EnableLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance) { - if (!appearance.TryGetData(StorageMapVisuals.LayerChanged, out var wrapper)) + if (!_appearance.TryGetData(appearance.Owner, StorageMapVisuals.LayerChanged, out var wrapper, appearance)) return; foreach (var layerName in component.SpriteLayers) diff --git a/Content.Client/Storage/Visualizers/StorageFillVisualizerSystem.cs b/Content.Client/Storage/Visualizers/StorageFillVisualizerSystem.cs index 22f3f9ccc5..cb949ebbfd 100644 --- a/Content.Client/Storage/Visualizers/StorageFillVisualizerSystem.cs +++ b/Content.Client/Storage/Visualizers/StorageFillVisualizerSystem.cs @@ -14,7 +14,7 @@ public sealed class StorageFillVisualizerSystem : VisualizerSystem(uid, StorageFillVisuals.FillLevel, out var level, args.Component)) return; var state = $"{component.FillBaseName}-{level}"; diff --git a/Content.Client/SubFloor/SubFloorHideSystem.cs b/Content.Client/SubFloor/SubFloorHideSystem.cs index c7b14b60e2..0532f177de 100644 --- a/Content.Client/SubFloor/SubFloorHideSystem.cs +++ b/Content.Client/SubFloor/SubFloorHideSystem.cs @@ -5,7 +5,7 @@ namespace Content.Client.SubFloor; public sealed class SubFloorHideSystem : SharedSubFloorHideSystem { - [Dependency] private readonly AppearanceSystem _appearanceSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private bool _showAll; @@ -34,8 +34,8 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem if (args.Sprite == null) return; - args.Component.TryGetData(SubFloorVisuals.Covered, out bool covered); - args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool scannerRevealed); + _appearance.TryGetData(uid, SubFloorVisuals.Covered, out var covered, args.Component); + _appearance.TryGetData(uid, SubFloorVisuals.ScannerRevealed, out var scannerRevealed, args.Component); scannerRevealed &= !ShowAll; // no transparency for show-subfloor mode. @@ -46,7 +46,7 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem foreach (var layer in args.Sprite.AllLayers) { // pipe connection visuals are updated AFTER this, and may re-hide some layers - layer.Visible = revealed; + layer.Visible = revealed; if (layer.Visible) layer.Color = layer.Color.WithAlpha(transparency); @@ -72,7 +72,7 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem { foreach (var (_, appearance) in EntityManager.EntityQuery(true)) { - _appearanceSystem.MarkDirty(appearance, true); + _appearance.MarkDirty(appearance, true); } } } diff --git a/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs index 24f1c3b194..47c0157499 100644 --- a/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs +++ b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs @@ -23,10 +23,10 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem(uid, ToggleableLightVisuals.Enabled, out var enabled, args.Component)) return; - var modulate = args.Component.TryGetData(ToggleableLightVisuals.Color, out Color color); + var modulate = AppearanceSystem.TryGetData(uid, ToggleableLightVisuals.Color, out var color, args.Component); // Update the item's sprite if (args.Sprite != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer)) @@ -55,14 +55,14 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem(uid, ToggleableLightVisuals.Enabled, out var enabled, appearance) || !enabled) return; if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers)) return; - var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); + var modulate = AppearanceSystem.TryGetData(uid, ToggleableLightVisuals.Color, out var color, appearance); var i = 0; foreach (var layer in layers) @@ -84,14 +84,14 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem(uid, ToggleableLightVisuals.Enabled, out var enabled, appearance) || !enabled) return; if (!component.InhandVisuals.TryGetValue(args.Location, out var layers)) return; - var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); + var modulate = AppearanceSystem.TryGetData(uid, ToggleableLightVisuals.Color, out var color, appearance); var i = 0; var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-toggle"; diff --git a/Content.Client/Toilet/ToiletVisualsSystem.cs b/Content.Client/Toilet/ToiletVisualsSystem.cs index f5b7aa5f9c..5367772ab0 100644 --- a/Content.Client/Toilet/ToiletVisualsSystem.cs +++ b/Content.Client/Toilet/ToiletVisualsSystem.cs @@ -9,8 +9,8 @@ public sealed class ToiletVisualsSystem : VisualizerSystem { if (args.Sprite == null) return; - args.Component.TryGetData(ToiletVisuals.LidOpen, out bool lidOpen); - args.Component.TryGetData(ToiletVisuals.SeatUp, out bool seatUp); + AppearanceSystem.TryGetData(uid, ToiletVisuals.LidOpen, out var lidOpen, args.Component); + AppearanceSystem.TryGetData(uid, ToiletVisuals.SeatUp, out var seatUp, args.Component); var state = (lidOpen, seatUp) switch { diff --git a/Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs b/Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs index 2a643d034b..b34c6ffc8a 100644 --- a/Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs +++ b/Content.Client/Tools/Visualizers/WeldableVisualizerSystem.cs @@ -11,7 +11,7 @@ public sealed class WeldableVisualizerSystem : VisualizerSystem(uid, WeldableVisuals.IsWelded, out var isWelded, args.Component); if (args.Sprite.LayerMapTryGet(WeldableLayers.BaseWelded, out var layer)) { args.Sprite.LayerSetVisible(layer, isWelded); diff --git a/Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs b/Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs index 88d8ce1cab..02df7d98b0 100644 --- a/Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs +++ b/Content.Client/Tools/Visualizers/WelderVisualizerSystem.cs @@ -11,7 +11,7 @@ public sealed class WelderVisualizerSystem : VisualizerSystem if (args.Sprite == null) return; - if (args.Component.TryGetData(WelderVisuals.Lit, out bool isLit)) + if (AppearanceSystem.TryGetData(uid, WelderVisuals.Lit, out var isLit, args.Component)) { args.Sprite.LayerSetVisible(WelderLayers.Flame, isLit); } diff --git a/Content.Client/Vehicle/VehicleVisualsSystem.cs b/Content.Client/Vehicle/VehicleVisualsSystem.cs index 07738c04c9..9fbbebc935 100644 --- a/Content.Client/Vehicle/VehicleVisualsSystem.cs +++ b/Content.Client/Vehicle/VehicleVisualsSystem.cs @@ -15,13 +15,13 @@ namespace Content.Client.Vehicle return; // First check is for the sprite itself - if (args.Component.TryGetData(VehicleVisuals.DrawDepth, out int drawDepth)) + if (AppearanceSystem.TryGetData(uid, VehicleVisuals.DrawDepth, out var drawDepth, args.Component)) { args.Sprite.DrawDepth = drawDepth; } // Set vehicle layer to animated or not (i.e. are the wheels turning or not) - if (args.Component.TryGetData(VehicleVisuals.AutoAnimate, out bool autoAnimate)) + if (AppearanceSystem.TryGetData(uid, VehicleVisuals.AutoAnimate, out var autoAnimate, args.Component)) { args.Sprite.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate); } diff --git a/Content.Server/AirlockPainter/AirlockPainterSystem.cs b/Content.Server/AirlockPainter/AirlockPainterSystem.cs index 9b462745b3..f208366221 100644 --- a/Content.Server/AirlockPainter/AirlockPainterSystem.cs +++ b/Content.Server/AirlockPainter/AirlockPainterSystem.cs @@ -24,6 +24,7 @@ namespace Content.Server.AirlockPainter [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -40,10 +41,10 @@ namespace Content.Server.AirlockPainter { ev.Component.IsSpraying = false; if (TryComp(ev.Target, out var appearance) && - TryComp(ev.Target, out PaintableAirlockComponent? airlock)) + TryComp(ev.Target, out PaintableAirlockComponent? _)) { SoundSystem.Play(ev.Component.SpraySound.GetSound(), Filter.Pvs(ev.UsedTool, entityManager:EntityManager), ev.UsedTool); - appearance.SetData(DoorVisuals.BaseRSI, ev.Sprite); + _appearance.SetData(ev.Target, DoorVisuals.BaseRSI, ev.Sprite, appearance); // Log success _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(ev.User):user} painted {ToPrettyString(ev.Target):target}"); diff --git a/Content.Server/AlertLevel/AlertLevelDisplaySystem.cs b/Content.Server/AlertLevel/AlertLevelDisplaySystem.cs index 1660cc68cf..c6fdbf5817 100644 --- a/Content.Server/AlertLevel/AlertLevelDisplaySystem.cs +++ b/Content.Server/AlertLevel/AlertLevelDisplaySystem.cs @@ -1,11 +1,13 @@ using Content.Server.Station.Systems; using Content.Shared.AlertLevel; +using Robust.Server.GameObjects; namespace Content.Server.AlertLevel; public sealed class AlertLevelDisplaySystem : EntitySystem { [Dependency] private readonly StationSystem _stationSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -17,7 +19,7 @@ public sealed class AlertLevelDisplaySystem : EntitySystem { foreach (var (_, appearance) in EntityManager.EntityQuery()) { - appearance.SetData(AlertLevelDisplay.CurrentLevel, args.AlertLevel); + _appearance.SetData(appearance.Owner, AlertLevelDisplay.CurrentLevel, args.AlertLevel, appearance); } } @@ -28,7 +30,7 @@ public sealed class AlertLevelDisplaySystem : EntitySystem var stationUid = _stationSystem.GetOwningStation(uid); if (stationUid != null && TryComp(stationUid, out AlertLevelComponent? alert)) { - appearance.SetData(AlertLevelDisplay.CurrentLevel, alert.CurrentLevel); + _appearance.SetData(uid, AlertLevelDisplay.CurrentLevel, alert.CurrentLevel, appearance); } } } diff --git a/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs b/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs index 7a8fde5efa..43a0c17efa 100644 --- a/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs +++ b/Content.Server/Atmos/Components/AtmosPlaqueComponent.cs @@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components set { Type = value; - EntitySystem.Get().UpdateSign(this); + EntitySystem.Get().UpdateSign(Owner, this); } } } diff --git a/Content.Server/Atmos/EntitySystems/AtmosPlaqueSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosPlaqueSystem.cs index 609f3b95d9..ed514278a6 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosPlaqueSystem.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosPlaqueSystem.cs @@ -1,5 +1,6 @@ using Content.Server.Atmos.Components; using Content.Shared.Atmos.Visuals; +using Robust.Server.GameObjects; using Robust.Shared.Random; namespace Content.Server.Atmos.EntitySystems; @@ -7,6 +8,7 @@ namespace Content.Server.Atmos.EntitySystems; public sealed class AtmosPlaqueSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -27,10 +29,10 @@ public sealed class AtmosPlaqueSystem : EntitySystem // 45% LINDA else component.Type = PlaqueType.Linda; - UpdateSign(component); + UpdateSign(uid, component); } - public void UpdateSign(AtmosPlaqueComponent component) + public void UpdateSign(EntityUid uid, AtmosPlaqueComponent component) { var metaData = MetaData(component.Owner); @@ -70,7 +72,7 @@ public sealed class AtmosPlaqueSystem : EntitySystem { var state = component.Type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque"; - appearance.SetData(AtmosPlaqueVisuals.State, state); + _appearance.SetData(uid, AtmosPlaqueVisuals.State, state, appearance); } } } diff --git a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs index 3efaa5b513..0a7fa1eaba 100644 --- a/Content.Server/Atmos/EntitySystems/FlammableSystem.cs +++ b/Content.Server/Atmos/EntitySystems/FlammableSystem.cs @@ -35,6 +35,7 @@ namespace Content.Server.Atmos.EntitySystems [Dependency] private readonly FixtureSystem _fixture = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public const float MinimumFireStacks = -10f; public const float MaximumFireStacks = 20f; @@ -176,8 +177,8 @@ namespace Content.Server.Atmos.EntitySystems if (!Resolve(uid, ref flammable, ref appearance)) return; - appearance.SetData(FireVisuals.OnFire, flammable.OnFire); - appearance.SetData(FireVisuals.FireStacks, flammable.FireStacks); + _appearance.SetData(uid, FireVisuals.OnFire, flammable.OnFire, appearance); + _appearance.SetData(uid, FireVisuals.FireStacks, flammable.FireStacks, appearance); } public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null) diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs index c8bbec7033..87c2288402 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs @@ -24,6 +24,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -146,7 +147,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump, ref appearance, false)) return; - appearance.SetData(PumpVisuals.Enabled, pump.Enabled); + _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance); } } } diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs index 67625d9f39..6f1f2acfab 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasValveSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Audio; using Content.Shared.Examine; using Content.Shared.Interaction; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; @@ -15,6 +16,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems public sealed class GasValveSystem : EntitySystem { [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -58,7 +60,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems { if (TryComp(component.Owner,out var appearance)) { - appearance.SetData(FilterVisuals.Enabled, component.Open); + _appearance.SetData(uid, FilterVisuals.Enabled, component.Open, appearance); } if (component.Open) { diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs index e1a547512d..2d648933fd 100644 --- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs +++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs @@ -26,6 +26,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -160,7 +161,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems if (!Resolve(uid, ref pump, ref appearance, false)) return; - appearance.SetData(PumpVisuals.Enabled, pump.Enabled); + _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance); } } } diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs index 824683e380..6fbf60f403 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeAppearanceSystem.cs @@ -3,6 +3,7 @@ using Content.Server.NodeContainer.EntitySystems; using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos; using Content.Shared.Atmos.Components; +using Robust.Server.GameObjects; using Robust.Shared.Map; namespace Content.Server.Atmos.Piping.EntitySystems; @@ -10,6 +11,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems; public sealed class AtmosPipeAppearanceSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -69,6 +71,6 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem }; } - appearance.SetData(PipeVisuals.VisualState, netConnectedDirections); + _appearance.SetData(uid, PipeVisuals.VisualState, netConnectedDirections, appearance); } } diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs index 70103e63c5..b9ee668032 100644 --- a/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs +++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosPipeColorSystem.cs @@ -1,10 +1,13 @@ using Content.Server.Atmos.Piping.Components; using Content.Shared.Atmos.Piping; +using Robust.Server.GameObjects; namespace Content.Server.Atmos.Piping.EntitySystems { public sealed class AtmosPipeColorSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -18,7 +21,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(PipeColorVisuals.Color, component.Color); + _appearance.SetData(uid, PipeColorVisuals.Color, component.Color, appearance); } private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args) @@ -26,7 +29,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(PipeColorVisuals.Color, Color.White); + _appearance.SetData(uid, PipeColorVisuals.Color, Color.White, appearance); } public void SetColor(EntityUid uid, AtmosPipeColorComponent component, Color color) @@ -36,7 +39,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(PipeColorVisuals.Color, color); + _appearance.SetData(uid, PipeColorVisuals.Color, color, appearance); } } } diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs index 9de18bb2b5..2da43d654b 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs @@ -23,6 +23,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems [Dependency] private IAdminLogManager _adminLogger = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -174,7 +175,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!Resolve(uid, ref mixer, ref appearance, false)) return; - appearance.SetData(FilterVisuals.Enabled, mixer.Enabled); + _appearance.SetData(uid, FilterVisuals.Enabled, mixer.Enabled, appearance); } private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args) diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs index c435dc5af0..f424719455 100644 --- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs +++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs @@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos.Piping; using Content.Shared.Audio; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Timing; namespace Content.Server.Atmos.Piping.Trinary.EntitySystems @@ -16,6 +17,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems [Dependency] private IGameTiming _gameTiming = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -90,7 +92,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems if (!Resolve(uid, ref comp, ref appearance, false)) return; - appearance.SetData(FilterVisuals.Enabled, comp.Enabled); + _appearance.SetData(uid, FilterVisuals.Enabled, comp.Enabled, appearance); } } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs index 3ef81d0f24..6abdbd2b59 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs @@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos.Piping; using Content.Shared.Interaction; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Timing; namespace Content.Server.Atmos.Piping.Unary.EntitySystems @@ -15,6 +16,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems { [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -27,21 +29,21 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems private void OnMapInit(EntityUid uid, GasOutletInjectorComponent component, MapInitEvent args) { - UpdateAppearance(component); + UpdateAppearance(uid, component); } private void OnActivate(EntityUid uid, GasOutletInjectorComponent component, ActivateInWorldEvent args) { component.Enabled = !component.Enabled; - UpdateAppearance(component); + UpdateAppearance(uid, component); } - public void UpdateAppearance(GasOutletInjectorComponent component, AppearanceComponent? appearance = null) + public void UpdateAppearance(EntityUid uid, GasOutletInjectorComponent component, AppearanceComponent? appearance = null) { if (!Resolve(component.Owner, ref appearance, false)) return; - appearance.SetData(OutletInjectorVisuals.Enabled, component.Enabled); + _appearance.SetData(uid, OutletInjectorVisuals.Enabled, component.Enabled, appearance); } private void OnOutletInjectorUpdated(EntityUid uid, GasOutletInjectorComponent injector, AtmosDeviceUpdateEvent args) diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs index 1a13152f22..968344acc0 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPortableSystem.cs @@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes; using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Construction.Components; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Map; namespace Content.Server.Atmos.Piping.Unary.EntitySystems @@ -14,6 +15,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems public sealed class GasPortableSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -46,7 +48,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - appearance.SetData(GasPortableVisuals.ConnectedState, args.Anchored); + _appearance.SetData(uid, GasPortableVisuals.ConnectedState, args.Anchored, appearance); } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs index 5cbf5727a1..53ce579b1c 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Atmos.Visuals; using Content.Shared.Audio; using Content.Shared.Examine; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Timing; namespace Content.Server.Atmos.Piping.Unary.EntitySystems @@ -30,6 +31,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems [Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -243,20 +245,20 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!vent.Enabled) { _ambientSoundSystem.SetAmbience(uid, false); - appearance.SetData(VentPumpVisuals.State, VentPumpState.Off); + _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Off, appearance); } else if (vent.PumpDirection == VentPumpDirection.Releasing) { - appearance.SetData(VentPumpVisuals.State, VentPumpState.Out); + _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Out, appearance); } else if (vent.PumpDirection == VentPumpDirection.Siphoning) { - appearance.SetData(VentPumpVisuals.State, VentPumpState.In); + _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.In, appearance); } else if (vent.Welded) { _ambientSoundSystem.SetAmbience(uid, false); - appearance.SetData(VentPumpVisuals.State, VentPumpState.Welded); + _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Welded, appearance); } } diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs index 05d9a1dec3..b33bfd9aee 100644 --- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs +++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs @@ -28,6 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems [Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -185,20 +186,20 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems if (!scrubber.Enabled) { _ambientSoundSystem.SetAmbience(uid, false); - appearance.SetData(ScrubberVisuals.State, ScrubberState.Off); + _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance); } else if (scrubber.PumpDirection == ScrubberPumpDirection.Scrubbing) { - appearance.SetData(ScrubberVisuals.State, scrubber.WideNet ? ScrubberState.WideScrub : ScrubberState.Scrub); + _appearance.SetData(uid, ScrubberVisuals.State, scrubber.WideNet ? ScrubberState.WideScrub : ScrubberState.Scrub, appearance); } else if (scrubber.PumpDirection == ScrubberPumpDirection.Siphoning) { - appearance.SetData(ScrubberVisuals.State, ScrubberState.Siphon); + _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Siphon, appearance); } else if (scrubber.Welded) { _ambientSoundSystem.SetAmbience(uid, false); - appearance.SetData(ScrubberVisuals.State, ScrubberState.Welded); + _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance); } } } diff --git a/Content.Server/Cabinet/ItemCabinetSystem.cs b/Content.Server/Cabinet/ItemCabinetSystem.cs index c00b8850d7..4a7a22e289 100644 --- a/Content.Server/Cabinet/ItemCabinetSystem.cs +++ b/Content.Server/Cabinet/ItemCabinetSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Cabinet; using Content.Shared.Containers.ItemSlots; using Content.Shared.Interaction; using Content.Shared.Verbs; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.Player; @@ -14,6 +15,7 @@ namespace Content.Server.Cabinet { [Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -54,8 +56,8 @@ namespace Content.Server.Cabinet if (!Resolve(uid, ref cabinet, ref appearance, false)) return; - appearance.SetData(ItemCabinetVisuals.IsOpen, cabinet.Opened); - appearance.SetData(ItemCabinetVisuals.ContainsItem, cabinet.CabinetSlot.HasItem); + _appearance.SetData(uid, ItemCabinetVisuals.IsOpen, cabinet.Opened, appearance); + _appearance.SetData(uid, ItemCabinetVisuals.ContainsItem, cabinet.CabinetSlot.HasItem, appearance); } private void OnContainerModified(EntityUid uid, ItemCabinetComponent cabinet, ContainerModifiedMessage args) diff --git a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs index b255d76fb4..44af5b197c 100644 --- a/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs +++ b/Content.Server/Chat/TypingIndicator/TypingIndicatorSystem.cs @@ -10,6 +10,7 @@ namespace Content.Server.Chat.TypingIndicator; public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem { [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -58,6 +59,6 @@ public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem if (!Resolve(uid, ref appearance, false)) return; - appearance.SetData(TypingIndicatorVisuals.IsTyping, isEnabled); + _appearance.SetData(uid, TypingIndicatorVisuals.IsTyping, isEnabled, appearance); } } diff --git a/Content.Server/Construction/Completions/VisualizerDataInt.cs b/Content.Server/Construction/Completions/VisualizerDataInt.cs index 1ffe619345..c45e36becf 100644 --- a/Content.Server/Construction/Completions/VisualizerDataInt.cs +++ b/Content.Server/Construction/Completions/VisualizerDataInt.cs @@ -1,5 +1,6 @@ using Content.Shared.Construction; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Reflection; using Robust.Shared.Serialization; @@ -9,6 +10,8 @@ namespace Content.Server.Construction.Completions [DataDefinition] public sealed class VisualizerDataInt : IGraphAction, ISerializationHooks { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + [DataField("key")] public string Key { get; private set; } = string.Empty; [DataField("data")] public int Data { get; private set; } = 0; @@ -18,9 +21,9 @@ namespace Content.Server.Construction.Completions if (entityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - if(IoCManager.Resolve().TryParseEnumReference(Key, out var @enum)) + if (IoCManager.Resolve().TryParseEnumReference(Key, out var @enum)) { - appearance.SetData(@enum, Data); + _appearance.SetData(uid, @enum, Data, appearance); } } } diff --git a/Content.Server/Disease/DiseaseDiagnosisSystem.cs b/Content.Server/Disease/DiseaseDiagnosisSystem.cs index 90f6e8d8cc..2cabef4e63 100644 --- a/Content.Server/Disease/DiseaseDiagnosisSystem.cs +++ b/Content.Server/Disease/DiseaseDiagnosisSystem.cs @@ -18,6 +18,7 @@ using Robust.Shared.Utility; using Content.Shared.Tools.Components; using Content.Server.Station.Systems; using Content.Shared.IdentityManagement; +using Robust.Server.GameObjects; namespace Content.Server.Disease { @@ -31,8 +32,8 @@ namespace Content.Server.Disease [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly PaperSystem _paperSystem = default!; - [Dependency] private readonly StationSystem _stationSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -298,8 +299,8 @@ namespace Content.Server.Disease if (!TryComp(uid, out var appearance)) return; - appearance.SetData(DiseaseMachineVisuals.IsOn, isOn); - appearance.SetData(DiseaseMachineVisuals.IsRunning, isRunning); + _appearance.SetData(uid, DiseaseMachineVisuals.IsOn, isOn, appearance); + _appearance.SetData(uid, DiseaseMachineVisuals.IsRunning, isRunning, appearance); } /// /// Makes sure the machine is visually off/on. diff --git a/Content.Server/Doors/Systems/FirelockSystem.cs b/Content.Server/Doors/Systems/FirelockSystem.cs index 2597ca943f..c23745423f 100644 --- a/Content.Server/Doors/Systems/FirelockSystem.cs +++ b/Content.Server/Doors/Systems/FirelockSystem.cs @@ -25,7 +25,7 @@ namespace Content.Server.Doors.Systems [Dependency] private readonly SharedDoorSystem _doorSystem = default!; [Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!; [Dependency] private readonly AtmosphereSystem _atmosSystem = default!; - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private static float _visualUpdateInterval = 0.5f; private float _accumulatedFrameTime; diff --git a/Content.Server/Drone/DroneSystem.cs b/Content.Server/Drone/DroneSystem.cs index bcbf246305..00bde35a58 100644 --- a/Content.Server/Drone/DroneSystem.cs +++ b/Content.Server/Drone/DroneSystem.cs @@ -20,6 +20,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Popups; using Content.Shared.Tag; using Content.Shared.Throwing; +using Robust.Server.GameObjects; using Robust.Shared.Player; using Robust.Shared.Timing; @@ -34,6 +35,7 @@ namespace Content.Server.Drone [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly InnateToolSystem _innateToolSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -120,7 +122,7 @@ namespace Content.Server.Drone { if (TryComp(uid, out var appearance)) { - appearance.SetData(DroneVisuals.Status, status); + _appearance.SetData(uid, DroneVisuals.Status, status, appearance); } } diff --git a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs index 355de065ed..d14da2a619 100644 --- a/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ClusterGrenadeSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Explosion; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Throwing; +using Robust.Server.GameObjects; using Robust.Shared.Containers; using Robust.Shared.Random; @@ -15,6 +16,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem [Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly TriggerSystem _trigger = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -35,7 +37,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem if (component.FillPrototype != null) { component.UnspawnedCount = Math.Max(0, component.MaxGrenades - component.GrenadesContainer.ContainedEntities.Count); - UpdateAppearance(component); + UpdateAppearance(uid, component); } } @@ -49,7 +51,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem return; component.GrenadesContainer.Insert(args.Used); - UpdateAppearance(component); + UpdateAppearance(uid, component); args.Handled = true; } @@ -122,10 +124,10 @@ public sealed class ClusterGrenadeSystem : EntitySystem return false; } - private void UpdateAppearance(ClusterGrenadeComponent component) + private void UpdateAppearance(EntityUid uid, ClusterGrenadeComponent component) { if (!TryComp(component.Owner, out var appearance)) return; - appearance.SetData(ClusterGrenadeVisuals.GrenadesCounter, component.GrenadesContainer.ContainedEntities.Count + component.UnspawnedCount); + _appearance.SetData(uid, ClusterGrenadeVisuals.GrenadesCounter, component.GrenadesContainer.ContainedEntities.Count + component.UnspawnedCount, appearance); } } diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs index 2da099428b..07f44f7564 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.Proximity.cs @@ -1,6 +1,7 @@ using Content.Server.Explosion.Components; using Content.Shared.Physics; using Content.Shared.Trigger; +using Robust.Server.GameObjects; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Dynamics; using Robust.Shared.Physics.Events; @@ -10,6 +11,8 @@ namespace Content.Server.Explosion.EntitySystems; public sealed partial class TriggerSystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + /// /// Anything that has stuff touching it (to check speed) or is on cooldown. /// @@ -86,9 +89,9 @@ public sealed partial class TriggerSystem private void SetProximityAppearance(EntityUid uid, TriggerOnProximityComponent component) { - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - appearanceComponent.SetData(ProximityTriggerVisualState.State, component.Enabled ? ProximityTriggerVisuals.Inactive : ProximityTriggerVisuals.Off); + _appearance.SetData(uid, ProximityTriggerVisualState.State, component.Enabled ? ProximityTriggerVisuals.Inactive : ProximityTriggerVisuals.Off, appearance); } } @@ -107,9 +110,9 @@ public sealed partial class TriggerSystem component.Accumulator += component.Cooldown; } - if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { - appearanceComponent.SetData(ProximityTriggerVisualState.State, ProximityTriggerVisuals.Active); + _appearance.SetData(appearance.Owner, ProximityTriggerVisualState.State, ProximityTriggerVisuals.Active, appearance); } Trigger(component.Owner); diff --git a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs index 02f7c0b42e..965f1b6dc1 100644 --- a/Content.Server/Explosion/EntitySystems/TriggerSystem.cs +++ b/Content.Server/Explosion/EntitySystems/TriggerSystem.cs @@ -178,7 +178,7 @@ namespace Content.Server.Explosion.EntitySystems active.TimeUntilBeep = initialBeepDelay == null ? active.BeepInterval : initialBeepDelay.Value; if (TryComp(uid, out var appearance)) - appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Primed); + _appearance.SetData(uid, TriggerVisuals.VisualState, TriggerVisualState.Primed, appearance); } public override void Update(float frameTime) @@ -219,7 +219,7 @@ namespace Content.Server.Explosion.EntitySystems // In case this is a re-usable grenade, un-prime it. if (TryComp(uid, out var appearance)) - appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Unprimed); + _appearance.SetData(uid, TriggerVisuals.VisualState, TriggerVisualState.Unprimed, appearance); } } } diff --git a/Content.Server/Extinguisher/FireExtinguisherSystem.cs b/Content.Server/Extinguisher/FireExtinguisherSystem.cs index 9f5935dcff..2e6281a64e 100644 --- a/Content.Server/Extinguisher/FireExtinguisherSystem.cs +++ b/Content.Server/Extinguisher/FireExtinguisherSystem.cs @@ -8,6 +8,7 @@ using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Interaction.Events; using Content.Shared.Verbs; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; @@ -17,6 +18,7 @@ public sealed class FireExtinguisherSystem : EntitySystem { [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -123,7 +125,7 @@ public sealed class FireExtinguisherSystem : EntitySystem if (comp.HasSafety) { - appearance.SetData(FireExtinguisherVisuals.Safety, comp.Safety); + _appearance.SetData(uid, FireExtinguisherVisuals.Safety, comp.Safety, appearance); } } diff --git a/Content.Server/Fluids/EntitySystems/SpraySystem.cs b/Content.Server/Fluids/EntitySystems/SpraySystem.cs index 372eaeec37..a5c08d78ab 100644 --- a/Content.Server/Fluids/EntitySystems/SpraySystem.cs +++ b/Content.Server/Fluids/EntitySystems/SpraySystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Cooldown; using Content.Shared.FixedPoint; using Content.Shared.Interaction; using Content.Shared.Vapor; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Map; using Robust.Shared.Player; @@ -25,6 +26,7 @@ public sealed class SpraySystem : EntitySystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly VaporSystem _vaporSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -108,8 +110,8 @@ public sealed class SpraySystem : EntitySystem if (TryComp(vapor, out AppearanceComponent? appearance)) { - appearance.SetData(VaporVisuals.Color, solution.GetColor(_proto).WithAlpha(1f)); - appearance.SetData(VaporVisuals.State, true); + _appearance.SetData(uid, VaporVisuals.Color, solution.GetColor(_proto).WithAlpha(1f), appearance); + _appearance.SetData(uid, VaporVisuals.State, true, appearance); } // Add the solution to the vapor and actually send the thing diff --git a/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs b/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs index 540de18e43..e260638ad3 100644 --- a/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs +++ b/Content.Server/Kitchen/EntitySystems/KitchenSpikeSystem.cs @@ -18,6 +18,7 @@ using Content.Shared.Interaction.Events; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Content.Shared.Popups; +using Robust.Server.GameObjects; namespace Content.Server.Kitchen.EntitySystems { @@ -28,6 +29,7 @@ namespace Content.Server.Kitchen.EntitySystems [Dependency] private readonly IAdminLogManager _logger = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -171,7 +173,7 @@ namespace Content.Server.Kitchen.EntitySystems if (!Resolve(uid, ref component, ref appearance, false)) return; - appearance.SetData(KitchenSpikeVisuals.Status, (component.PrototypesToSpawn?.Count > 0) ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty); + _appearance.SetData(uid, KitchenSpikeVisuals.Status, (component.PrototypesToSpawn?.Count > 0 ? KitchenSpikeStatus.Bloody : KitchenSpikeStatus.Empty, appearance)); } private bool Spikeable(EntityUid uid, EntityUid userUid, EntityUid victimUid, diff --git a/Content.Server/Kudzu/GrowingKudzuSystem.cs b/Content.Server/Kudzu/GrowingKudzuSystem.cs index dceca1c14c..78ed38d076 100644 --- a/Content.Server/Kudzu/GrowingKudzuSystem.cs +++ b/Content.Server/Kudzu/GrowingKudzuSystem.cs @@ -1,4 +1,5 @@ using Content.Shared.Kudzu; +using Robust.Server.GameObjects; using Robust.Shared.Random; namespace Content.Server.Kudzu; @@ -6,6 +7,7 @@ namespace Content.Server.Kudzu; public sealed class GrowingKudzuSystem : EntitySystem { [Dependency] private readonly IRobustRandom _robustRandom = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private float _accumulatedFrameTime = 0.0f; @@ -21,8 +23,8 @@ public sealed class GrowingKudzuSystem : EntitySystem return; } - appearance.SetData(KudzuVisuals.Variant, _robustRandom.Next(1, 3)); - appearance.SetData(KudzuVisuals.GrowthLevel, 1); + _appearance.SetData(uid, KudzuVisuals.Variant, _robustRandom.Next(1, 3), appearance); + _appearance.SetData(uid, KudzuVisuals.GrowthLevel, 1, appearance); } public override void Update(float frameTime) @@ -46,7 +48,7 @@ public sealed class GrowingKudzuSystem : EntitySystem EntityManager.RemoveComponent((kudzu).Owner); } - appearance.SetData(KudzuVisuals.GrowthLevel, kudzu.GrowthLevel); + _appearance.SetData(kudzu.Owner, KudzuVisuals.GrowthLevel, kudzu.GrowthLevel, appearance); } } } diff --git a/Content.Server/Labels/Label/LabelSystem.cs b/Content.Server/Labels/Label/LabelSystem.cs index 7d7da51a64..cf8f362327 100644 --- a/Content.Server/Labels/Label/LabelSystem.cs +++ b/Content.Server/Labels/Label/LabelSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Containers.ItemSlots; using Content.Shared.Examine; using Content.Shared.Labels; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Containers; using Robust.Shared.Utility; @@ -16,6 +17,7 @@ namespace Content.Server.Labels public sealed class LabelSystem : EntitySystem { [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public const string ContainerName = "paper_label"; @@ -71,7 +73,7 @@ namespace Content.Server.Labels if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(PaperLabelVisuals.HasLabel, false); + _appearance.SetData(uid, PaperLabelVisuals.HasLabel, false, appearance); } private void OnComponentRemove(EntityUid uid, PaperLabelComponent component, ComponentRemove args) @@ -128,7 +130,7 @@ namespace Content.Server.Labels if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem); + _appearance.SetData(uid, PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem, appearance); } } } diff --git a/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs b/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs index b3aa540002..de45b6c983 100644 --- a/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs +++ b/Content.Server/Light/EntitySystems/EmergencyLightSystem.cs @@ -19,6 +19,7 @@ namespace Content.Server.Light.EntitySystems { [Dependency] private readonly AmbientSoundSystem _ambient = default!; [Dependency] private readonly StationSystem _station = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -110,7 +111,7 @@ namespace Content.Server.Light.EntitySystems continue; pointLight.Color = details.EmergencyLightColor; - appearance.SetData(EmergencyLightVisuals.Color, details.EmergencyLightColor); + _appearance.SetData(appearance.Owner, EmergencyLightVisuals.Color, details.EmergencyLightColor, appearance); if (details.ForceEnableEmergencyLights && !light.ForciblyEnabled) { @@ -198,7 +199,7 @@ namespace Content.Server.Light.EntitySystems } if (TryComp(component.Owner, out AppearanceComponent? appearance)) - appearance.SetData(EmergencyLightVisuals.On, false); + _appearance.SetData(appearance.Owner, EmergencyLightVisuals.On, false, appearance); _ambient.SetAmbience(component.Owner, false); } @@ -212,7 +213,7 @@ namespace Content.Server.Light.EntitySystems if (TryComp(component.Owner, out AppearanceComponent? appearance)) { - appearance.SetData(EmergencyLightVisuals.On, true); + _appearance.SetData(appearance.Owner, EmergencyLightVisuals.On, true, appearance); } _ambient.SetAmbience(component.Owner, true); diff --git a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs index 809fa0710d..1ea39d2ee6 100644 --- a/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs +++ b/Content.Server/Light/EntitySystems/ExpendableLightSystem.cs @@ -21,6 +21,7 @@ namespace Content.Server.Light.EntitySystems [Dependency] private readonly ClothingSystem _clothing = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -107,20 +108,20 @@ namespace Content.Server.Light.EntitySystems { if (!Resolve(component.Owner, ref appearance, false)) return; - appearance.SetData(ExpendableLightVisuals.State, component.CurrentState); + _appearance.SetData(appearance.Owner, ExpendableLightVisuals.State, component.CurrentState, appearance); switch (component.CurrentState) { case ExpendableLightState.Lit: - appearance.SetData(ExpendableLightVisuals.Behavior, component.TurnOnBehaviourID); + _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, component.TurnOnBehaviourID, appearance); break; case ExpendableLightState.Fading: - appearance.SetData(ExpendableLightVisuals.Behavior, component.FadeOutBehaviourID); + _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, component.FadeOutBehaviourID, appearance); break; case ExpendableLightState.Dead: - appearance.SetData(ExpendableLightVisuals.Behavior, string.Empty); + _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, string.Empty, appearance); var isHotEvent = new IsHotEvent() {IsHot = true}; RaiseLocalEvent(component.Owner, isHotEvent); break; diff --git a/Content.Server/Light/EntitySystems/LightBulbSystem.cs b/Content.Server/Light/EntitySystems/LightBulbSystem.cs index e11880e723..4c00830c98 100644 --- a/Content.Server/Light/EntitySystems/LightBulbSystem.cs +++ b/Content.Server/Light/EntitySystems/LightBulbSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Light.Components; using Content.Shared.Destructible; using Content.Shared.Light; using Content.Shared.Throwing; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; @@ -9,6 +10,8 @@ namespace Content.Server.Light.EntitySystems { public sealed class LightBulbSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -75,8 +78,8 @@ namespace Content.Server.Light.EntitySystems return; // try to update appearance and color - appearance.SetData(LightBulbVisuals.State, bulb.State); - appearance.SetData(LightBulbVisuals.Color, bulb.Color); + _appearance.SetData(uid, LightBulbVisuals.State, bulb.State, appearance); + _appearance.SetData(uid, LightBulbVisuals.Color, bulb.Color, appearance); } } } diff --git a/Content.Server/Light/EntitySystems/MatchboxSystem.cs b/Content.Server/Light/EntitySystems/MatchboxSystem.cs index e7b0fe4aad..171a74b533 100644 --- a/Content.Server/Light/EntitySystems/MatchboxSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchboxSystem.cs @@ -21,7 +21,7 @@ namespace Content.Server.Light.EntitySystems && EntityManager.TryGetComponent(args.Used, out var matchstick) && matchstick.CurrentState == SmokableState.Unlit) { - _stickSystem.Ignite(matchstick, args.User); + _stickSystem.Ignite(uid, matchstick, args.User); args.Handled = true; } } diff --git a/Content.Server/Light/EntitySystems/MatchstickSystem.cs b/Content.Server/Light/EntitySystems/MatchstickSystem.cs index a1a54205ab..a7b241467c 100644 --- a/Content.Server/Light/EntitySystems/MatchstickSystem.cs +++ b/Content.Server/Light/EntitySystems/MatchstickSystem.cs @@ -13,10 +13,12 @@ namespace Content.Server.Light.EntitySystems { public sealed class MatchstickSystem : EntitySystem { - private HashSet _litMatches = new(); [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly SharedItemSystem _item = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + + private HashSet _litMatches = new(); public override void Initialize() { @@ -61,7 +63,7 @@ namespace Content.Server.Light.EntitySystems if (!isHotEvent.IsHot) return; - Ignite(component, args.User); + Ignite(uid, component, args.User); args.Handled = true; } @@ -70,23 +72,23 @@ namespace Content.Server.Light.EntitySystems args.IsHot = component.CurrentState == SmokableState.Lit; } - public void Ignite(MatchstickComponent component, EntityUid user) + public void Ignite(EntityUid uid, MatchstickComponent component, EntityUid user) { // Play Sound SoundSystem.Play(component.IgniteSound.GetSound(), Filter.Pvs(component.Owner), component.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); // Change state - SetState(component, SmokableState.Lit); + SetState(uid, component, SmokableState.Lit); _litMatches.Add(component); component.Owner.SpawnTimer(component.Duration * 1000, delegate { - SetState(component, SmokableState.Burnt); + SetState(uid, component, SmokableState.Burnt); _litMatches.Remove(component); }); } - private void SetState(MatchstickComponent component, SmokableState value) + private void SetState(EntityUid uid, MatchstickComponent component, SmokableState value) { component.CurrentState = value; @@ -110,7 +112,7 @@ namespace Content.Server.Light.EntitySystems if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance)) { - appearance.SetData(SmokingVisuals.Smoking, component.CurrentState); + _appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance); } } } diff --git a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs index 7e469ebd7d..c671db4219 100644 --- a/Content.Server/Light/EntitySystems/PoweredLightSystem.cs +++ b/Content.Server/Light/EntitySystems/PoweredLightSystem.cs @@ -39,6 +39,7 @@ namespace Content.Server.Light.EntitySystems [Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2); public const string LightBulbContainer = "light_bulb"; @@ -270,7 +271,7 @@ namespace Content.Server.Light.EntitySystems { SetLight(uid, false, light: light); powerReceiver.Load = 0; - appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Empty); + _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Empty, appearance); return; } @@ -280,7 +281,7 @@ namespace Content.Server.Light.EntitySystems if (powerReceiver.Powered && light.On) { SetLight(uid, true, lightBulb.Color, light, lightBulb.LightRadius, lightBulb.LightEnergy, lightBulb.LightSoftness); - appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.On); + _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.On, appearance); var time = _gameTiming.CurTime; if (time > light.LastThunk + ThunkDelay) { @@ -291,16 +292,16 @@ namespace Content.Server.Light.EntitySystems else { SetLight(uid, false, light: light); - appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Off); + _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Off, appearance); } break; case LightBulbState.Broken: SetLight(uid, false, light: light); - appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Broken); + _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Broken, appearance); break; case LightBulbState.Burned: SetLight(uid, false, light: light); - appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Burned); + _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Burned, appearance); break; } @@ -335,10 +336,10 @@ namespace Content.Server.Light.EntitySystems light.LastGhostBlink = time; - ToggleBlinkingLight(light, true); + ToggleBlinkingLight(uid, light, true); light.Owner.SpawnTimer(light.GhostBlinkingTime, () => { - ToggleBlinkingLight(light, false); + ToggleBlinkingLight(uid, light, false); }); args.Handled = true; @@ -349,7 +350,7 @@ namespace Content.Server.Light.EntitySystems UpdateLight(uid, component); } - public void ToggleBlinkingLight(PoweredLightComponent light, bool isNowBlinking) + public void ToggleBlinkingLight(EntityUid uid, PoweredLightComponent light, bool isNowBlinking) { if (light.IsBlinking == isNowBlinking) return; @@ -358,7 +359,8 @@ namespace Content.Server.Light.EntitySystems if (!EntityManager.TryGetComponent(light.Owner, out AppearanceComponent? appearance)) return; - appearance.SetData(PoweredLightVisuals.Blinking, isNowBlinking); + + _appearance.SetData(uid, PoweredLightVisuals.Blinking, isNowBlinking, appearance); } private void OnSignalReceived(EntityUid uid, PoweredLightComponent component, SignalReceivedEvent args) diff --git a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs index 3759820550..998554468f 100644 --- a/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs +++ b/Content.Server/Light/EntitySystems/UnpoweredFlashlightSystem.cs @@ -14,6 +14,7 @@ namespace Content.Server.Light.EntitySystems public sealed class UnpoweredFlashlightSystem : EntitySystem { [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -30,7 +31,7 @@ namespace Content.Server.Light.EntitySystems if (args.Handled) return; - ToggleLight(component); + ToggleLight(uid, component); args.Handled = true; } @@ -48,7 +49,7 @@ namespace Content.Server.Light.EntitySystems ActivationVerb verb = new(); verb.Text = Loc.GetString("toggle-flashlight-verb-get-data-text"); verb.IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png"; - verb.Act = () => ToggleLight(component); + verb.Act = () => ToggleLight(uid, component); verb.Priority = -1; // For things like PDA's, Open-UI and other verbs that should be higher priority. args.Verbs.Add(verb); @@ -58,7 +59,7 @@ namespace Content.Server.Light.EntitySystems { _actionsSystem.AddAction(uid, component.ToggleAction, null); } - public void ToggleLight(UnpoweredFlashlightComponent flashlight) + public void ToggleLight(EntityUid uid, UnpoweredFlashlightComponent flashlight) { if (!EntityManager.TryGetComponent(flashlight.Owner, out PointLightComponent? light)) return; @@ -67,7 +68,7 @@ namespace Content.Server.Light.EntitySystems light.Enabled = flashlight.LightOn; if (EntityManager.TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance)) - appearance.SetData(UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn); + _appearance.SetData(uid, UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn, appearance); SoundSystem.Play(flashlight.ToggleSound.GetSound(), Filter.Pvs(light.Owner), flashlight.Owner); diff --git a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs index 6e7d27ea32..875bc5ced5 100644 --- a/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs +++ b/Content.Server/MachineLinking/System/TwoWayLeverSystem.cs @@ -2,12 +2,14 @@ using Content.Server.MachineLinking.Components; using Content.Shared.Interaction; using Content.Shared.MachineLinking; using Content.Shared.Verbs; +using Robust.Server.GameObjects; namespace Content.Server.MachineLinking.System { public sealed class TwoWayLeverSystem : EntitySystem { [Dependency] private readonly SignalLinkerSystem _signalSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; const string _leftToggleImage = "rotate_ccw.svg.192dpi.png"; const string _rightToggleImage = "rotate_cw.svg.192dpi.png"; @@ -96,8 +98,8 @@ namespace Content.Server.MachineLinking.System if (component.State == TwoWayLeverState.Middle) component.NextSignalLeft = !component.NextSignalLeft; - if (TryComp(uid, out AppearanceComponent? appearanceComponent)) - appearanceComponent.SetData(TwoWayLeverVisuals.State, component.State); + if (TryComp(uid, out AppearanceComponent? appearance)) + _appearance.SetData(uid, TwoWayLeverVisuals.State, component.State, appearance); var port = component.State switch { diff --git a/Content.Server/Medical/MedicalScannerSystem.cs b/Content.Server/Medical/MedicalScannerSystem.cs index 373bfecb36..979ce061f1 100644 --- a/Content.Server/Medical/MedicalScannerSystem.cs +++ b/Content.Server/Medical/MedicalScannerSystem.cs @@ -15,7 +15,7 @@ using Content.Server.Construction; using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Systems; using Robust.Server.Containers; - +using Robust.Server.GameObjects; using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent; // Hmm... namespace Content.Server.Medical @@ -28,6 +28,7 @@ namespace Content.Server.Medical [Dependency] private readonly CloningConsoleSystem _cloningConsoleSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly ContainerSystem _containerSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private const float UpdateRate = 1f; private float _updateDif; @@ -181,7 +182,7 @@ namespace Content.Server.Medical { if (TryComp(scannerComponent.Owner, out var appearance)) { - appearance.SetData(MedicalScannerVisuals.Status, GetStatus(scannerComponent)); + _appearance.SetData(uid, MedicalScannerVisuals.Status, GetStatus(scannerComponent), appearance); } } diff --git a/Content.Server/Morgue/CrematoriumSystem.cs b/Content.Server/Morgue/CrematoriumSystem.cs index 7a3c0589bf..4ffadd0a98 100644 --- a/Content.Server/Morgue/CrematoriumSystem.cs +++ b/Content.Server/Morgue/CrematoriumSystem.cs @@ -41,12 +41,17 @@ public sealed class CrematoriumSystem : EntitySystem if (!TryComp(uid, out var appearance)) return; - if (appearance.TryGetData(CrematoriumVisuals.Burning, out bool isBurning) && isBurning) + if (_appearance.TryGetData(uid, CrematoriumVisuals.Burning, out var isBurning, appearance) && isBurning) args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-is-burning", ("owner", uid))); - if (appearance.TryGetData(StorageVisuals.HasContents, out bool hasContents) && hasContents) + + if (_appearance.TryGetData(uid, StorageVisuals.HasContents, out var hasContents, appearance) && hasContents) + { args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents")); + } else + { args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty")); + } } private void OnAttemptOpen(EntityUid uid, ActiveCrematoriumComponent component, StorageOpenAttemptEvent args) diff --git a/Content.Server/Morgue/MorgueSystem.cs b/Content.Server/Morgue/MorgueSystem.cs index f7c1ead1fe..2226ca98bd 100644 --- a/Content.Server/Morgue/MorgueSystem.cs +++ b/Content.Server/Morgue/MorgueSystem.cs @@ -24,13 +24,10 @@ public sealed class MorgueSystem : EntitySystem /// private void OnExamine(EntityUid uid, MorgueComponent component, ExaminedEvent args) { - if (!TryComp(uid, out var appearance)) - return; - if (!args.IsInDetailsRange) return; - appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents); + _appearance.TryGetData(uid, MorgueVisuals.Contents, out var contents); var text = contents switch { @@ -92,7 +89,7 @@ public sealed class MorgueSystem : EntitySystem comp.AccumulatedFrameTime -= comp.BeepTime; - if (comp.DoSoulBeep && appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents) && contents == MorgueContents.HasSoul) + if (comp.DoSoulBeep && _appearance.TryGetData(appearance.Owner, MorgueVisuals.Contents, out var contents, appearance) && contents == MorgueContents.HasSoul) { _audio.PlayPvs(comp.OccupantHasSoulAlarmSound, comp.Owner); } diff --git a/Content.Server/Mousetrap/MousetrapSystem.cs b/Content.Server/Mousetrap/MousetrapSystem.cs index 005e388630..e3aaab364d 100644 --- a/Content.Server/Mousetrap/MousetrapSystem.cs +++ b/Content.Server/Mousetrap/MousetrapSystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Inventory; using Content.Shared.Mousetrap; using Content.Shared.StepTrigger; using Content.Shared.StepTrigger.Systems; +using Robust.Server.GameObjects; using Robust.Shared.Physics.Components; using Robust.Shared.Player; @@ -14,6 +15,7 @@ namespace Content.Server.Mousetrap; public sealed class MousetrapSystem : EntitySystem { [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -66,7 +68,7 @@ public sealed class MousetrapSystem : EntitySystem return; } - appearance.SetData(MousetrapVisuals.Visual, - mousetrap.IsActive ? MousetrapVisuals.Armed : MousetrapVisuals.Unarmed); + _appearance.SetData(uid, MousetrapVisuals.Visual, + mousetrap.IsActive ? MousetrapVisuals.Armed : MousetrapVisuals.Unarmed, appearance); } } diff --git a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs index b5bcf59ec6..15dbde8a26 100644 --- a/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs +++ b/Content.Server/Nutrition/EntitySystems/SmokingSystem.cs @@ -28,6 +28,7 @@ namespace Content.Server.Nutrition.EntitySystems [Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly ClothingSystem _clothing = default!; [Dependency] private readonly SharedItemSystem _items = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private const float UpdateTimer = 3f; @@ -54,7 +55,7 @@ namespace Content.Server.Nutrition.EntitySystems return; smokable.State = state; - appearance.SetData(SmokingVisuals.Smoking, state); + _appearance.SetData(uid, SmokingVisuals.Smoking, state, appearance); var newState = state switch { diff --git a/Content.Server/PAI/PAISystem.cs b/Content.Server/PAI/PAISystem.cs index 922b9b56ea..2939ae58c0 100644 --- a/Content.Server/PAI/PAISystem.cs +++ b/Content.Server/PAI/PAISystem.cs @@ -16,6 +16,7 @@ namespace Content.Server.PAI { [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly InstrumentSystem _instrumentSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -75,7 +76,7 @@ namespace Content.Server.PAI // But having the pda's name permanently be "old lady's PAI" is weird. // Changing the PAI's identity in a way that ties it to the owner's identity also seems weird. // Cause then you could remotely figure out information about the owner's equipped items. - + EntityManager.GetComponent(component.Owner).EntityName = val; var ghostFinder = EntityManager.EnsureComponent(uid); @@ -126,7 +127,7 @@ namespace Content.Server.PAI { if (EntityManager.TryGetComponent(uid, out var appearance)) { - appearance.SetData(PAIVisuals.Status, status); + _appearance.SetData(uid, PAIVisuals.Status, status, appearance); } } diff --git a/Content.Server/PDA/PDASystem.cs b/Content.Server/PDA/PDASystem.cs index 5c6532420f..1792e7e142 100644 --- a/Content.Server/PDA/PDASystem.cs +++ b/Content.Server/PDA/PDASystem.cs @@ -141,7 +141,7 @@ namespace Content.Server.PDA case PDAToggleFlashlightMessage _: { if (EntityManager.TryGetComponent(pda.Owner, out UnpoweredFlashlightComponent? flashlight)) - _unpoweredFlashlight.ToggleLight(flashlight); + _unpoweredFlashlight.ToggleLight(flashlight.Owner, flashlight); break; } diff --git a/Content.Server/Paper/PaperSystem.cs b/Content.Server/Paper/PaperSystem.cs index c763a51d6f..a5d819477b 100644 --- a/Content.Server/Paper/PaperSystem.cs +++ b/Content.Server/Paper/PaperSystem.cs @@ -20,6 +20,7 @@ namespace Content.Server.Paper [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -40,10 +41,10 @@ namespace Content.Server.Paper if (TryComp(uid, out var appearance)) { if (paperComp.Content != "") - appearance.SetData(PaperVisuals.Status, PaperStatus.Written); + _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance); if (paperComp.StampState != null) - appearance.SetData(PaperVisuals.Stamp, paperComp.StampState); + _appearance.SetData(uid, PaperVisuals.Stamp, paperComp.StampState, appearance); } } @@ -111,7 +112,7 @@ namespace Content.Server.Paper paperComp.Content += text + '\n'; if (TryComp(uid, out var appearance)) - appearance.SetData(PaperVisuals.Status, PaperStatus.Written); + _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance); if (TryComp(uid, out var meta)) meta.EntityDescription = ""; @@ -137,7 +138,7 @@ namespace Content.Server.Paper if (paperComp.StampState == null && TryComp(uid, out var appearance)) { paperComp.StampState = stampState; - appearance.SetData(PaperVisuals.Stamp, paperComp.StampState); + _appearance.SetData(uid, PaperVisuals.Stamp, paperComp.StampState, appearance); } } return true; @@ -158,7 +159,7 @@ namespace Content.Server.Paper ? PaperStatus.Blank : PaperStatus.Written; - appearance.SetData(PaperVisuals.Status, status); + _appearance.SetData(uid, PaperVisuals.Status, status, appearance); } public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null) diff --git a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs index e82ccd67b6..160dc80fc3 100644 --- a/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs +++ b/Content.Server/Pointing/EntitySystems/RoguePointingSystem.cs @@ -15,6 +15,7 @@ namespace Content.Server.Pointing.EntitySystems { [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly ExplosionSystem _explosion = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null) { @@ -39,7 +40,7 @@ namespace Content.Server.Pointing.EntitySystems if (!Resolve(uid, ref component, ref transform, ref appearance) || component.Chasing == null) return; - appearance.SetData(RoguePointingArrowVisuals.Rotation, transform.LocalRotation.Degrees); + _appearance.SetData(uid, RoguePointingArrowVisuals.Rotation, transform.LocalRotation.Degrees, appearance); } public void SetTarget(EntityUid arrow, EntityUid target, RoguePointingArrowComponent? component = null) diff --git a/Content.Server/Power/EntitySystems/ApcSystem.cs b/Content.Server/Power/EntitySystems/ApcSystem.cs index 9e7ab87100..c602ee3ab6 100644 --- a/Content.Server/Power/EntitySystems/ApcSystem.cs +++ b/Content.Server/Power/EntitySystems/ApcSystem.cs @@ -27,6 +27,7 @@ namespace Content.Server.Power.EntitySystems [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly ToolSystem _toolSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private const float ScrewTime = 2f; @@ -114,7 +115,7 @@ namespace Content.Server.Power.EntitySystems if (appearance != null) { - appearance.SetData(ApcVisuals.ChargeState, newState); + _appearance.SetData(uid, ApcVisuals.ChargeState, newState, appearance); } } @@ -231,7 +232,7 @@ namespace Content.Server.Power.EntitySystems if (!Resolve(uid, ref appearance, ref apc, false)) return; - appearance.SetData(ApcVisuals.PanelState, GetPanelState(apc)); + _appearance.SetData(uid, ApcVisuals.PanelState, GetPanelState(apc), appearance); } private sealed class ApcToolFinishedEvent : EntityEventArgs diff --git a/Content.Server/Power/EntitySystems/CableVisSystem.cs b/Content.Server/Power/EntitySystems/CableVisSystem.cs index e720a86f82..6fc492320a 100644 --- a/Content.Server/Power/EntitySystems/CableVisSystem.cs +++ b/Content.Server/Power/EntitySystems/CableVisSystem.cs @@ -4,6 +4,7 @@ using Content.Server.Power.Components; using Content.Server.Power.Nodes; using Content.Shared.Wires; using JetBrains.Annotations; +using Robust.Server.GameObjects; using Robust.Shared.Map; namespace Content.Server.Power.EntitySystems @@ -12,6 +13,7 @@ namespace Content.Server.Power.EntitySystems public sealed class CableVisSystem : EntitySystem { [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -55,7 +57,7 @@ namespace Content.Server.Power.EntitySystems }; } - appearance.SetData(WireVisVisuals.ConnectedMask, mask); + _appearance.SetData(uid, WireVisVisuals.ConnectedMask, mask, appearance); } } } diff --git a/Content.Server/Power/PowerWireAction.cs b/Content.Server/Power/PowerWireAction.cs index 2d9d43088d..a5925742e0 100644 --- a/Content.Server/Power/PowerWireAction.cs +++ b/Content.Server/Power/PowerWireAction.cs @@ -22,14 +22,14 @@ public sealed class PowerWireAction : BaseWireAction public override StatusLightState? GetLightState(Wire wire) { - if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.MainWire, out int main) + if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.MainWire, out var main) && main != wire.Id) { return null; } if (!AllWiresMended(wire.Owner) - || WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed) + || WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed) && pulsed) { return StatusLightState.BlinkingSlow; @@ -40,14 +40,14 @@ public sealed class PowerWireAction : BaseWireAction private bool AllWiresCut(EntityUid owner) { - return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) - && WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out int? count) + return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out var cut) + && WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out var count) && count == cut; } private bool AllWiresMended(EntityUid owner) { - return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) + return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out var cut) && cut == 0; } @@ -72,7 +72,7 @@ public sealed class PowerWireAction : BaseWireAction } else { - if (WiresSystem.TryGetData(owner, PowerWireActionKey.Pulsed, out bool isPulsed) + if (WiresSystem.TryGetData(owner, PowerWireActionKey.Pulsed, out var isPulsed) && isPulsed) { return; @@ -84,8 +84,8 @@ public sealed class PowerWireAction : BaseWireAction private void SetWireCuts(EntityUid owner, bool isCut) { - if (WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) - && WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out int? count)) + if (WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out var cut) + && WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out var count)) { if (cut == count && isCut || cut <= 0 && !isCut) @@ -131,7 +131,7 @@ public sealed class PowerWireAction : BaseWireAction var activePulse = false; - if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed)) + if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed)) { activePulse = pulsed; } @@ -218,7 +218,7 @@ public sealed class PowerWireAction : BaseWireAction var electrocuted = !TrySetElectrocution(user, wire, true); - if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsedKey) && pulsedKey) + if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out var pulsedKey) && pulsedKey) return; WiresSystem.SetData(wire.Owner, PowerWireActionKey.Pulsed, true); @@ -236,7 +236,7 @@ public sealed class PowerWireAction : BaseWireAction if (!IsPowered(wire.Owner)) { - if (!WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed) + if (!WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed) || !pulsed) { WiresSystem.TryCancelWireAction(wire.Owner, PowerWireActionKey.ElectrifiedCancel); diff --git a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs index dec609cdc6..b98e1427aa 100644 --- a/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs +++ b/Content.Server/Radio/EntitySystems/RadioDeviceSystem.cs @@ -26,7 +26,7 @@ public sealed class RadioDeviceSystem : EntitySystem [Dependency] private readonly ChatSystem _chat = default!; [Dependency] private readonly RadioSystem _radio = default!; [Dependency] private readonly InteractionSystem _interaction = default!; - [Dependency] private readonly AppearanceSystem _appearance = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; // Used to prevent a shitter from using a bunch of radios to spam chat. private HashSet<(string, EntityUid)> _recentlySent = new(); diff --git a/Content.Server/RandomAppearance/RandomAppearanceSystem.cs b/Content.Server/RandomAppearance/RandomAppearanceSystem.cs index 6c50a25636..d903aa0b47 100644 --- a/Content.Server/RandomAppearance/RandomAppearanceSystem.cs +++ b/Content.Server/RandomAppearance/RandomAppearanceSystem.cs @@ -1,10 +1,12 @@ -using Robust.Shared.Random; +using Robust.Server.GameObjects; +using Robust.Shared.Random; namespace Content.Server.RandomAppearance; public sealed class RandomAppearanceSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -17,7 +19,7 @@ public sealed class RandomAppearanceSystem : EntitySystem { if (TryComp(uid, out AppearanceComponent? appearance) && component.EnumKey != null) { - appearance.SetData(component.EnumKey, _random.Pick(component.SpriteStates)); + _appearance.SetData(uid, component.EnumKey, _random.Pick(component.SpriteStates), appearance); } } } diff --git a/Content.Server/Security/Systems/DeployableBarrierSystem.cs b/Content.Server/Security/Systems/DeployableBarrierSystem.cs index 717101587b..b5aa9a70aa 100644 --- a/Content.Server/Security/Systems/DeployableBarrierSystem.cs +++ b/Content.Server/Security/Systems/DeployableBarrierSystem.cs @@ -7,6 +7,8 @@ namespace Content.Server.Security.Systems { public sealed class DeployableBarrierSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -19,23 +21,23 @@ namespace Content.Server.Security.Systems if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent)) return; - ToggleBarrierDeploy(component, lockComponent.Locked); + ToggleBarrierDeploy(uid, component, lockComponent.Locked); } private void OnLockToggled(EntityUid uid, DeployableBarrierComponent component, LockToggledEvent args) { - ToggleBarrierDeploy(component, args.Locked); + ToggleBarrierDeploy(uid, component, args.Locked); } - private void ToggleBarrierDeploy(DeployableBarrierComponent component, bool isDeployed) + private void ToggleBarrierDeploy(EntityUid uid, DeployableBarrierComponent component, bool isDeployed) { EntityManager.GetComponent(component.Owner).Anchored = isDeployed; - if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) + if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance)) return; var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle; - appearanceComponent.SetData(DeployableBarrierVisuals.State, state); + _appearance.SetData(uid, DeployableBarrierVisuals.State, state, appearance); if (EntityManager.TryGetComponent(component.Owner, out PointLightComponent? light)) light.Enabled = isDeployed; diff --git a/Content.Server/Shuttles/Systems/ThrusterSystem.cs b/Content.Server/Shuttles/Systems/ThrusterSystem.cs index 109f554f9c..287622aed9 100644 --- a/Content.Server/Shuttles/Systems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/Systems/ThrusterSystem.cs @@ -1,5 +1,4 @@ using System.Linq; -using System.Runtime.CompilerServices; using Content.Server.Audio; using Content.Server.Construction; using Content.Server.Power.Components; @@ -14,10 +13,8 @@ using Content.Shared.Shuttles.Components; using Content.Shared.Temperature; using Robust.Server.GameObjects; using Robust.Shared.Map; -using Robust.Shared.Physics; using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Components; -using Robust.Shared.Physics.Dynamics; using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Systems; using Robust.Shared.Utility; @@ -26,11 +23,12 @@ namespace Content.Server.Shuttles.Systems { public sealed class ThrusterSystem : EntitySystem { - [Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!; - [Robust.Shared.IoC.Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; - [Robust.Shared.IoC.Dependency] private readonly AmbientSoundSystem _ambient = default!; - [Robust.Shared.IoC.Dependency] private readonly FixtureSystem _fixtureSystem = default!; - [Robust.Shared.IoC.Dependency] private readonly DamageableSystem _damageable = default!; + [Dependency] private readonly IMapManager _mapManager = default!; + [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; + [Dependency] private readonly AmbientSoundSystem _ambient = default!; + [Dependency] private readonly FixtureSystem _fixtureSystem = default!; + [Dependency] private readonly DamageableSystem _damageable = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; // Essentially whenever thruster enables we update the shuttle's available impulses which are used for movement. // This is done for each direction available. @@ -276,9 +274,9 @@ namespace Content.Server.Shuttles.Systems throw new ArgumentOutOfRangeException(); } - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - appearanceComponent.SetData(ThrusterVisualState.State, true); + _appearance.SetData(uid, ThrusterVisualState.State, true, appearance); } if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent)) @@ -329,9 +327,9 @@ namespace Content.Server.Shuttles.Systems throw new ArgumentOutOfRangeException(); } - if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearanceComponent)) + if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - appearanceComponent.SetData(ThrusterVisualState.State, false); + _appearance.SetData(uid, ThrusterVisualState.State, false, appearance); } if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent)) @@ -439,11 +437,8 @@ namespace Content.Server.Shuttles.Systems foreach (var comp in component.LinearThrusters[index]) { - if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) - continue; - comp.Firing = true; - appearanceComponent.SetData(ThrusterVisualState.Thrusting, true); + _appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, true); } } @@ -460,11 +455,8 @@ namespace Content.Server.Shuttles.Systems foreach (var comp in component.LinearThrusters[index]) { - if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) - continue; - comp.Firing = false; - appearanceComponent.SetData(ThrusterVisualState.Thrusting, false); + _appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, false); } } @@ -484,22 +476,16 @@ namespace Content.Server.Shuttles.Systems { foreach (var comp in component.AngularThrusters) { - if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) - continue; - comp.Firing = true; - appearanceComponent.SetData(ThrusterVisualState.Thrusting, true); + _appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, true); } } else { foreach (var comp in component.AngularThrusters) { - if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent)) - continue; - comp.Firing = false; - appearanceComponent.SetData(ThrusterVisualState.Thrusting, false); + _appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, false); } } } @@ -518,7 +504,6 @@ namespace Content.Server.Shuttles.Systems #endregion - [MethodImpl(MethodImplOptions.AggressiveInlining)] private int GetFlagIndex(DirectionFlag flag) { return (int) Math.Log2((int) flag); diff --git a/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs b/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs index 15e831d935..142686fcd0 100644 --- a/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs +++ b/Content.Server/Singularity/EntitySystems/RadiationCollectorSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Singularity.Components; using Content.Server.Popups; using Content.Server.Power.Components; using Content.Shared.Radiation.Events; +using Robust.Server.GameObjects; using Robust.Shared.Timing; using Robust.Shared.Player; @@ -13,6 +14,8 @@ namespace Content.Server.Singularity.EntitySystems { [Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -78,7 +81,7 @@ namespace Content.Server.Singularity.EntitySystems return; var state = component.Enabled ? RadiationCollectorVisualState.Active : RadiationCollectorVisualState.Deactive; - appearance.SetData(RadiationCollectorVisuals.VisualState, state); + _appearance.SetData(uid, RadiationCollectorVisuals.VisualState, state, appearance); } } } diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index 5757d8a9e6..3d9346bedd 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -6,6 +6,7 @@ using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Sticky.Components; using Content.Shared.Verbs; +using Robust.Server.GameObjects; using Robust.Shared.Containers; using Robust.Shared.Player; @@ -18,6 +19,7 @@ public sealed class StickySystem : EntitySystem [Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedInteractionSystem _interactionSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private const string StickerSlotId = "stickers_container"; @@ -172,7 +174,7 @@ public sealed class StickySystem : EntitySystem // send information to appearance that entity is stuck if (TryComp(uid, out AppearanceComponent? appearance)) { - appearance.SetData(StickyVisuals.IsStuck, true); + _appearance.SetData(uid, StickyVisuals.IsStuck, true, appearance); } component.StuckTo = target; @@ -200,7 +202,7 @@ public sealed class StickySystem : EntitySystem // send information to appearance that entity isn't stuck if (TryComp(uid, out AppearanceComponent? appearance)) { - appearance.SetData(StickyVisuals.IsStuck, false); + _appearance.SetData(uid, StickyVisuals.IsStuck, false, appearance); } // show message to user diff --git a/Content.Server/Storage/EntitySystems/StorageFillVisualizerSystem.cs b/Content.Server/Storage/EntitySystems/StorageFillVisualizerSystem.cs index 6b69810131..786e0bc93c 100644 --- a/Content.Server/Storage/EntitySystems/StorageFillVisualizerSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageFillVisualizerSystem.cs @@ -1,12 +1,15 @@ using Content.Server.Storage.Components; using Content.Shared.Rounding; using Content.Shared.Storage.Components; +using Robust.Server.GameObjects; using Robust.Shared.Containers; namespace Content.Server.Storage.EntitySystems; public sealed class StorageFillVisualizerSystem : EntitySystem { + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; + public override void Initialize() { base.Initialize(); @@ -40,6 +43,6 @@ public sealed class StorageFillVisualizerSystem : EntitySystem return; var level = ContentHelpers.RoundToEqualLevels(storage.StorageUsed, storage.StorageCapacityMax, component.MaxFillLevels); - appearance.SetData(StorageFillVisuals.FillLevel, level); + _appearance.SetData(uid, StorageFillVisuals.FillLevel, level, appearance); } } diff --git a/Content.Server/Storage/EntitySystems/StorageSystem.cs b/Content.Server/Storage/EntitySystems/StorageSystem.cs index 6cef4726b0..04d500412b 100644 --- a/Content.Server/Storage/EntitySystems/StorageSystem.cs +++ b/Content.Server/Storage/EntitySystems/StorageSystem.cs @@ -53,6 +53,7 @@ namespace Content.Server.Storage.EntitySystems [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedCombatModeSystem _combatMode = default!; [Dependency] private readonly SharedTransformSystem _transform = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; /// public override void Initialize() @@ -470,11 +471,11 @@ namespace Content.Server.Storage.EntitySystems if (!TryComp(uid, out var appearance)) return; - appearance.SetData(StorageVisuals.Open, storageComp.IsOpen); - appearance.SetData(SharedBagOpenVisuals.BagState, storageComp.IsOpen ? SharedBagState.Open : SharedBagState.Closed); + _appearance.SetData(uid, StorageVisuals.Open, storageComp.IsOpen, appearance); + _appearance.SetData(uid, SharedBagOpenVisuals.BagState, storageComp.IsOpen ? SharedBagState.Open : SharedBagState.Closed, appearance); if (HasComp(uid)) - appearance.SetData(StackVisuals.Hide, !storageComp.IsOpen); + _appearance.SetData(uid, StackVisuals.Hide, !storageComp.IsOpen, appearance); } private void RecalculateStorageUsed(ServerStorageComponent storageComp) diff --git a/Content.Server/Stunnable/Systems/StunbatonSystem.cs b/Content.Server/Stunnable/Systems/StunbatonSystem.cs index b8581c2af7..61daf523c6 100644 --- a/Content.Server/Stunnable/Systems/StunbatonSystem.cs +++ b/Content.Server/Stunnable/Systems/StunbatonSystem.cs @@ -9,6 +9,7 @@ using Content.Shared.Item; using Content.Shared.Popups; using Content.Shared.Toggleable; using Content.Shared.Weapons.Melee.Events; +using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Player; @@ -17,6 +18,7 @@ namespace Content.Server.Stunnable.Systems public sealed class StunbatonSystem : EntitySystem { [Dependency] private readonly SharedItemSystem _item = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -50,7 +52,7 @@ namespace Content.Server.Stunnable.Systems if (battery.CurrentCharge < component.EnergyPerUse) { SoundSystem.Play(component.SparksSound.GetSound(), Filter.Pvs(component.Owner, entityManager: EntityManager), uid, AudioHelpers.WithVariation(0.25f)); - TurnOff(component); + TurnOff(uid, component); } } @@ -58,11 +60,11 @@ namespace Content.Server.Stunnable.Systems { if (comp.Activated) { - TurnOff(comp); + TurnOff(uid, comp); } else { - TurnOn(comp, args.User); + TurnOn(uid, comp, args.User); } } @@ -77,7 +79,7 @@ namespace Content.Server.Stunnable.Systems ("charge", (int)((battery.CurrentCharge/battery.MaxCharge) * 100)))); } - private void TurnOff(StunbatonComponent comp) + private void TurnOff(EntityUid uid, StunbatonComponent comp) { if (!comp.Activated) return; @@ -86,7 +88,7 @@ namespace Content.Server.Stunnable.Systems TryComp(comp.Owner, out var item)) { _item.SetHeldPrefix(comp.Owner, "off", item); - appearance.SetData(ToggleVisuals.Toggled, false); + _appearance.SetData(uid, ToggleVisuals.Toggled, false, appearance); } SoundSystem.Play(comp.SparksSound.GetSound(), Filter.Pvs(comp.Owner), comp.Owner, AudioHelpers.WithVariation(0.25f)); @@ -94,7 +96,7 @@ namespace Content.Server.Stunnable.Systems comp.Activated = false; } - private void TurnOn(StunbatonComponent comp, EntityUid user) + private void TurnOn(EntityUid uid, StunbatonComponent comp, EntityUid user) { if (comp.Activated) return; @@ -111,7 +113,7 @@ namespace Content.Server.Stunnable.Systems EntityManager.TryGetComponent(comp.Owner, out var item)) { _item.SetHeldPrefix(comp.Owner, "on", item); - appearance.SetData(ToggleVisuals.Toggled, true); + _appearance.SetData(uid, ToggleVisuals.Toggled, true, appearance); } SoundSystem.Play(comp.SparksSound.GetSound(), playerFilter, comp.Owner, AudioHelpers.WithVariation(0.25f)); diff --git a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs index c2f871526f..acb55c36b6 100644 --- a/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs +++ b/Content.Server/SurveillanceCamera/Systems/SurveillanceCameraSystem.cs @@ -1,8 +1,6 @@ -using Content.Server.Administration.Managers; using Content.Server.DeviceNetwork; using Content.Server.DeviceNetwork.Components; using Content.Server.DeviceNetwork.Systems; -using Content.Server.Ghost.Components; using Content.Server.Power.Components; using Content.Shared.ActionBlocker; using Content.Shared.DeviceNetwork; @@ -20,6 +18,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem [Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!; [Dependency] private readonly DeviceNetworkSystem _deviceNetworkSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterface = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; // Pings a surveillance camera subnet. All cameras will always respond // with a data message if they are on the same subnet. @@ -371,10 +370,10 @@ public sealed class SurveillanceCameraSystem : EntitySystem } } - private void UpdateVisuals(EntityUid camera, SurveillanceCameraComponent? component = null, AppearanceComponent? appearance = null) + private void UpdateVisuals(EntityUid uid, SurveillanceCameraComponent? component = null, AppearanceComponent? appearance = null) { // Don't log missing, because otherwise tests fail. - if (!Resolve(camera, ref component, ref appearance, false)) + if (!Resolve(uid, ref component, ref appearance, false)) { return; } @@ -391,7 +390,7 @@ public sealed class SurveillanceCameraSystem : EntitySystem key = SurveillanceCameraVisuals.InUse; } - appearance.SetData(SurveillanceCameraVisualsKey.Key, key); + _appearance.SetData(uid, SurveillanceCameraVisualsKey.Key, key, appearance); } } diff --git a/Content.Server/Tools/Systems/WeldableSystem.cs b/Content.Server/Tools/Systems/WeldableSystem.cs index 76baae3211..068af0eceb 100644 --- a/Content.Server/Tools/Systems/WeldableSystem.cs +++ b/Content.Server/Tools/Systems/WeldableSystem.cs @@ -4,6 +4,7 @@ using Content.Shared.Database; using Content.Shared.Examine; using Content.Shared.Interaction; using Content.Shared.Tools.Components; +using Robust.Server.GameObjects; namespace Content.Server.Tools.Systems; @@ -11,6 +12,7 @@ public sealed class WeldableSystem : EntitySystem { [Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly ToolSystem _toolSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -102,7 +104,7 @@ public sealed class WeldableSystem : EntitySystem if (!TryComp(uid, out AppearanceComponent? appearance)) return; - appearance.SetData(WeldableVisuals.IsWelded, component.IsWelded); + _appearance.SetData(uid, WeldableVisuals.IsWelded, component.IsWelded, appearance); } public void ForceWeldedState(EntityUid uid, bool state, WeldableComponent? component = null) diff --git a/Content.Server/Wires/WiresSystem.cs b/Content.Server/Wires/WiresSystem.cs index a521e6e68c..d4890fbfa5 100644 --- a/Content.Server/Wires/WiresSystem.cs +++ b/Content.Server/Wires/WiresSystem.cs @@ -172,7 +172,7 @@ public sealed class WiresSystem : EntitySystem if (!d.Action.AddWire(d, types[actionType])) d.Action = null; } - + data.Add(id, new WireLayout.WireData(d.Letter, d.Color, i)); wires.WiresList[i] = wireSet[id]; } @@ -261,7 +261,7 @@ public sealed class WiresSystem : EntitySystem /// The key used to cancel the action. public bool TryCancelWireAction(EntityUid owner, object key) { - if (TryGetData(owner, key, out CancellationTokenSource? token)) + if (TryGetData(owner, key, out var token)) { token.Cancel(); return true; diff --git a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs index a7e191eabf..bd7251b943 100644 --- a/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs +++ b/Content.Shared/Nutrition/EntitySystems/SharedCreamPieSystem.cs @@ -9,6 +9,7 @@ namespace Content.Shared.Nutrition.EntitySystems public abstract class SharedCreamPieSystem : EntitySystem { [Dependency] private SharedStunSystem _stunSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -41,7 +42,7 @@ namespace Content.Shared.Nutrition.EntitySystems if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) { - appearance.SetData(CreamPiedVisuals.Creamed, value); + _appearance.SetData(uid, CreamPiedVisuals.Creamed, value, appearance); } } diff --git a/Content.Shared/PDA/SharedPDASystem.cs b/Content.Shared/PDA/SharedPDASystem.cs index 12ed8e6e45..611e188581 100644 --- a/Content.Shared/PDA/SharedPDASystem.cs +++ b/Content.Shared/PDA/SharedPDASystem.cs @@ -7,6 +7,7 @@ namespace Content.Shared.PDA public abstract class SharedPDASystem : EntitySystem { [Dependency] protected readonly ItemSlotsSystem ItemSlotsSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -27,7 +28,7 @@ namespace Content.Shared.PDA ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAIdSlotId, pda.IdSlot); ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAPenSlotId, pda.PenSlot); - UpdatePDAAppearance(pda); + UpdatePdaAppearance(uid, pda); } private void OnComponentRemove(EntityUid uid, PDAComponent pda, ComponentRemove args) @@ -41,7 +42,7 @@ namespace Content.Shared.PDA if (args.Container.ID == PDAComponent.PDAIdSlotId) pda.ContainedID = CompOrNull(args.Entity); - UpdatePDAAppearance(pda); + UpdatePdaAppearance(uid, pda); } protected virtual void OnItemRemoved(EntityUid uid, PDAComponent pda, EntRemovedFromContainerMessage args) @@ -49,13 +50,13 @@ namespace Content.Shared.PDA if (args.Container.ID == pda.IdSlot.ID) pda.ContainedID = null; - UpdatePDAAppearance(pda); + UpdatePdaAppearance(uid, pda); } - private void UpdatePDAAppearance(PDAComponent pda) + private void UpdatePdaAppearance(EntityUid uid, PDAComponent pda) { if (TryComp(pda.Owner, out AppearanceComponent ? appearance)) - appearance.SetData(PDAVisuals.IDCardInserted, pda.ContainedID != null); + _appearance.SetData(uid, PDAVisuals.IDCardInserted, pda.ContainedID != null, appearance); } } } diff --git a/Content.Shared/Payload/EntitySystems/ChemicalPayloadSystem.cs b/Content.Shared/Payload/EntitySystems/ChemicalPayloadSystem.cs index 71670b2d04..a06bb74a06 100644 --- a/Content.Shared/Payload/EntitySystems/ChemicalPayloadSystem.cs +++ b/Content.Shared/Payload/EntitySystems/ChemicalPayloadSystem.cs @@ -7,6 +7,7 @@ namespace Content.Shared.Payload.EntitySystems; public sealed class ChemicalPayloadSystem : EntitySystem { [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; + [Dependency] private readonly SharedAppearanceSystem _appearance = default!; public override void Initialize() { @@ -36,7 +37,7 @@ public sealed class ChemicalPayloadSystem : EntitySystem if (component.BeakerSlotB.HasItem) filled |= ChemicalPayloadFilledSlots.Right; - appearance.SetData(ChemicalPayloadVisuals.Slots, filled); + _appearance.SetData(uid, ChemicalPayloadVisuals.Slots, filled, appearance); } private void OnComponentInit(EntityUid uid, ChemicalPayloadComponent payload, ComponentInit args)