Remove some obsolete AppearanceComponent method usages (#13726)

This commit is contained in:
Visne
2023-02-02 17:34:53 +01:00
committed by GitHub
parent 23b90de34d
commit 5a5a3afbb1
111 changed files with 428 additions and 349 deletions

View File

@@ -15,7 +15,7 @@ public sealed class AMEControllerVisualizerSystem : VisualizerSystem<AMEControll
private void OnComponentInit(EntityUid uid, AMEControllerVisualsComponent component, ComponentInit args) private void OnComponentInit(EntityUid uid, AMEControllerVisualsComponent component, ComponentInit args)
{ {
if(TryComp<SpriteComponent>(uid, out var sprite)) if (TryComp<SpriteComponent>(uid, out var sprite))
{ {
sprite.LayerMapSet(AMEControllerVisualLayers.Display, sprite.AddLayerState("control_on")); sprite.LayerMapSet(AMEControllerVisualLayers.Display, sprite.AddLayerState("control_on"));
sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false); sprite.LayerSetVisible(AMEControllerVisualLayers.Display, false);
@@ -26,10 +26,13 @@ public sealed class AMEControllerVisualizerSystem : VisualizerSystem<AMEControll
{ {
base.OnAppearanceChange(uid, component, ref args); base.OnAppearanceChange(uid, component, ref args);
if(args.Sprite != null if (args.Sprite == null
&& args.Component.TryGetData<string>(AMEControllerVisuals.DisplayState, out var state)) || !AppearanceSystem.TryGetData<string>(uid, AMEControllerVisuals.DisplayState, out var state, args.Component))
{ {
switch(state) return;
}
switch (state)
{ {
case "on": case "on":
args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_on"); args.Sprite.LayerSetState(AMEControllerVisualLayers.Display, "control_on");
@@ -51,7 +54,6 @@ public sealed class AMEControllerVisualizerSystem : VisualizerSystem<AMEControll
break; break;
} }
} }
}
} }
public enum AMEControllerVisualLayers : byte public enum AMEControllerVisualLayers : byte

View File

@@ -15,7 +15,7 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem<AMEShielding
private void OnComponentInit(EntityUid uid, AMEShieldingVisualsComponent component, ComponentInit args) private void OnComponentInit(EntityUid uid, AMEShieldingVisualsComponent component, ComponentInit args)
{ {
if(TryComp<SpriteComponent>(uid, out var sprite)) if (TryComp<SpriteComponent>(uid, out var sprite))
{ {
sprite.LayerMapSet(AMEShieldingVisualsLayer.Core, sprite.AddLayerState("core")); sprite.LayerMapSet(AMEShieldingVisualsLayer.Core, sprite.AddLayerState("core"));
sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, false); sprite.LayerSetVisible(AMEShieldingVisualsLayer.Core, false);
@@ -26,10 +26,10 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem<AMEShielding
protected override void OnAppearanceChange(EntityUid uid, AMEShieldingVisualsComponent component, ref AppearanceChangeEvent args) protected override void OnAppearanceChange(EntityUid uid, AMEShieldingVisualsComponent component, ref AppearanceChangeEvent args)
{ {
if(args.Sprite == null) if (args.Sprite == null)
return; return;
if(args.Component.TryGetData<string>(AMEShieldVisuals.Core, out var core)) if (AppearanceSystem.TryGetData<string>(uid, AMEShieldVisuals.Core, out var core, args.Component))
{ {
if (core == "isCore") if (core == "isCore")
{ {
@@ -43,9 +43,9 @@ public sealed class AMEShieldingVisualizerSystem : VisualizerSystem<AMEShielding
} }
} }
if(args.Component.TryGetData<string>(AMEShieldVisuals.CoreState, out var coreState)) if (AppearanceSystem.TryGetData<string>(uid, AMEShieldVisuals.CoreState, out var coreState, args.Component))
{ {
switch(coreState) switch (coreState)
{ {
case "weak": case "weak":
args.Sprite.LayerSetState(AMEShieldingVisualsLayer.CoreState, "core_weak"); args.Sprite.LayerSetState(AMEShieldingVisualsLayer.CoreState, "core_weak");

View File

@@ -22,10 +22,10 @@ public sealed class AnomalySystem : SharedAnomalySystem
if (args.Sprite is not { } sprite) if (args.Sprite is not { } sprite)
return; return;
if (!Appearance.TryGetData(uid, AnomalyVisuals.IsPulsing, out bool pulsing, args.Component)) if (!Appearance.TryGetData<bool>(uid, AnomalyVisuals.IsPulsing, out var pulsing, args.Component))
pulsing = false; pulsing = false;
if (Appearance.TryGetData(uid, AnomalyVisuals.Supercritical, out bool super, args.Component) && super) if (Appearance.TryGetData<bool>(uid, AnomalyVisuals.Supercritical, out var super, args.Component) && super)
pulsing = super; pulsing = super;
if (HasComp<AnomalySupercriticalComponent>(uid)) if (HasComp<AnomalySupercriticalComponent>(uid))

View File

@@ -2,7 +2,6 @@ using Content.Client.SubFloor;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Atmos.Components; using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping;
using Content.Shared.SubFloor;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement; using Robust.Client.ResourceManagement;
@@ -13,6 +12,7 @@ namespace Content.Client.Atmos.EntitySystems;
public sealed class AtmosPipeAppearanceSystem : EntitySystem public sealed class AtmosPipeAppearanceSystem : EntitySystem
{ {
[Dependency] private readonly IResourceCache _resCache = default!; [Dependency] private readonly IResourceCache _resCache = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -56,10 +56,10 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
return; return;
} }
if (!args.Component.TryGetData(PipeColorVisuals.Color, out Color color)) if (!_appearance.TryGetData<Color>(uid, PipeColorVisuals.Color, out var color, args.Component))
color = Color.White; color = Color.White;
if (!args.Component.TryGetData(PipeVisuals.VisualState, out PipeDirection worldConnectedDirections)) if (!_appearance.TryGetData<PipeDirection>(uid, PipeVisuals.VisualState, out var worldConnectedDirections, args.Component))
return; return;
// transform connected directions to local-coordinates // transform connected directions to local-coordinates

View File

@@ -56,8 +56,8 @@ public sealed class FireVisualizerSystem : VisualizerSystem<FireVisualsComponent
if (!sprite.LayerMapTryGet(FireVisualLayers.Fire, out var index)) if (!sprite.LayerMapTryGet(FireVisualLayers.Fire, out var index))
return; return;
appearance.TryGetData(FireVisuals.OnFire, out bool onFire); AppearanceSystem.TryGetData<bool>(uid, FireVisuals.OnFire, out var onFire, appearance);
appearance.TryGetData(FireVisuals.FireStacks, out float fireStacks); AppearanceSystem.TryGetData<float>(uid, FireVisuals.FireStacks, out var fireStacks, appearance);
sprite.LayerSetVisible(index, onFire); sprite.LayerSetVisible(index, onFire);
if (!onFire) if (!onFire)

View File

@@ -8,8 +8,8 @@ public sealed class PipeColorVisualizerSystem : VisualizerSystem<PipeColorVisual
{ {
protected override void OnAppearanceChange(EntityUid uid, PipeColorVisualsComponent component, ref AppearanceChangeEvent args) protected override void OnAppearanceChange(EntityUid uid, PipeColorVisualsComponent component, ref AppearanceChangeEvent args)
{ {
if(TryComp<SpriteComponent>(uid, out var sprite) if (TryComp<SpriteComponent>(uid, out var sprite)
&& args.Component.TryGetData<Color>(PipeColorVisuals.Color, out var color)) && AppearanceSystem.TryGetData<Color>(uid, PipeColorVisuals.Color, out var color, args.Component))
{ {
// T-ray scanner / sub floor runs after this visualizer. Lets not bulldoze transparency. // T-ray scanner / sub floor runs after this visualizer. Lets not bulldoze transparency.
var layer = sprite[PipeVisualLayers.Pipe]; var layer = sprite[PipeVisualLayers.Pipe];

View File

@@ -14,8 +14,8 @@ namespace Content.Client.Atmos.Visualizers
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(PortableScrubberVisuals.IsFull, out bool isFull) if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
&& args.Component.TryGetData(PortableScrubberVisuals.IsRunning, out bool isRunning)) && AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
{ {
var runningState = isRunning ? component.RunningState : component.IdleState; var runningState = isRunning ? component.RunningState : component.IdleState;
args.Sprite.LayerSetState(PortableScrubberVisualLayers.IsRunning, runningState); args.Sprite.LayerSetState(PortableScrubberVisualLayers.IsRunning, runningState);
@@ -24,7 +24,7 @@ namespace Content.Client.Atmos.Visualizers
args.Sprite.LayerSetState(PowerDeviceVisualLayers.Powered, fullState); args.Sprite.LayerSetState(PowerDeviceVisualLayers.Powered, fullState);
} }
if (args.Component.TryGetData(PortableScrubberVisuals.IsDraining, out bool isDraining)) if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
{ {
args.Sprite.LayerSetVisible(PortableScrubberVisualLayers.IsDraining, isDraining); args.Sprite.LayerSetVisible(PortableScrubberVisualLayers.IsDraining, isDraining);
} }

View File

@@ -35,7 +35,7 @@ public sealed class BarSignSystem : VisualizerSystem<BarSignComponent>
if (!Resolve(sign.Owner, ref appearance, ref sprite)) if (!Resolve(sign.Owner, ref appearance, ref sprite))
return; return;
appearance.TryGetData(PowerDeviceVisuals.Powered, out bool powered); AppearanceSystem.TryGetData<bool>(sign.Owner, PowerDeviceVisuals.Powered, out var powered, appearance);
if (powered if (powered
&& sign.CurrentSign != null && sign.CurrentSign != null

View File

@@ -1,22 +1,21 @@
using Content.Shared.Bed; using Content.Shared.Bed;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
namespace Content.Client.Bed namespace Content.Client.Bed;
public sealed class StasisBedSystem : VisualizerSystem<StasisBedVisualsComponent>
{ {
public sealed class StasisBedSystem : VisualizerSystem<StasisBedVisualsComponent>
{
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 if (args.Sprite != null
&& args.Component.TryGetData(StasisBedVisuals.IsOn, out bool isOn)) && AppearanceSystem.TryGetData<bool>(uid, StasisBedVisuals.IsOn, out var isOn, args.Component))
{ {
args.Sprite.LayerSetVisible(StasisBedVisualLayers.IsOn, isOn); args.Sprite.LayerSetVisible(StasisBedVisualLayers.IsOn, isOn);
} }
} }
} }
public enum StasisBedVisualLayers : byte public enum StasisBedVisualLayers : byte
{ {
IsOn, IsOn,
}
} }

View File

@@ -26,8 +26,8 @@ public sealed class PlantHolderVisualizerSystem : VisualizerSystem<PlantHolderVi
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData<string>(PlantHolderVisuals.PlantRsi, out var rsi) if (AppearanceSystem.TryGetData<string>(uid, PlantHolderVisuals.PlantRsi, out var rsi, args.Component)
&& args.Component.TryGetData<string>(PlantHolderVisuals.PlantState, out var state)) && AppearanceSystem.TryGetData<string>(uid, PlantHolderVisuals.PlantState, out var state, args.Component))
{ {
var valid = !string.IsNullOrWhiteSpace(state); var valid = !string.IsNullOrWhiteSpace(state);

View File

@@ -11,7 +11,7 @@ public sealed class PotencyVisualsSystem : VisualizerSystem<PotencyVisualsCompon
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(ProduceVisuals.Potency, out float potency)) if (AppearanceSystem.TryGetData<float>(uid, ProduceVisuals.Potency, out var potency, args.Component))
{ {
var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100); var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100);
args.Sprite.Scale = new Vector2(scale, scale); args.Sprite.Scale = new Vector2(scale, scale);

View File

@@ -10,8 +10,8 @@ public sealed class ItemCabinetSystem : VisualizerSystem<ItemCabinetVisualsCompo
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(ItemCabinetVisuals.IsOpen, out bool isOpen) if (AppearanceSystem.TryGetData<bool>(uid, ItemCabinetVisuals.IsOpen, out var isOpen, args.Component)
&& args.Component.TryGetData(ItemCabinetVisuals.ContainsItem, out bool contains)) && AppearanceSystem.TryGetData<bool>(uid, ItemCabinetVisuals.ContainsItem, out var contains, args.Component))
{ {
var state = isOpen ? component.OpenState : component.ClosedState; var state = isOpen ? component.OpenState : component.ClosedState;
args.Sprite.LayerSetState(ItemCabinetVisualLayers.Door, state); args.Sprite.LayerSetState(ItemCabinetVisualLayers.Door, state);

View File

@@ -67,7 +67,7 @@ public sealed partial class CargoSystem
if (!Resolve(component.Owner, ref sprite)) if (!Resolve(component.Owner, ref sprite))
return; return;
_appearance.TryGetData(component.Owner, CargoTelepadVisuals.State, out CargoTelepadState? state); _appearance.TryGetData<CargoTelepadState?>(component.Owner, CargoTelepadVisuals.State, out var state);
AnimationPlayerComponent? player = null; AnimationPlayerComponent? player = null;
switch (state) switch (state)

View File

@@ -20,7 +20,7 @@ public sealed class TypingIndicatorVisualizerSystem : VisualizerSystem<TypingInd
return; return;
} }
args.Component.TryGetData(TypingIndicatorVisuals.IsTyping, out bool isTyping); AppearanceSystem.TryGetData<bool>(uid, TypingIndicatorVisuals.IsTyping, out var isTyping, args.Component);
var layerExists = args.Sprite.LayerMapTryGet(TypingIndicatorLayers.Base, out var layer); var layerExists = args.Sprite.LayerMapTryGet(TypingIndicatorLayers.Base, out var layer);
if (!layerExists) if (!layerExists)
layer = args.Sprite.LayerMapReserveBlank(TypingIndicatorLayers.Base); layer = args.Sprite.LayerMapReserveBlank(TypingIndicatorLayers.Base);

View File

@@ -5,11 +5,9 @@ namespace Content.Client.Chemistry.Visualizers;
public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionContainerVisualsComponent> public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionContainerVisualsComponent>
{ {
[Dependency] private readonly AppearanceSystem _appearance = default!;
protected override void OnAppearanceChange(EntityUid uid, SolutionContainerVisualsComponent component, ref AppearanceChangeEvent args) 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<float>(uid, SolutionContainerVisuals.FillFraction, out var fraction, args.Component))
return; return;
if (args.Sprite == null) if (args.Sprite == null)
@@ -39,7 +37,7 @@ public sealed class SolutionContainerVisualsSystem : VisualizerSystem<SolutionCo
var stateName = component.FillBaseName + closestFillSprite; var stateName = component.FillBaseName + closestFillSprite;
args.Sprite.LayerSetState(fillLayer, stateName); args.Sprite.LayerSetState(fillLayer, stateName);
if (component.ChangeColor && _appearance.TryGetData(uid, SolutionContainerVisuals.Color, out Color color, args.Component)) if (component.ChangeColor && AppearanceSystem.TryGetData<Color>(uid, SolutionContainerVisuals.Color, out var color, args.Component))
args.Sprite.LayerSetColor(fillLayer, color); args.Sprite.LayerSetColor(fillLayer, color);
} }
else else

View File

@@ -45,7 +45,7 @@ public sealed class ClientClothingSystem : ClothingSystem
[Dependency] private readonly IResourceCache _cache = default!; [Dependency] private readonly IResourceCache _cache = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -345,7 +345,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem<DamageVisualsComponen
// If this was passed into the component, we update // If this was passed into the component, we update
// the data to ensure that the current disabled // the data to ensure that the current disabled
// bool matches. // bool matches.
if (args.Component.TryGetData<bool>(DamageVisualizerKeys.Disabled, out var disabledStatus)) if (AppearanceSystem.TryGetData<bool>(uid, DamageVisualizerKeys.Disabled, out var disabledStatus, args.Component))
damageVisComp.Disabled = disabledStatus; damageVisComp.Disabled = disabledStatus;
if (damageVisComp.Disabled) if (damageVisComp.Disabled)
@@ -366,7 +366,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem<DamageVisualsComponen
if (damageVisComp.Overlay && damageVisComp.DamageOverlayGroups != null && damageVisComp.TargetLayers == null) if (damageVisComp.Overlay && damageVisComp.DamageOverlayGroups != null && damageVisComp.TargetLayers == null)
CheckOverlayOrdering(spriteComponent, damageVisComp); CheckOverlayOrdering(spriteComponent, damageVisComp);
if (component.TryGetData<bool>(DamageVisualizerKeys.ForceUpdate, out var update) if (AppearanceSystem.TryGetData<bool>(component.Owner, DamageVisualizerKeys.ForceUpdate, out var update, component)
&& update) && update)
{ {
ForceUpdateLayers(damageComponent, spriteComponent, damageVisComp); ForceUpdateLayers(damageComponent, spriteComponent, damageVisComp);
@@ -377,7 +377,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem<DamageVisualsComponen
{ {
UpdateDamageVisuals(damageComponent, spriteComponent, damageVisComp); UpdateDamageVisuals(damageComponent, spriteComponent, damageVisComp);
} }
else if (component.TryGetData(DamageVisualizerKeys.DamageUpdateGroups, out DamageVisualizerGroupData data)) else if (AppearanceSystem.TryGetData<DamageVisualizerGroupData>(component.Owner, DamageVisualizerKeys.DamageUpdateGroups, out var data, component))
{ {
UpdateDamageVisuals(data.GroupList, damageComponent, spriteComponent, damageVisComp); UpdateDamageVisuals(data.GroupList, damageComponent, spriteComponent, damageVisComp);
} }
@@ -394,7 +394,7 @@ public sealed class DamageVisualsSystem : VisualizerSystem<DamageVisualsComponen
foreach (var layer in damageVisComp.TargetLayerMapKeys) foreach (var layer in damageVisComp.TargetLayerMapKeys)
{ {
bool? layerStatus = null; bool? layerStatus = null;
if (component.TryGetData<bool>(layer, out var layerStateEnum)) if (AppearanceSystem.TryGetData<bool>(component.Owner, layer, out var layerStateEnum, component))
layerStatus = layerStateEnum; layerStatus = layerStateEnum;
if (layerStatus == null) if (layerStatus == null)

View File

@@ -10,7 +10,7 @@ public sealed class DamageStateVisualizerSystem : VisualizerSystem<DamageStateVi
{ {
var sprite = args.Sprite; var sprite = args.Sprite;
if (sprite == null || !args.Component.TryGetData(MobStateVisuals.State, out MobState data)) if (sprite == null || !AppearanceSystem.TryGetData<MobState>(uid, MobStateVisuals.State, out var data, args.Component))
{ {
return; return;
} }

View File

@@ -14,8 +14,8 @@ namespace Content.Client.Disease
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(DiseaseMachineVisuals.IsOn, out bool isOn) if (AppearanceSystem.TryGetData<bool>(uid, DiseaseMachineVisuals.IsOn, out var isOn, args.Component)
&& args.Component.TryGetData(DiseaseMachineVisuals.IsRunning, out bool isRunning)) && AppearanceSystem.TryGetData<bool>(uid, DiseaseMachineVisuals.IsRunning, out var isRunning, args.Component))
{ {
var state = isRunning ? component.RunningState : component.IdleState; var state = isRunning ? component.RunningState : component.IdleState;
args.Sprite.LayerSetVisible(DiseaseMachineVisualLayers.IsOn, isOn); args.Sprite.LayerSetVisible(DiseaseMachineVisualLayers.IsOn, isOn);

View File

@@ -6,6 +6,8 @@ namespace Content.Client.Ensnaring.Visualizers;
public sealed class EnsnareableSystem : SharedEnsnareableSystem public sealed class EnsnareableSystem : SharedEnsnareableSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -28,7 +30,7 @@ public sealed class EnsnareableSystem : SharedEnsnareableSystem
if (args.Sprite == null || !args.Sprite.LayerMapTryGet(EnsnaredVisualLayers.Ensnared, out var layer)) if (args.Sprite == null || !args.Sprite.LayerMapTryGet(EnsnaredVisualLayers.Ensnared, out var layer))
return; return;
if (args.Component.TryGetData(EnsnareableVisuals.IsEnsnared, out bool isEnsnared)) if (_appearance.TryGetData<bool>(uid, EnsnareableVisuals.IsEnsnared, out var isEnsnared, args.Component))
{ {
if (component.Sprite != null) if (component.Sprite != null)
{ {

View File

@@ -9,6 +9,7 @@ namespace Content.Client.Explosion;
public sealed partial class TriggerSystem public sealed partial class TriggerSystem
{ {
[Dependency] private readonly AnimationPlayerSystem _player = default!; [Dependency] private readonly AnimationPlayerSystem _player = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
/* /*
* Currently all of the appearance stuff is hardcoded for portable flashers * Currently all of the appearance stuff is hardcoded for portable flashers
@@ -53,7 +54,7 @@ public sealed partial class TriggerSystem
if (!TryComp<AppearanceComponent>(uid, out var appearance)) return; if (!TryComp<AppearanceComponent>(uid, out var appearance)) return;
// So animation doesn't get spammed if no server state comes in. // 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); OnChangeData(uid, component, appearance);
} }
@@ -73,7 +74,7 @@ public sealed partial class TriggerSystem
return; return;
TryComp<AnimationPlayerComponent>(component.Owner, out var player); TryComp<AnimationPlayerComponent>(component.Owner, out var player);
appearance.TryGetData(ProximityTriggerVisualState.State, out ProximityTriggerVisuals state); _appearance.TryGetData<ProximityTriggerVisuals>(appearance.Owner, ProximityTriggerVisualState.State, out var state, appearance);
switch (state) switch (state)
{ {

View File

@@ -22,11 +22,6 @@ namespace Content.Client.Fluids
private void OnComponentInit(EntityUid uid, PuddleVisualizerComponent puddleVisuals, ComponentInit args) private void OnComponentInit(EntityUid uid, PuddleVisualizerComponent puddleVisuals, ComponentInit args)
{ {
if (!TryComp(uid, out AppearanceComponent? appearance))
{
return;
}
if (!TryComp(uid, out SpriteComponent? sprite)) if (!TryComp(uid, out SpriteComponent? sprite))
{ {
return; return;
@@ -45,10 +40,10 @@ namespace Content.Client.Fluids
return; return;
} }
if (!args.Component.TryGetData(PuddleVisuals.VolumeScale, out float volumeScale) if (!AppearanceSystem.TryGetData<float>(uid, PuddleVisuals.VolumeScale, out var volumeScale)
|| !args.Component.TryGetData(PuddleVisuals.CurrentVolume, out FixedPoint2 currentVolume) || !AppearanceSystem.TryGetData<FixedPoint2>(uid, PuddleVisuals.CurrentVolume, out var currentVolume)
|| !args.Component.TryGetData(PuddleVisuals.SolutionColor, out Color solutionColor) || !AppearanceSystem.TryGetData<Color>(uid, PuddleVisuals.SolutionColor, out var solutionColor)
|| !args.Component.TryGetData(PuddleVisuals.IsEvaporatingVisual, out bool isEvaporating)) || !AppearanceSystem.TryGetData<bool>(uid, PuddleVisuals.IsEvaporatingVisual, out var isEvaporating))
{ {
return; return;
} }

View File

@@ -1,22 +1,20 @@
using Content.Shared.Kudzu; using Content.Shared.Kudzu;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
namespace Content.Client.Kudzu namespace Content.Client.Kudzu;
{
public sealed class KudzuVisualsSystem : VisualizerSystem<KudzuVisualsComponent> public sealed class KudzuVisualsSystem : VisualizerSystem<KudzuVisualsComponent>
{ {
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) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(KudzuVisuals.Variant, out int var) if (AppearanceSystem.TryGetData<int>(uid, KudzuVisuals.Variant, out var var, args.Component)
&& args.Component.TryGetData(KudzuVisuals.GrowthLevel, out int level)) && AppearanceSystem.TryGetData<int>(uid, KudzuVisuals.GrowthLevel, out var level, args.Component))
{ {
var index = args.Sprite.LayerMapReserveBlank(component.Layer); var index = args.Sprite.LayerMapReserveBlank(component.Layer);
args.Sprite.LayerSetState(index, $"kudzu_{level}{var}"); args.Sprite.LayerSetState(index, $"kudzu_{level}{var}");
} }
} }
}
} }

View File

@@ -8,7 +8,7 @@ namespace Content.Client.Lathe;
public sealed class LatheSystem : SharedLatheSystem public sealed class LatheSystem : SharedLatheSystem
{ {
[Dependency] private readonly AppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -22,14 +22,14 @@ public sealed class LatheSystem : SharedLatheSystem
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (_appearance.TryGetData(uid, PowerDeviceVisuals.Powered, out bool powered, args.Component) && if (_appearance.TryGetData<bool>(uid, PowerDeviceVisuals.Powered, out var powered, args.Component) &&
args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out _)) args.Sprite.LayerMapTryGet(PowerDeviceVisualLayers.Powered, out _))
{ {
args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered); args.Sprite.LayerSetVisible(PowerDeviceVisualLayers.Powered, powered);
} }
// Lathe specific stuff // Lathe specific stuff
if (_appearance.TryGetData(uid, LatheVisuals.IsRunning, out bool isRunning, args.Component)) if (_appearance.TryGetData<bool>(uid, LatheVisuals.IsRunning, out var isRunning, args.Component))
{ {
var state = isRunning ? component.RunningState : component.IdleState; var state = isRunning ? component.RunningState : component.IdleState;
args.Sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f); args.Sprite.LayerSetAnimationTime(LatheVisualLayers.IsRunning, 0f);

View File

@@ -32,12 +32,12 @@ public sealed class HandheldLightSystem : SharedHandheldLightSystem
return; return;
} }
if (!_appearance.TryGetData(uid, ToggleableLightVisuals.Enabled, out bool enabled, args.Component)) if (!_appearance.TryGetData<bool>(uid, ToggleableLightVisuals.Enabled, out var enabled, args.Component))
{ {
return; return;
} }
if (!_appearance.TryGetData(uid, HandheldLightVisuals.Power, out HandheldLightPowerStates state, args.Component)) if (!_appearance.TryGetData<HandheldLightPowerStates>(uid, HandheldLightVisuals.Power, out var state, args.Component))
{ {
return; return;
} }

View File

@@ -23,7 +23,7 @@ public sealed class MaterialStorageSystem : SharedMaterialStorageSystem
if (!args.Sprite.LayerMapTryGet(MaterialStorageVisualLayers.Inserting, out var layer)) if (!args.Sprite.LayerMapTryGet(MaterialStorageVisualLayers.Inserting, out var layer))
return; return;
if (!_appearance.TryGetData(uid, MaterialStorageVisuals.Inserting, out bool inserting, args.Component)) if (!_appearance.TryGetData<bool>(uid, MaterialStorageVisuals.Inserting, out var inserting, args.Component))
return; return;
if (inserting && TryComp<InsertingMaterialStorageComponent>(uid, out var insertingComp)) if (inserting && TryComp<InsertingMaterialStorageComponent>(uid, out var insertingComp))

View File

@@ -14,7 +14,7 @@ public sealed class MechAssemblyVisualizerSystem : VisualizerSystem<MechAssembly
{ {
base.OnAppearanceChange(uid, component, ref args); base.OnAppearanceChange(uid, component, ref args);
if (!args.Component.TryGetData(MechAssemblyVisuals.State, out int stage)) if (!AppearanceSystem.TryGetData<int>(uid, MechAssemblyVisuals.State, out var stage, args.Component))
return; return;
var state = component.StatePrefix + stage; var state = component.StatePrefix + stage;

View File

@@ -8,6 +8,8 @@ namespace Content.Client.Mech;
/// <inheritdoc/> /// <inheritdoc/>
public sealed class MechSystem : SharedMechSystem public sealed class MechSystem : SharedMechSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
{ {
@@ -26,12 +28,12 @@ public sealed class MechSystem : SharedMechSystem
var state = component.BaseState; var state = component.BaseState;
var drawDepth = DrawDepth.Mobs; var drawDepth = DrawDepth.Mobs;
if (component.BrokenState != null && args.Component.TryGetData(MechVisuals.Broken, out bool broken) && broken) if (component.BrokenState != null && _appearance.TryGetData<bool>(uid, MechVisuals.Broken, out var broken, args.Component) && broken)
{ {
state = component.BrokenState; state = component.BrokenState;
drawDepth = DrawDepth.SmallMobs; drawDepth = DrawDepth.SmallMobs;
} }
else if (component.OpenState != null && args.Component.TryGetData(MechVisuals.Open, out bool open) && open) else if (component.OpenState != null && _appearance.TryGetData<bool>(uid, MechVisuals.Open, out var open, args.Component) && open)
{ {
state = component.OpenState; state = component.OpenState;
drawDepth = DrawDepth.SmallMobs; drawDepth = DrawDepth.SmallMobs;

View File

@@ -9,6 +9,8 @@ namespace Content.Client.Medical.Cryogenics;
public sealed class CryoPodSystem: SharedCryoPodSystem public sealed class CryoPodSystem: SharedCryoPodSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -54,8 +56,8 @@ public sealed class CryoPodSystem: SharedCryoPodSystem
return; return;
} }
if (!args.Component.TryGetData(SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out bool isOpen) if (!_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.ContainsEntity, out var isOpen, args.Component)
|| !args.Component.TryGetData(SharedCryoPodComponent.CryoPodVisuals.IsOn, out bool isOn)) || !_appearance.TryGetData<bool>(uid, SharedCryoPodComponent.CryoPodVisuals.IsOn, out var isOn, args.Component))
{ {
return; return;
} }

View File

@@ -14,6 +14,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly ClothingSystem _clothing = default!; [Dependency] private readonly ClothingSystem _clothing = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -29,7 +30,7 @@ public sealed class JetpackSystem : SharedJetpackSystem
private void OnJetpackAppearance(EntityUid uid, JetpackComponent component, ref AppearanceChangeEvent args) private void OnJetpackAppearance(EntityUid uid, JetpackComponent component, ref AppearanceChangeEvent args)
{ {
args.Component.TryGetData(JetpackVisuals.Enabled, out bool enabled); _appearance.TryGetData<bool>(uid, JetpackVisuals.Enabled, out var enabled, args.Component);
var state = "icon" + (enabled ? "-on" : ""); var state = "icon" + (enabled ? "-on" : "");
args.Sprite?.LayerSetState(0, state); args.Sprite?.LayerSetState(0, state);

View File

@@ -11,10 +11,10 @@ public sealed class PaperSystem : VisualizerSystem<PaperVisualsComponent>
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(PaperVisuals.Status , out PaperStatus writingStatus)) if (AppearanceSystem.TryGetData<PaperStatus>(uid, PaperVisuals.Status , out var writingStatus, args.Component))
args.Sprite.LayerSetVisible(PaperVisualLayers.Writing, writingStatus == PaperStatus.Written); args.Sprite.LayerSetVisible(PaperVisualLayers.Writing, writingStatus == PaperStatus.Written);
if (args.Component.TryGetData(PaperVisuals.Stamp, out string stampState)) if (AppearanceSystem.TryGetData<string>(uid, PaperVisuals.Stamp, out var stampState, args.Component))
{ {
args.Sprite.LayerSetState(PaperVisualLayers.Stamp, stampState); args.Sprite.LayerSetState(PaperVisualLayers.Stamp, stampState);
args.Sprite.LayerSetVisible(PaperVisualLayers.Stamp, true); args.Sprite.LayerSetVisible(PaperVisualLayers.Stamp, true);

View File

@@ -8,7 +8,7 @@ namespace Content.Client.Pinpointer
public sealed class ClientPinpointerSystem : SharedPinpointerSystem public sealed class ClientPinpointerSystem : SharedPinpointerSystem
{ {
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly AppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {

View File

@@ -15,7 +15,7 @@ namespace Content.Client.Pinpointer
return; return;
// check if pinpointer screen is active // check if pinpointer screen is active
if (!args.Component.TryGetData(PinpointerVisuals.IsActive, out bool isActive) || !isActive) if (!AppearanceSystem.TryGetData<bool>(uid, PinpointerVisuals.IsActive, out var isActive, args.Component) || !isActive)
{ {
sprite.LayerSetVisible(PinpointerLayers.Screen, false); sprite.LayerSetVisible(PinpointerLayers.Screen, false);
return; return;
@@ -24,8 +24,8 @@ namespace Content.Client.Pinpointer
sprite.LayerSetVisible(PinpointerLayers.Screen, true); sprite.LayerSetVisible(PinpointerLayers.Screen, true);
// check distance and direction to target // check distance and direction to target
if (!args.Component.TryGetData(PinpointerVisuals.TargetDistance, out Distance dis) || if (!AppearanceSystem.TryGetData<Distance>(uid, PinpointerVisuals.TargetDistance, out var dis, args.Component) ||
!args.Component.TryGetData(PinpointerVisuals.ArrowAngle, out Angle angle)) !AppearanceSystem.TryGetData<Angle>(uid, PinpointerVisuals.ArrowAngle, out var angle, args.Component))
{ {
sprite.LayerSetState(PinpointerLayers.Screen, "pinonnull"); sprite.LayerSetState(PinpointerLayers.Screen, "pinonnull");
sprite.LayerSetRotation(PinpointerLayers.Screen, Angle.Zero); sprite.LayerSetRotation(PinpointerLayers.Screen, Angle.Zero);

View File

@@ -1,20 +1,17 @@
using Content.Client.SubFloor; using Content.Client.SubFloor;
using Content.Shared.SubFloor;
using Content.Shared.Wires; using Content.Shared.Wires;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
namespace Content.Client.Power.Visualizers; namespace Content.Client.Power.Visualizers;
public sealed partial class CableVisualizerSystem : EntitySystem public sealed class CableVisualizerSystem : VisualizerSystem<CableVisualizerComponent>
{ {
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); SubscribeLocalEvent<CableVisualizerComponent, AppearanceChangeEvent>(OnAppearanceChange, after: new[] { typeof(SubFloorHideSystem) });
SubscribeLocalEvent<CableVisualizerComponent, AppearanceChangeEvent>(OnAppearanceChanged, 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) if (args.Sprite == null)
return; return;
@@ -26,10 +23,9 @@ public sealed partial class CableVisualizerSystem : EntitySystem
return; return;
} }
if (!args.Component.TryGetData(WireVisVisuals.ConnectedMask, out WireVisDirFlags mask)) if (!AppearanceSystem.TryGetData<WireVisDirFlags>(uid, WireVisVisuals.ConnectedMask, out var mask, args.Component))
mask = WireVisDirFlags.None; mask = WireVisDirFlags.None;
args.Sprite.LayerSetState(0, $"{component.StatePrefix}{(int) mask}"); args.Sprite.LayerSetState(0, $"{component.StatePrefix}{(int) mask}");
} }
} }

View File

@@ -7,6 +7,8 @@ namespace Content.Client.PowerCell;
[UsedImplicitly] [UsedImplicitly]
public sealed class PowerCellSystem : SharedPowerCellSystem public sealed class PowerCellSystem : SharedPowerCellSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -21,7 +23,7 @@ public sealed class PowerCellSystem : SharedPowerCellSystem
if (!args.Sprite.TryGetLayer((int) PowerCellVisualLayers.Unshaded, out var unshadedLayer)) if (!args.Sprite.TryGetLayer((int) PowerCellVisualLayers.Unshaded, out var unshadedLayer))
return; return;
if (args.Component.TryGetData(PowerCellVisuals.ChargeLevel, out byte level)) if (_appearance.TryGetData<byte>(uid, PowerCellVisuals.ChargeLevel, out var level, args.Component))
{ {
if (level == 0) if (level == 0)
{ {

View File

@@ -6,6 +6,8 @@ namespace Content.Client.Revenant;
public sealed class RevenantSystem : EntitySystem public sealed class RevenantSystem : EntitySystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -18,15 +20,15 @@ public sealed class RevenantSystem : EntitySystem
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(RevenantVisuals.Harvesting, out bool harvesting) && harvesting) if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Harvesting, out var harvesting, args.Component) && harvesting)
{ {
args.Sprite.LayerSetState(0, component.HarvestingState); args.Sprite.LayerSetState(0, component.HarvestingState);
} }
else if (args.Component.TryGetData(RevenantVisuals.Stunned, out bool stunned) && stunned) else if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Stunned, out var stunned, args.Component) && stunned)
{ {
args.Sprite.LayerSetState(0, component.StunnedState); args.Sprite.LayerSetState(0, component.StunnedState);
} }
else if (args.Component.TryGetData(RevenantVisuals.Corporeal, out bool corporeal)) else if (_appearance.TryGetData<bool>(uid, RevenantVisuals.Corporeal, out var corporeal, args.Component))
{ {
if (corporeal) if (corporeal)
args.Sprite.LayerSetState(0, component.CorporealState); args.Sprite.LayerSetState(0, component.CorporealState);

View File

@@ -8,7 +8,7 @@ namespace Content.Client.Singularity.Systems;
public sealed class EmitterSystem : SharedEmitterSystem public sealed class EmitterSystem : SharedEmitterSystem
{ {
[Dependency] private readonly AppearanceSystem _appearance = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
/// <inheritdoc/> /// <inheritdoc/>
public override void Initialize() public override void Initialize()
@@ -23,13 +23,13 @@ public sealed class EmitterSystem : SharedEmitterSystem
if (args.Sprite.LayerMapTryGet(StorageVisualLayers.Lock, out var lockLayer)) if (args.Sprite.LayerMapTryGet(StorageVisualLayers.Lock, out var lockLayer))
{ {
if (!_appearance.TryGetData(uid, StorageVisuals.Locked, out bool locked, args.Component)) if (!_appearance.TryGetData<bool>(uid, StorageVisuals.Locked, out var locked, args.Component))
locked = false; locked = false;
args.Sprite.LayerSetVisible(lockLayer, locked); args.Sprite.LayerSetVisible(lockLayer, locked);
} }
if (!_appearance.TryGetData(uid, EmitterVisuals.VisualState, out EmitterVisualState state, args.Component)) if (!_appearance.TryGetData<EmitterVisualState>(uid, EmitterVisuals.VisualState, out var state, args.Component))
state = EmitterVisualState.Off; state = EmitterVisualState.Off;
if (!args.Sprite.LayerMapTryGet(EmitterVisualLayers.Lights, out var layer)) if (!args.Sprite.LayerMapTryGet(EmitterVisualLayers.Lights, out var layer))

View File

@@ -24,7 +24,7 @@ public sealed class StickyVisualizerSystem : VisualizerSystem<StickyVisualizerCo
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (!args.Component.TryGetData(StickyVisuals.IsStuck, out bool isStuck)) if (!AppearanceSystem.TryGetData<bool>(uid, StickyVisuals.IsStuck, out var isStuck, args.Component))
return; return;
var drawDepth = isStuck ? component.StuckDrawDepth : component.DefaultDrawDepth; var drawDepth = isStuck ? component.StuckDrawDepth : component.DefaultDrawDepth;

View File

@@ -8,6 +8,8 @@ namespace Content.Client.Storage.Systems;
public sealed class ItemMapperSystem : SharedItemMapperSystem public sealed class ItemMapperSystem : SharedItemMapperSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -38,7 +40,7 @@ public sealed class ItemMapperSystem : SharedItemMapperSystem
private void InitLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance) private void InitLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance)
{ {
if (!appearance.TryGetData<ShowLayerData>(StorageMapVisuals.InitLayers, out var wrapper)) if (!_appearance.TryGetData<ShowLayerData>(appearance.Owner, StorageMapVisuals.InitLayers, out var wrapper, appearance))
return; return;
component.SpriteLayers.AddRange(wrapper.QueuedEntities); component.SpriteLayers.AddRange(wrapper.QueuedEntities);
@@ -53,7 +55,7 @@ public sealed class ItemMapperSystem : SharedItemMapperSystem
private void EnableLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance) private void EnableLayers(ItemMapperComponent component, SpriteComponent spriteComponent, AppearanceComponent appearance)
{ {
if (!appearance.TryGetData<ShowLayerData>(StorageMapVisuals.LayerChanged, out var wrapper)) if (!_appearance.TryGetData<ShowLayerData>(appearance.Owner, StorageMapVisuals.LayerChanged, out var wrapper, appearance))
return; return;
foreach (var layerName in component.SpriteLayers) foreach (var layerName in component.SpriteLayers)

View File

@@ -14,7 +14,7 @@ public sealed class StorageFillVisualizerSystem : VisualizerSystem<StorageFillVi
if (!TryComp(uid, out SpriteComponent? sprite)) if (!TryComp(uid, out SpriteComponent? sprite))
return; return;
if (!args.Component.TryGetData(StorageFillVisuals.FillLevel, out int level)) if (!AppearanceSystem.TryGetData<int>(uid, StorageFillVisuals.FillLevel, out var level, args.Component))
return; return;
var state = $"{component.FillBaseName}-{level}"; var state = $"{component.FillBaseName}-{level}";

View File

@@ -5,7 +5,7 @@ namespace Content.Client.SubFloor;
public sealed class SubFloorHideSystem : SharedSubFloorHideSystem public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
{ {
[Dependency] private readonly AppearanceSystem _appearanceSystem = default!; [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private bool _showAll; private bool _showAll;
@@ -34,8 +34,8 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
if (args.Sprite == null) if (args.Sprite == null)
return; return;
args.Component.TryGetData(SubFloorVisuals.Covered, out bool covered); _appearance.TryGetData<bool>(uid, SubFloorVisuals.Covered, out var covered, args.Component);
args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool scannerRevealed); _appearance.TryGetData<bool>(uid, SubFloorVisuals.ScannerRevealed, out var scannerRevealed, args.Component);
scannerRevealed &= !ShowAll; // no transparency for show-subfloor mode. scannerRevealed &= !ShowAll; // no transparency for show-subfloor mode.
@@ -72,7 +72,7 @@ public sealed class SubFloorHideSystem : SharedSubFloorHideSystem
{ {
foreach (var (_, appearance) in EntityManager.EntityQuery<SubFloorHideComponent, AppearanceComponent>(true)) foreach (var (_, appearance) in EntityManager.EntityQuery<SubFloorHideComponent, AppearanceComponent>(true))
{ {
_appearanceSystem.MarkDirty(appearance, true); _appearance.MarkDirty(appearance, true);
} }
} }
} }

View File

@@ -23,10 +23,10 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisualsComponent component, ref AppearanceChangeEvent args) protected override void OnAppearanceChange(EntityUid uid, ToggleableLightVisualsComponent component, ref AppearanceChangeEvent args)
{ {
if (!args.Component.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled)) if (!AppearanceSystem.TryGetData<bool>(uid, ToggleableLightVisuals.Enabled, out var enabled, args.Component))
return; return;
var modulate = args.Component.TryGetData(ToggleableLightVisuals.Color, out Color color); var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, args.Component);
// Update the item's sprite // Update the item's sprite
if (args.Sprite != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer)) if (args.Sprite != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
@@ -55,14 +55,14 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
private void OnGetEquipmentVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetEquipmentVisualsEvent args) private void OnGetEquipmentVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetEquipmentVisualsEvent args)
{ {
if (!TryComp(uid, out AppearanceComponent? appearance) if (!TryComp(uid, out AppearanceComponent? appearance)
|| !appearance.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled) || !AppearanceSystem.TryGetData<bool>(uid, ToggleableLightVisuals.Enabled, out var enabled, appearance)
|| !enabled) || !enabled)
return; return;
if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers)) if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers))
return; return;
var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, appearance);
var i = 0; var i = 0;
foreach (var layer in layers) foreach (var layer in layers)
@@ -84,14 +84,14 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
private void OnGetHeldVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetInhandVisualsEvent args) private void OnGetHeldVisuals(EntityUid uid, ToggleableLightVisualsComponent component, GetInhandVisualsEvent args)
{ {
if (!TryComp(uid, out AppearanceComponent? appearance) if (!TryComp(uid, out AppearanceComponent? appearance)
|| !appearance.TryGetData(ToggleableLightVisuals.Enabled, out bool enabled) || !AppearanceSystem.TryGetData<bool>(uid, ToggleableLightVisuals.Enabled, out var enabled, appearance)
|| !enabled) || !enabled)
return; return;
if (!component.InhandVisuals.TryGetValue(args.Location, out var layers)) if (!component.InhandVisuals.TryGetValue(args.Location, out var layers))
return; return;
var modulate = appearance.TryGetData(ToggleableLightVisuals.Color, out Color color); var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, appearance);
var i = 0; var i = 0;
var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-toggle"; var defaultKey = $"inhand-{args.Location.ToString().ToLowerInvariant()}-toggle";

View File

@@ -9,8 +9,8 @@ public sealed class ToiletVisualsSystem : VisualizerSystem<ToiletComponent>
{ {
if (args.Sprite == null) return; if (args.Sprite == null) return;
args.Component.TryGetData(ToiletVisuals.LidOpen, out bool lidOpen); AppearanceSystem.TryGetData<bool>(uid, ToiletVisuals.LidOpen, out var lidOpen, args.Component);
args.Component.TryGetData(ToiletVisuals.SeatUp, out bool seatUp); AppearanceSystem.TryGetData<bool>(uid, ToiletVisuals.SeatUp, out var seatUp, args.Component);
var state = (lidOpen, seatUp) switch var state = (lidOpen, seatUp) switch
{ {

View File

@@ -11,7 +11,7 @@ public sealed class WeldableVisualizerSystem : VisualizerSystem<WeldableComponen
if (args.Sprite == null) if (args.Sprite == null)
return; return;
args.Component.TryGetData(WeldableVisuals.IsWelded, out bool isWelded); AppearanceSystem.TryGetData<bool>(uid, WeldableVisuals.IsWelded, out var isWelded, args.Component);
if (args.Sprite.LayerMapTryGet(WeldableLayers.BaseWelded, out var layer)) if (args.Sprite.LayerMapTryGet(WeldableLayers.BaseWelded, out var layer))
{ {
args.Sprite.LayerSetVisible(layer, isWelded); args.Sprite.LayerSetVisible(layer, isWelded);

View File

@@ -11,7 +11,7 @@ public sealed class WelderVisualizerSystem : VisualizerSystem<WelderComponent>
if (args.Sprite == null) if (args.Sprite == null)
return; return;
if (args.Component.TryGetData(WelderVisuals.Lit, out bool isLit)) if (AppearanceSystem.TryGetData<bool>(uid, WelderVisuals.Lit, out var isLit, args.Component))
{ {
args.Sprite.LayerSetVisible(WelderLayers.Flame, isLit); args.Sprite.LayerSetVisible(WelderLayers.Flame, isLit);
} }

View File

@@ -15,13 +15,13 @@ namespace Content.Client.Vehicle
return; return;
// First check is for the sprite itself // First check is for the sprite itself
if (args.Component.TryGetData(VehicleVisuals.DrawDepth, out int drawDepth)) if (AppearanceSystem.TryGetData<int>(uid, VehicleVisuals.DrawDepth, out var drawDepth, args.Component))
{ {
args.Sprite.DrawDepth = drawDepth; args.Sprite.DrawDepth = drawDepth;
} }
// Set vehicle layer to animated or not (i.e. are the wheels turning or not) // 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<bool>(uid, VehicleVisuals.AutoAnimate, out var autoAnimate, args.Component))
{ {
args.Sprite.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate); args.Sprite.LayerSetAutoAnimated(VehicleVisualLayers.AutoAnimate, autoAnimate);
} }

View File

@@ -24,6 +24,7 @@ namespace Content.Server.AirlockPainter
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -40,10 +41,10 @@ namespace Content.Server.AirlockPainter
{ {
ev.Component.IsSpraying = false; ev.Component.IsSpraying = false;
if (TryComp<AppearanceComponent>(ev.Target, out var appearance) && if (TryComp<AppearanceComponent>(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); 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 // Log success
_adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(ev.User):user} painted {ToPrettyString(ev.Target):target}"); _adminLogger.Add(LogType.Action, LogImpact.Low, $"{ToPrettyString(ev.User):user} painted {ToPrettyString(ev.Target):target}");

View File

@@ -1,11 +1,13 @@
using Content.Server.Station.Systems; using Content.Server.Station.Systems;
using Content.Shared.AlertLevel; using Content.Shared.AlertLevel;
using Robust.Server.GameObjects;
namespace Content.Server.AlertLevel; namespace Content.Server.AlertLevel;
public sealed class AlertLevelDisplaySystem : EntitySystem public sealed class AlertLevelDisplaySystem : EntitySystem
{ {
[Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -17,7 +19,7 @@ public sealed class AlertLevelDisplaySystem : EntitySystem
{ {
foreach (var (_, appearance) in EntityManager.EntityQuery<AlertLevelDisplayComponent, AppearanceComponent>()) foreach (var (_, appearance) in EntityManager.EntityQuery<AlertLevelDisplayComponent, AppearanceComponent>())
{ {
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); var stationUid = _stationSystem.GetOwningStation(uid);
if (stationUid != null && TryComp(stationUid, out AlertLevelComponent? alert)) if (stationUid != null && TryComp(stationUid, out AlertLevelComponent? alert))
{ {
appearance.SetData(AlertLevelDisplay.CurrentLevel, alert.CurrentLevel); _appearance.SetData(uid, AlertLevelDisplay.CurrentLevel, alert.CurrentLevel, appearance);
} }
} }
} }

View File

@@ -14,7 +14,7 @@ namespace Content.Server.Atmos.Components
set set
{ {
Type = value; Type = value;
EntitySystem.Get<AtmosPlaqueSystem>().UpdateSign(this); EntitySystem.Get<AtmosPlaqueSystem>().UpdateSign(Owner, this);
} }
} }
} }

View File

@@ -1,5 +1,6 @@
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Shared.Atmos.Visuals; using Content.Shared.Atmos.Visuals;
using Robust.Server.GameObjects;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.Atmos.EntitySystems; namespace Content.Server.Atmos.EntitySystems;
@@ -7,6 +8,7 @@ namespace Content.Server.Atmos.EntitySystems;
public sealed class AtmosPlaqueSystem : EntitySystem public sealed class AtmosPlaqueSystem : EntitySystem
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -27,10 +29,10 @@ public sealed class AtmosPlaqueSystem : EntitySystem
// 45% LINDA // 45% LINDA
else component.Type = PlaqueType.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); var metaData = MetaData(component.Owner);
@@ -70,7 +72,7 @@ public sealed class AtmosPlaqueSystem : EntitySystem
{ {
var state = component.Type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque"; var state = component.Type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";
appearance.SetData(AtmosPlaqueVisuals.State, state); _appearance.SetData(uid, AtmosPlaqueVisuals.State, state, appearance);
} }
} }
} }

View File

@@ -35,6 +35,7 @@ namespace Content.Server.Atmos.EntitySystems
[Dependency] private readonly FixtureSystem _fixture = default!; [Dependency] private readonly FixtureSystem _fixture = default!;
[Dependency] private readonly EntityLookupSystem _lookup = default!; [Dependency] private readonly EntityLookupSystem _lookup = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public const float MinimumFireStacks = -10f; public const float MinimumFireStacks = -10f;
public const float MaximumFireStacks = 20f; public const float MaximumFireStacks = 20f;
@@ -176,8 +177,8 @@ namespace Content.Server.Atmos.EntitySystems
if (!Resolve(uid, ref flammable, ref appearance)) if (!Resolve(uid, ref flammable, ref appearance))
return; return;
appearance.SetData(FireVisuals.OnFire, flammable.OnFire); _appearance.SetData(uid, FireVisuals.OnFire, flammable.OnFire, appearance);
appearance.SetData(FireVisuals.FireStacks, flammable.FireStacks); _appearance.SetData(uid, FireVisuals.FireStacks, flammable.FireStacks, appearance);
} }
public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null) public void AdjustFireStacks(EntityUid uid, float relativeFireStacks, FlammableComponent? flammable = null)

View File

@@ -24,6 +24,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -146,7 +147,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
if (!Resolve(uid, ref pump, ref appearance, false)) if (!Resolve(uid, ref pump, ref appearance, false))
return; return;
appearance.SetData(PumpVisuals.Enabled, pump.Enabled); _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance);
} }
} }
} }

View File

@@ -6,6 +6,7 @@ using Content.Shared.Audio;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -15,6 +16,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
public sealed class GasValveSystem : EntitySystem public sealed class GasValveSystem : EntitySystem
{ {
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -58,7 +60,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
{ {
if (TryComp<AppearanceComponent>(component.Owner,out var appearance)) if (TryComp<AppearanceComponent>(component.Owner,out var appearance))
{ {
appearance.SetData(FilterVisuals.Enabled, component.Open); _appearance.SetData(uid, FilterVisuals.Enabled, component.Open, appearance);
} }
if (component.Open) if (component.Open)
{ {

View File

@@ -26,6 +26,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!; [Dependency] private readonly UserInterfaceSystem _userInterfaceSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -160,7 +161,7 @@ namespace Content.Server.Atmos.Piping.Binary.EntitySystems
if (!Resolve(uid, ref pump, ref appearance, false)) if (!Resolve(uid, ref pump, ref appearance, false))
return; return;
appearance.SetData(PumpVisuals.Enabled, pump.Enabled); _appearance.SetData(uid, PumpVisuals.Enabled, pump.Enabled, appearance);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes; using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Atmos.Components; using Content.Shared.Atmos.Components;
using Robust.Server.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Atmos.Piping.EntitySystems; namespace Content.Server.Atmos.Piping.EntitySystems;
@@ -10,6 +11,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems;
public sealed class AtmosPipeAppearanceSystem : EntitySystem public sealed class AtmosPipeAppearanceSystem : EntitySystem
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() 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);
} }
} }

View File

@@ -1,10 +1,13 @@
using Content.Server.Atmos.Piping.Components; using Content.Server.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping;
using Robust.Server.GameObjects;
namespace Content.Server.Atmos.Piping.EntitySystems namespace Content.Server.Atmos.Piping.EntitySystems
{ {
public sealed class AtmosPipeColorSystem : EntitySystem public sealed class AtmosPipeColorSystem : EntitySystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -18,7 +21,7 @@ namespace Content.Server.Atmos.Piping.EntitySystems
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PipeColorVisuals.Color, component.Color); _appearance.SetData(uid, PipeColorVisuals.Color, component.Color, appearance);
} }
private void OnShutdown(EntityUid uid, AtmosPipeColorComponent component, ComponentShutdown args) 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)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PipeColorVisuals.Color, Color.White); _appearance.SetData(uid, PipeColorVisuals.Color, Color.White, appearance);
} }
public void SetColor(EntityUid uid, AtmosPipeColorComponent component, Color color) 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)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PipeColorVisuals.Color, color); _appearance.SetData(uid, PipeColorVisuals.Color, color, appearance);
} }
} }
} }

View File

@@ -23,6 +23,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
[Dependency] private IAdminLogManager _adminLogger = default!; [Dependency] private IAdminLogManager _adminLogger = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -174,7 +175,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
if (!Resolve(uid, ref mixer, ref appearance, false)) if (!Resolve(uid, ref mixer, ref appearance, false))
return; return;
appearance.SetData(FilterVisuals.Enabled, mixer.Enabled); _appearance.SetData(uid, FilterVisuals.Enabled, mixer.Enabled, appearance);
} }
private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args) private void OnToggleStatusMessage(EntityUid uid, GasMixerComponent mixer, GasMixerToggleStatusMessage args)

View File

@@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping;
using Content.Shared.Audio; using Content.Shared.Audio;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Timing; using Robust.Shared.Timing;
namespace Content.Server.Atmos.Piping.Trinary.EntitySystems 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 IGameTiming _gameTiming = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -90,7 +92,7 @@ namespace Content.Server.Atmos.Piping.Trinary.EntitySystems
if (!Resolve(uid, ref comp, ref appearance, false)) if (!Resolve(uid, ref comp, ref appearance, false))
return; return;
appearance.SetData(FilterVisuals.Enabled, comp.Enabled); _appearance.SetData(uid, FilterVisuals.Enabled, comp.Enabled, appearance);
} }
} }
} }

View File

@@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping; using Content.Shared.Atmos.Piping;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Timing; using Robust.Shared.Timing;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems 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 AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -27,21 +29,21 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
private void OnMapInit(EntityUid uid, GasOutletInjectorComponent component, MapInitEvent args) private void OnMapInit(EntityUid uid, GasOutletInjectorComponent component, MapInitEvent args)
{ {
UpdateAppearance(component); UpdateAppearance(uid, component);
} }
private void OnActivate(EntityUid uid, GasOutletInjectorComponent component, ActivateInWorldEvent args) private void OnActivate(EntityUid uid, GasOutletInjectorComponent component, ActivateInWorldEvent args)
{ {
component.Enabled = !component.Enabled; 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)) if (!Resolve(component.Owner, ref appearance, false))
return; return;
appearance.SetData(OutletInjectorVisuals.Enabled, component.Enabled); _appearance.SetData(uid, OutletInjectorVisuals.Enabled, component.Enabled, appearance);
} }
private void OnOutletInjectorUpdated(EntityUid uid, GasOutletInjectorComponent injector, AtmosDeviceUpdateEvent args) private void OnOutletInjectorUpdated(EntityUid uid, GasOutletInjectorComponent injector, AtmosDeviceUpdateEvent args)

View File

@@ -6,6 +6,7 @@ using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos.Piping.Unary.Components; using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Construction.Components; using Content.Shared.Construction.Components;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems namespace Content.Server.Atmos.Piping.Unary.EntitySystems
@@ -14,6 +15,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
public sealed class GasPortableSystem : EntitySystem public sealed class GasPortableSystem : EntitySystem
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -46,7 +48,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) if (EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{ {
appearance.SetData(GasPortableVisuals.ConnectedState, args.Anchored); _appearance.SetData(uid, GasPortableVisuals.ConnectedState, args.Anchored, appearance);
} }
} }

View File

@@ -18,6 +18,7 @@ using Content.Shared.Atmos.Visuals;
using Content.Shared.Audio; using Content.Shared.Audio;
using Content.Shared.Examine; using Content.Shared.Examine;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Timing; using Robust.Shared.Timing;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems 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 SignalLinkerSystem _signalSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -243,20 +245,20 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!vent.Enabled) if (!vent.Enabled)
{ {
_ambientSoundSystem.SetAmbience(uid, false); _ambientSoundSystem.SetAmbience(uid, false);
appearance.SetData(VentPumpVisuals.State, VentPumpState.Off); _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Off, appearance);
} }
else if (vent.PumpDirection == VentPumpDirection.Releasing) 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) else if (vent.PumpDirection == VentPumpDirection.Siphoning)
{ {
appearance.SetData(VentPumpVisuals.State, VentPumpState.In); _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.In, appearance);
} }
else if (vent.Welded) else if (vent.Welded)
{ {
_ambientSoundSystem.SetAmbience(uid, false); _ambientSoundSystem.SetAmbience(uid, false);
appearance.SetData(VentPumpVisuals.State, VentPumpState.Welded); _appearance.SetData(uid, VentPumpVisuals.State, VentPumpState.Welded, appearance);
} }
} }

View File

@@ -28,6 +28,7 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
[Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!; [Dependency] private readonly DeviceNetworkSystem _deviceNetSystem = default!;
[Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!; [Dependency] private readonly SharedAmbientSoundSystem _ambientSoundSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -185,20 +186,20 @@ namespace Content.Server.Atmos.Piping.Unary.EntitySystems
if (!scrubber.Enabled) if (!scrubber.Enabled)
{ {
_ambientSoundSystem.SetAmbience(uid, false); _ambientSoundSystem.SetAmbience(uid, false);
appearance.SetData(ScrubberVisuals.State, ScrubberState.Off); _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Off, appearance);
} }
else if (scrubber.PumpDirection == ScrubberPumpDirection.Scrubbing) 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) else if (scrubber.PumpDirection == ScrubberPumpDirection.Siphoning)
{ {
appearance.SetData(ScrubberVisuals.State, ScrubberState.Siphon); _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Siphon, appearance);
} }
else if (scrubber.Welded) else if (scrubber.Welded)
{ {
_ambientSoundSystem.SetAmbience(uid, false); _ambientSoundSystem.SetAmbience(uid, false);
appearance.SetData(ScrubberVisuals.State, ScrubberState.Welded); _appearance.SetData(uid, ScrubberVisuals.State, ScrubberState.Welded, appearance);
} }
} }
} }

View File

@@ -4,6 +4,7 @@ using Content.Shared.Cabinet;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -14,6 +15,7 @@ namespace Content.Server.Cabinet
{ {
[Dependency] private readonly IComponentFactory _factory = default!; [Dependency] private readonly IComponentFactory _factory = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -54,8 +56,8 @@ namespace Content.Server.Cabinet
if (!Resolve(uid, ref cabinet, ref appearance, false)) if (!Resolve(uid, ref cabinet, ref appearance, false))
return; return;
appearance.SetData(ItemCabinetVisuals.IsOpen, cabinet.Opened); _appearance.SetData(uid, ItemCabinetVisuals.IsOpen, cabinet.Opened, appearance);
appearance.SetData(ItemCabinetVisuals.ContainsItem, cabinet.CabinetSlot.HasItem); _appearance.SetData(uid, ItemCabinetVisuals.ContainsItem, cabinet.CabinetSlot.HasItem, appearance);
} }
private void OnContainerModified(EntityUid uid, ItemCabinetComponent cabinet, ContainerModifiedMessage args) private void OnContainerModified(EntityUid uid, ItemCabinetComponent cabinet, ContainerModifiedMessage args)

View File

@@ -10,6 +10,7 @@ namespace Content.Server.Chat.TypingIndicator;
public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem
{ {
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!; [Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -58,6 +59,6 @@ public sealed class TypingIndicatorSystem : SharedTypingIndicatorSystem
if (!Resolve(uid, ref appearance, false)) if (!Resolve(uid, ref appearance, false))
return; return;
appearance.SetData(TypingIndicatorVisuals.IsTyping, isEnabled); _appearance.SetData(uid, TypingIndicatorVisuals.IsTyping, isEnabled, appearance);
} }
} }

View File

@@ -1,5 +1,6 @@
using Content.Shared.Construction; using Content.Shared.Construction;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Reflection; using Robust.Shared.Reflection;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -9,6 +10,8 @@ namespace Content.Server.Construction.Completions
[DataDefinition] [DataDefinition]
public sealed class VisualizerDataInt : IGraphAction, ISerializationHooks public sealed class VisualizerDataInt : IGraphAction, ISerializationHooks
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[DataField("key")] public string Key { get; private set; } = string.Empty; [DataField("key")] public string Key { get; private set; } = string.Empty;
[DataField("data")] public int Data { get; private set; } = 0; [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 (entityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
{ {
if(IoCManager.Resolve<IReflectionManager>().TryParseEnumReference(Key, out var @enum)) if (IoCManager.Resolve<IReflectionManager>().TryParseEnumReference(Key, out var @enum))
{ {
appearance.SetData(@enum, Data); _appearance.SetData(uid, @enum, Data, appearance);
} }
} }
} }

View File

@@ -18,6 +18,7 @@ using Robust.Shared.Utility;
using Content.Shared.Tools.Components; using Content.Shared.Tools.Components;
using Content.Server.Station.Systems; using Content.Server.Station.Systems;
using Content.Shared.IdentityManagement; using Content.Shared.IdentityManagement;
using Robust.Server.GameObjects;
namespace Content.Server.Disease namespace Content.Server.Disease
{ {
@@ -31,8 +32,8 @@ namespace Content.Server.Disease
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly PaperSystem _paperSystem = default!; [Dependency] private readonly PaperSystem _paperSystem = default!;
[Dependency] private readonly StationSystem _stationSystem = default!; [Dependency] private readonly StationSystem _stationSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -298,8 +299,8 @@ namespace Content.Server.Disease
if (!TryComp<AppearanceComponent>(uid, out var appearance)) if (!TryComp<AppearanceComponent>(uid, out var appearance))
return; return;
appearance.SetData(DiseaseMachineVisuals.IsOn, isOn); _appearance.SetData(uid, DiseaseMachineVisuals.IsOn, isOn, appearance);
appearance.SetData(DiseaseMachineVisuals.IsRunning, isRunning); _appearance.SetData(uid, DiseaseMachineVisuals.IsRunning, isRunning, appearance);
} }
/// <summary> /// <summary>
/// Makes sure the machine is visually off/on. /// Makes sure the machine is visually off/on.

View File

@@ -25,7 +25,7 @@ namespace Content.Server.Doors.Systems
[Dependency] private readonly SharedDoorSystem _doorSystem = default!; [Dependency] private readonly SharedDoorSystem _doorSystem = default!;
[Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!; [Dependency] private readonly AtmosAlarmableSystem _atmosAlarmable = default!;
[Dependency] private readonly AtmosphereSystem _atmosSystem = 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 static float _visualUpdateInterval = 0.5f;
private float _accumulatedFrameTime; private float _accumulatedFrameTime;

View File

@@ -20,6 +20,7 @@ using Content.Shared.Mobs.Systems;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Tag; using Content.Shared.Tag;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Robust.Server.GameObjects;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -34,6 +35,7 @@ namespace Content.Server.Drone
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly InnateToolSystem _innateToolSystem = default!; [Dependency] private readonly InnateToolSystem _innateToolSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -120,7 +122,7 @@ namespace Content.Server.Drone
{ {
if (TryComp<AppearanceComponent>(uid, out var appearance)) if (TryComp<AppearanceComponent>(uid, out var appearance))
{ {
appearance.SetData(DroneVisuals.Status, status); _appearance.SetData(uid, DroneVisuals.Status, status, appearance);
} }
} }

View File

@@ -4,6 +4,7 @@ using Content.Shared.Explosion;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Robust.Server.GameObjects;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Random; using Robust.Shared.Random;
@@ -15,6 +16,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
[Dependency] private readonly SharedContainerSystem _container = default!; [Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly TriggerSystem _trigger = default!; [Dependency] private readonly TriggerSystem _trigger = default!;
[Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -35,7 +37,7 @@ public sealed class ClusterGrenadeSystem : EntitySystem
if (component.FillPrototype != null) if (component.FillPrototype != null)
{ {
component.UnspawnedCount = Math.Max(0, component.MaxGrenades - component.GrenadesContainer.ContainedEntities.Count); 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; return;
component.GrenadesContainer.Insert(args.Used); component.GrenadesContainer.Insert(args.Used);
UpdateAppearance(component); UpdateAppearance(uid, component);
args.Handled = true; args.Handled = true;
} }
@@ -122,10 +124,10 @@ public sealed class ClusterGrenadeSystem : EntitySystem
return false; return false;
} }
private void UpdateAppearance(ClusterGrenadeComponent component) private void UpdateAppearance(EntityUid uid, ClusterGrenadeComponent component)
{ {
if (!TryComp<AppearanceComponent>(component.Owner, out var appearance)) return; if (!TryComp<AppearanceComponent>(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);
} }
} }

View File

@@ -1,6 +1,7 @@
using Content.Server.Explosion.Components; using Content.Server.Explosion.Components;
using Content.Shared.Physics; using Content.Shared.Physics;
using Content.Shared.Trigger; using Content.Shared.Trigger;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics; using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
@@ -10,6 +11,8 @@ namespace Content.Server.Explosion.EntitySystems;
public sealed partial class TriggerSystem public sealed partial class TriggerSystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
/// <summary> /// <summary>
/// Anything that has stuff touching it (to check speed) or is on cooldown. /// Anything that has stuff touching it (to check speed) or is on cooldown.
/// </summary> /// </summary>
@@ -86,9 +89,9 @@ public sealed partial class TriggerSystem
private void SetProximityAppearance(EntityUid uid, TriggerOnProximityComponent component) 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; 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); Trigger(component.Owner);

View File

@@ -178,7 +178,7 @@ namespace Content.Server.Explosion.EntitySystems
active.TimeUntilBeep = initialBeepDelay == null ? active.BeepInterval : initialBeepDelay.Value; active.TimeUntilBeep = initialBeepDelay == null ? active.BeepInterval : initialBeepDelay.Value;
if (TryComp<AppearanceComponent>(uid, out var appearance)) if (TryComp<AppearanceComponent>(uid, out var appearance))
appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Primed); _appearance.SetData(uid, TriggerVisuals.VisualState, TriggerVisualState.Primed, appearance);
} }
public override void Update(float frameTime) 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. // In case this is a re-usable grenade, un-prime it.
if (TryComp<AppearanceComponent>(uid, out var appearance)) if (TryComp<AppearanceComponent>(uid, out var appearance))
appearance.SetData(TriggerVisuals.VisualState, TriggerVisualState.Unprimed); _appearance.SetData(uid, TriggerVisuals.VisualState, TriggerVisualState.Unprimed, appearance);
} }
} }
} }

View File

@@ -8,6 +8,7 @@ using Content.Shared.FixedPoint;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Interaction.Events; using Content.Shared.Interaction.Events;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -17,6 +18,7 @@ public sealed class FireExtinguisherSystem : EntitySystem
{ {
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -123,7 +125,7 @@ public sealed class FireExtinguisherSystem : EntitySystem
if (comp.HasSafety) if (comp.HasSafety)
{ {
appearance.SetData(FireExtinguisherVisuals.Safety, comp.Safety); _appearance.SetData(uid, FireExtinguisherVisuals.Safety, comp.Safety, appearance);
} }
} }

View File

@@ -9,6 +9,7 @@ using Content.Shared.Cooldown;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Vapor; using Content.Shared.Vapor;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -25,6 +26,7 @@ public sealed class SpraySystem : EntitySystem
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!;
[Dependency] private readonly VaporSystem _vaporSystem = default!; [Dependency] private readonly VaporSystem _vaporSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -108,8 +110,8 @@ public sealed class SpraySystem : EntitySystem
if (TryComp(vapor, out AppearanceComponent? appearance)) if (TryComp(vapor, out AppearanceComponent? appearance))
{ {
appearance.SetData(VaporVisuals.Color, solution.GetColor(_proto).WithAlpha(1f)); _appearance.SetData(uid, VaporVisuals.Color, solution.GetColor(_proto).WithAlpha(1f), appearance);
appearance.SetData(VaporVisuals.State, true); _appearance.SetData(uid, VaporVisuals.State, true, appearance);
} }
// Add the solution to the vapor and actually send the thing // Add the solution to the vapor and actually send the thing

View File

@@ -18,6 +18,7 @@ using Content.Shared.Interaction.Events;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
using Content.Shared.Popups; using Content.Shared.Popups;
using Robust.Server.GameObjects;
namespace Content.Server.Kitchen.EntitySystems namespace Content.Server.Kitchen.EntitySystems
{ {
@@ -28,6 +29,7 @@ namespace Content.Server.Kitchen.EntitySystems
[Dependency] private readonly IAdminLogManager _logger = default!; [Dependency] private readonly IAdminLogManager _logger = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -171,7 +173,7 @@ namespace Content.Server.Kitchen.EntitySystems
if (!Resolve(uid, ref component, ref appearance, false)) if (!Resolve(uid, ref component, ref appearance, false))
return; 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, private bool Spikeable(EntityUid uid, EntityUid userUid, EntityUid victimUid,

View File

@@ -1,4 +1,5 @@
using Content.Shared.Kudzu; using Content.Shared.Kudzu;
using Robust.Server.GameObjects;
using Robust.Shared.Random; using Robust.Shared.Random;
namespace Content.Server.Kudzu; namespace Content.Server.Kudzu;
@@ -6,6 +7,7 @@ namespace Content.Server.Kudzu;
public sealed class GrowingKudzuSystem : EntitySystem public sealed class GrowingKudzuSystem : EntitySystem
{ {
[Dependency] private readonly IRobustRandom _robustRandom = default!; [Dependency] private readonly IRobustRandom _robustRandom = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private float _accumulatedFrameTime = 0.0f; private float _accumulatedFrameTime = 0.0f;
@@ -21,8 +23,8 @@ public sealed class GrowingKudzuSystem : EntitySystem
return; return;
} }
appearance.SetData(KudzuVisuals.Variant, _robustRandom.Next(1, 3)); _appearance.SetData(uid, KudzuVisuals.Variant, _robustRandom.Next(1, 3), appearance);
appearance.SetData(KudzuVisuals.GrowthLevel, 1); _appearance.SetData(uid, KudzuVisuals.GrowthLevel, 1, appearance);
} }
public override void Update(float frameTime) public override void Update(float frameTime)
@@ -46,7 +48,7 @@ public sealed class GrowingKudzuSystem : EntitySystem
EntityManager.RemoveComponent<GrowingKudzuComponent>((kudzu).Owner); EntityManager.RemoveComponent<GrowingKudzuComponent>((kudzu).Owner);
} }
appearance.SetData(KudzuVisuals.GrowthLevel, kudzu.GrowthLevel); _appearance.SetData(kudzu.Owner, KudzuVisuals.GrowthLevel, kudzu.GrowthLevel, appearance);
} }
} }
} }

View File

@@ -4,6 +4,7 @@ using Content.Shared.Containers.ItemSlots;
using Content.Shared.Examine; using Content.Shared.Examine;
using Content.Shared.Labels; using Content.Shared.Labels;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -16,6 +17,7 @@ namespace Content.Server.Labels
public sealed class LabelSystem : EntitySystem public sealed class LabelSystem : EntitySystem
{ {
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!; [Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public const string ContainerName = "paper_label"; public const string ContainerName = "paper_label";
@@ -71,7 +73,7 @@ namespace Content.Server.Labels
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PaperLabelVisuals.HasLabel, false); _appearance.SetData(uid, PaperLabelVisuals.HasLabel, false, appearance);
} }
private void OnComponentRemove(EntityUid uid, PaperLabelComponent component, ComponentRemove args) private void OnComponentRemove(EntityUid uid, PaperLabelComponent component, ComponentRemove args)
@@ -128,7 +130,7 @@ namespace Content.Server.Labels
if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance)) if (!EntityManager.TryGetComponent(uid, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem); _appearance.SetData(uid, PaperLabelVisuals.HasLabel, label.LabelSlot.HasItem, appearance);
} }
} }
} }

View File

@@ -19,6 +19,7 @@ namespace Content.Server.Light.EntitySystems
{ {
[Dependency] private readonly AmbientSoundSystem _ambient = default!; [Dependency] private readonly AmbientSoundSystem _ambient = default!;
[Dependency] private readonly StationSystem _station = default!; [Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -110,7 +111,7 @@ namespace Content.Server.Light.EntitySystems
continue; continue;
pointLight.Color = details.EmergencyLightColor; pointLight.Color = details.EmergencyLightColor;
appearance.SetData(EmergencyLightVisuals.Color, details.EmergencyLightColor); _appearance.SetData(appearance.Owner, EmergencyLightVisuals.Color, details.EmergencyLightColor, appearance);
if (details.ForceEnableEmergencyLights && !light.ForciblyEnabled) if (details.ForceEnableEmergencyLights && !light.ForciblyEnabled)
{ {
@@ -198,7 +199,7 @@ namespace Content.Server.Light.EntitySystems
} }
if (TryComp(component.Owner, out AppearanceComponent? appearance)) 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); _ambient.SetAmbience(component.Owner, false);
} }
@@ -212,7 +213,7 @@ namespace Content.Server.Light.EntitySystems
if (TryComp(component.Owner, out AppearanceComponent? appearance)) 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); _ambient.SetAmbience(component.Owner, true);

View File

@@ -21,6 +21,7 @@ namespace Content.Server.Light.EntitySystems
[Dependency] private readonly ClothingSystem _clothing = default!; [Dependency] private readonly ClothingSystem _clothing = default!;
[Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -107,20 +108,20 @@ namespace Content.Server.Light.EntitySystems
{ {
if (!Resolve(component.Owner, ref appearance, false)) return; 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) switch (component.CurrentState)
{ {
case ExpendableLightState.Lit: case ExpendableLightState.Lit:
appearance.SetData(ExpendableLightVisuals.Behavior, component.TurnOnBehaviourID); _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, component.TurnOnBehaviourID, appearance);
break; break;
case ExpendableLightState.Fading: case ExpendableLightState.Fading:
appearance.SetData(ExpendableLightVisuals.Behavior, component.FadeOutBehaviourID); _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, component.FadeOutBehaviourID, appearance);
break; break;
case ExpendableLightState.Dead: case ExpendableLightState.Dead:
appearance.SetData(ExpendableLightVisuals.Behavior, string.Empty); _appearance.SetData(appearance.Owner, ExpendableLightVisuals.Behavior, string.Empty, appearance);
var isHotEvent = new IsHotEvent() {IsHot = true}; var isHotEvent = new IsHotEvent() {IsHot = true};
RaiseLocalEvent(component.Owner, isHotEvent); RaiseLocalEvent(component.Owner, isHotEvent);
break; break;

View File

@@ -2,6 +2,7 @@ using Content.Server.Light.Components;
using Content.Shared.Destructible; using Content.Shared.Destructible;
using Content.Shared.Light; using Content.Shared.Light;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Robust.Server.GameObjects;
using Robust.Shared.Audio; using Robust.Shared.Audio;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -9,6 +10,8 @@ namespace Content.Server.Light.EntitySystems
{ {
public sealed class LightBulbSystem : EntitySystem public sealed class LightBulbSystem : EntitySystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -75,8 +78,8 @@ namespace Content.Server.Light.EntitySystems
return; return;
// try to update appearance and color // try to update appearance and color
appearance.SetData(LightBulbVisuals.State, bulb.State); _appearance.SetData(uid, LightBulbVisuals.State, bulb.State, appearance);
appearance.SetData(LightBulbVisuals.Color, bulb.Color); _appearance.SetData(uid, LightBulbVisuals.Color, bulb.Color, appearance);
} }
} }
} }

View File

@@ -21,7 +21,7 @@ namespace Content.Server.Light.EntitySystems
&& EntityManager.TryGetComponent<MatchstickComponent?>(args.Used, out var matchstick) && EntityManager.TryGetComponent<MatchstickComponent?>(args.Used, out var matchstick)
&& matchstick.CurrentState == SmokableState.Unlit) && matchstick.CurrentState == SmokableState.Unlit)
{ {
_stickSystem.Ignite(matchstick, args.User); _stickSystem.Ignite(uid, matchstick, args.User);
args.Handled = true; args.Handled = true;
} }
} }

View File

@@ -13,10 +13,12 @@ namespace Content.Server.Light.EntitySystems
{ {
public sealed class MatchstickSystem : EntitySystem public sealed class MatchstickSystem : EntitySystem
{ {
private HashSet<MatchstickComponent> _litMatches = new();
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!; [Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly TransformSystem _transformSystem = default!; [Dependency] private readonly TransformSystem _transformSystem = default!;
[Dependency] private readonly SharedItemSystem _item = default!; [Dependency] private readonly SharedItemSystem _item = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private HashSet<MatchstickComponent> _litMatches = new();
public override void Initialize() public override void Initialize()
{ {
@@ -61,7 +63,7 @@ namespace Content.Server.Light.EntitySystems
if (!isHotEvent.IsHot) if (!isHotEvent.IsHot)
return; return;
Ignite(component, args.User); Ignite(uid, component, args.User);
args.Handled = true; args.Handled = true;
} }
@@ -70,23 +72,23 @@ namespace Content.Server.Light.EntitySystems
args.IsHot = component.CurrentState == SmokableState.Lit; args.IsHot = component.CurrentState == SmokableState.Lit;
} }
public void Ignite(MatchstickComponent component, EntityUid user) public void Ignite(EntityUid uid, MatchstickComponent component, EntityUid user)
{ {
// Play Sound // Play Sound
SoundSystem.Play(component.IgniteSound.GetSound(), Filter.Pvs(component.Owner), SoundSystem.Play(component.IgniteSound.GetSound(), Filter.Pvs(component.Owner),
component.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f)); component.Owner, AudioHelpers.WithVariation(0.125f).WithVolume(-0.125f));
// Change state // Change state
SetState(component, SmokableState.Lit); SetState(uid, component, SmokableState.Lit);
_litMatches.Add(component); _litMatches.Add(component);
component.Owner.SpawnTimer(component.Duration * 1000, delegate component.Owner.SpawnTimer(component.Duration * 1000, delegate
{ {
SetState(component, SmokableState.Burnt); SetState(uid, component, SmokableState.Burnt);
_litMatches.Remove(component); _litMatches.Remove(component);
}); });
} }
private void SetState(MatchstickComponent component, SmokableState value) private void SetState(EntityUid uid, MatchstickComponent component, SmokableState value)
{ {
component.CurrentState = value; component.CurrentState = value;
@@ -110,7 +112,7 @@ namespace Content.Server.Light.EntitySystems
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance)) if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
{ {
appearance.SetData(SmokingVisuals.Smoking, component.CurrentState); _appearance.SetData(uid, SmokingVisuals.Smoking, component.CurrentState, appearance);
} }
} }
} }

View File

@@ -39,6 +39,7 @@ namespace Content.Server.Light.EntitySystems
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
[Dependency] private readonly SharedContainerSystem _containerSystem = default!; [Dependency] private readonly SharedContainerSystem _containerSystem = default!;
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2); private static readonly TimeSpan ThunkDelay = TimeSpan.FromSeconds(2);
public const string LightBulbContainer = "light_bulb"; public const string LightBulbContainer = "light_bulb";
@@ -270,7 +271,7 @@ namespace Content.Server.Light.EntitySystems
{ {
SetLight(uid, false, light: light); SetLight(uid, false, light: light);
powerReceiver.Load = 0; powerReceiver.Load = 0;
appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Empty); _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Empty, appearance);
return; return;
} }
@@ -280,7 +281,7 @@ namespace Content.Server.Light.EntitySystems
if (powerReceiver.Powered && light.On) if (powerReceiver.Powered && light.On)
{ {
SetLight(uid, true, lightBulb.Color, light, lightBulb.LightRadius, lightBulb.LightEnergy, lightBulb.LightSoftness); 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; var time = _gameTiming.CurTime;
if (time > light.LastThunk + ThunkDelay) if (time > light.LastThunk + ThunkDelay)
{ {
@@ -291,16 +292,16 @@ namespace Content.Server.Light.EntitySystems
else else
{ {
SetLight(uid, false, light: light); SetLight(uid, false, light: light);
appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Off); _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Off, appearance);
} }
break; break;
case LightBulbState.Broken: case LightBulbState.Broken:
SetLight(uid, false, light: light); SetLight(uid, false, light: light);
appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Broken); _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Broken, appearance);
break; break;
case LightBulbState.Burned: case LightBulbState.Burned:
SetLight(uid, false, light: light); SetLight(uid, false, light: light);
appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.Burned); _appearance.SetData(uid, PoweredLightVisuals.BulbState, PoweredLightState.Burned, appearance);
break; break;
} }
@@ -335,10 +336,10 @@ namespace Content.Server.Light.EntitySystems
light.LastGhostBlink = time; light.LastGhostBlink = time;
ToggleBlinkingLight(light, true); ToggleBlinkingLight(uid, light, true);
light.Owner.SpawnTimer(light.GhostBlinkingTime, () => light.Owner.SpawnTimer(light.GhostBlinkingTime, () =>
{ {
ToggleBlinkingLight(light, false); ToggleBlinkingLight(uid, light, false);
}); });
args.Handled = true; args.Handled = true;
@@ -349,7 +350,7 @@ namespace Content.Server.Light.EntitySystems
UpdateLight(uid, component); UpdateLight(uid, component);
} }
public void ToggleBlinkingLight(PoweredLightComponent light, bool isNowBlinking) public void ToggleBlinkingLight(EntityUid uid, PoweredLightComponent light, bool isNowBlinking)
{ {
if (light.IsBlinking == isNowBlinking) if (light.IsBlinking == isNowBlinking)
return; return;
@@ -358,7 +359,8 @@ namespace Content.Server.Light.EntitySystems
if (!EntityManager.TryGetComponent(light.Owner, out AppearanceComponent? appearance)) if (!EntityManager.TryGetComponent(light.Owner, out AppearanceComponent? appearance))
return; return;
appearance.SetData(PoweredLightVisuals.Blinking, isNowBlinking);
_appearance.SetData(uid, PoweredLightVisuals.Blinking, isNowBlinking, appearance);
} }
private void OnSignalReceived(EntityUid uid, PoweredLightComponent component, SignalReceivedEvent args) private void OnSignalReceived(EntityUid uid, PoweredLightComponent component, SignalReceivedEvent args)

View File

@@ -14,6 +14,7 @@ namespace Content.Server.Light.EntitySystems
public sealed class UnpoweredFlashlightSystem : EntitySystem public sealed class UnpoweredFlashlightSystem : EntitySystem
{ {
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!; [Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -30,7 +31,7 @@ namespace Content.Server.Light.EntitySystems
if (args.Handled) if (args.Handled)
return; return;
ToggleLight(component); ToggleLight(uid, component);
args.Handled = true; args.Handled = true;
} }
@@ -48,7 +49,7 @@ namespace Content.Server.Light.EntitySystems
ActivationVerb verb = new(); ActivationVerb verb = new();
verb.Text = Loc.GetString("toggle-flashlight-verb-get-data-text"); verb.Text = Loc.GetString("toggle-flashlight-verb-get-data-text");
verb.IconTexture = "/Textures/Interface/VerbIcons/light.svg.192dpi.png"; 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. verb.Priority = -1; // For things like PDA's, Open-UI and other verbs that should be higher priority.
args.Verbs.Add(verb); args.Verbs.Add(verb);
@@ -58,7 +59,7 @@ namespace Content.Server.Light.EntitySystems
{ {
_actionsSystem.AddAction(uid, component.ToggleAction, null); _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)) if (!EntityManager.TryGetComponent(flashlight.Owner, out PointLightComponent? light))
return; return;
@@ -67,7 +68,7 @@ namespace Content.Server.Light.EntitySystems
light.Enabled = flashlight.LightOn; light.Enabled = flashlight.LightOn;
if (EntityManager.TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance)) 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); SoundSystem.Play(flashlight.ToggleSound.GetSound(), Filter.Pvs(light.Owner), flashlight.Owner);

View File

@@ -2,12 +2,14 @@ using Content.Server.MachineLinking.Components;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.MachineLinking; using Content.Shared.MachineLinking;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Robust.Server.GameObjects;
namespace Content.Server.MachineLinking.System namespace Content.Server.MachineLinking.System
{ {
public sealed class TwoWayLeverSystem : EntitySystem public sealed class TwoWayLeverSystem : EntitySystem
{ {
[Dependency] private readonly SignalLinkerSystem _signalSystem = default!; [Dependency] private readonly SignalLinkerSystem _signalSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
const string _leftToggleImage = "rotate_ccw.svg.192dpi.png"; const string _leftToggleImage = "rotate_ccw.svg.192dpi.png";
const string _rightToggleImage = "rotate_cw.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) if (component.State == TwoWayLeverState.Middle)
component.NextSignalLeft = !component.NextSignalLeft; component.NextSignalLeft = !component.NextSignalLeft;
if (TryComp(uid, out AppearanceComponent? appearanceComponent)) if (TryComp(uid, out AppearanceComponent? appearance))
appearanceComponent.SetData(TwoWayLeverVisuals.State, component.State); _appearance.SetData(uid, TwoWayLeverVisuals.State, component.State, appearance);
var port = component.State switch var port = component.State switch
{ {

View File

@@ -15,7 +15,7 @@ using Content.Server.Construction;
using Content.Shared.Mobs.Components; using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
using Robust.Server.Containers; using Robust.Server.Containers;
using Robust.Server.GameObjects;
using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent; // Hmm... using static Content.Shared.MedicalScanner.SharedMedicalScannerComponent; // Hmm...
namespace Content.Server.Medical namespace Content.Server.Medical
@@ -28,6 +28,7 @@ namespace Content.Server.Medical
[Dependency] private readonly CloningConsoleSystem _cloningConsoleSystem = default!; [Dependency] private readonly CloningConsoleSystem _cloningConsoleSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly ContainerSystem _containerSystem = default!; [Dependency] private readonly ContainerSystem _containerSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private const float UpdateRate = 1f; private const float UpdateRate = 1f;
private float _updateDif; private float _updateDif;
@@ -181,7 +182,7 @@ namespace Content.Server.Medical
{ {
if (TryComp<AppearanceComponent>(scannerComponent.Owner, out var appearance)) if (TryComp<AppearanceComponent>(scannerComponent.Owner, out var appearance))
{ {
appearance.SetData(MedicalScannerVisuals.Status, GetStatus(scannerComponent)); _appearance.SetData(uid, MedicalScannerVisuals.Status, GetStatus(scannerComponent), appearance);
} }
} }

View File

@@ -41,13 +41,18 @@ public sealed class CrematoriumSystem : EntitySystem
if (!TryComp<AppearanceComponent>(uid, out var appearance)) if (!TryComp<AppearanceComponent>(uid, out var appearance))
return; return;
if (appearance.TryGetData(CrematoriumVisuals.Burning, out bool isBurning) && isBurning) if (_appearance.TryGetData<bool>(uid, CrematoriumVisuals.Burning, out var isBurning, appearance) && isBurning)
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-is-burning", ("owner", uid))); 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<bool>(uid, StorageVisuals.HasContents, out var hasContents, appearance) && hasContents)
{
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents")); args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-has-contents"));
}
else else
{
args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty")); args.PushMarkup(Loc.GetString("crematorium-entity-storage-component-on-examine-details-empty"));
} }
}
private void OnAttemptOpen(EntityUid uid, ActiveCrematoriumComponent component, StorageOpenAttemptEvent args) private void OnAttemptOpen(EntityUid uid, ActiveCrematoriumComponent component, StorageOpenAttemptEvent args)
{ {

View File

@@ -24,13 +24,10 @@ public sealed class MorgueSystem : EntitySystem
/// </summary> /// </summary>
private void OnExamine(EntityUid uid, MorgueComponent component, ExaminedEvent args) private void OnExamine(EntityUid uid, MorgueComponent component, ExaminedEvent args)
{ {
if (!TryComp<AppearanceComponent>(uid, out var appearance))
return;
if (!args.IsInDetailsRange) if (!args.IsInDetailsRange)
return; return;
appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents); _appearance.TryGetData<MorgueContents>(uid, MorgueVisuals.Contents, out var contents);
var text = contents switch var text = contents switch
{ {
@@ -92,7 +89,7 @@ public sealed class MorgueSystem : EntitySystem
comp.AccumulatedFrameTime -= comp.BeepTime; comp.AccumulatedFrameTime -= comp.BeepTime;
if (comp.DoSoulBeep && appearance.TryGetData(MorgueVisuals.Contents, out MorgueContents contents) && contents == MorgueContents.HasSoul) if (comp.DoSoulBeep && _appearance.TryGetData<MorgueContents>(appearance.Owner, MorgueVisuals.Contents, out var contents, appearance) && contents == MorgueContents.HasSoul)
{ {
_audio.PlayPvs(comp.OccupantHasSoulAlarmSound, comp.Owner); _audio.PlayPvs(comp.OccupantHasSoulAlarmSound, comp.Owner);
} }

View File

@@ -6,6 +6,7 @@ using Content.Shared.Inventory;
using Content.Shared.Mousetrap; using Content.Shared.Mousetrap;
using Content.Shared.StepTrigger; using Content.Shared.StepTrigger;
using Content.Shared.StepTrigger.Systems; using Content.Shared.StepTrigger.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Player; using Robust.Shared.Player;
@@ -14,6 +15,7 @@ namespace Content.Server.Mousetrap;
public sealed class MousetrapSystem : EntitySystem public sealed class MousetrapSystem : EntitySystem
{ {
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -66,7 +68,7 @@ public sealed class MousetrapSystem : EntitySystem
return; return;
} }
appearance.SetData(MousetrapVisuals.Visual, _appearance.SetData(uid, MousetrapVisuals.Visual,
mousetrap.IsActive ? MousetrapVisuals.Armed : MousetrapVisuals.Unarmed); mousetrap.IsActive ? MousetrapVisuals.Armed : MousetrapVisuals.Unarmed, appearance);
} }
} }

View File

@@ -28,6 +28,7 @@ namespace Content.Server.Nutrition.EntitySystems
[Dependency] private readonly InventorySystem _inventorySystem = default!; [Dependency] private readonly InventorySystem _inventorySystem = default!;
[Dependency] private readonly ClothingSystem _clothing = default!; [Dependency] private readonly ClothingSystem _clothing = default!;
[Dependency] private readonly SharedItemSystem _items = default!; [Dependency] private readonly SharedItemSystem _items = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private const float UpdateTimer = 3f; private const float UpdateTimer = 3f;
@@ -54,7 +55,7 @@ namespace Content.Server.Nutrition.EntitySystems
return; return;
smokable.State = state; smokable.State = state;
appearance.SetData(SmokingVisuals.Smoking, state); _appearance.SetData(uid, SmokingVisuals.Smoking, state, appearance);
var newState = state switch var newState = state switch
{ {

View File

@@ -16,6 +16,7 @@ namespace Content.Server.PAI
{ {
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly InstrumentSystem _instrumentSystem = default!; [Dependency] private readonly InstrumentSystem _instrumentSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -126,7 +127,7 @@ namespace Content.Server.PAI
{ {
if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearance)) if (EntityManager.TryGetComponent<AppearanceComponent>(uid, out var appearance))
{ {
appearance.SetData(PAIVisuals.Status, status); _appearance.SetData(uid, PAIVisuals.Status, status, appearance);
} }
} }

View File

@@ -141,7 +141,7 @@ namespace Content.Server.PDA
case PDAToggleFlashlightMessage _: case PDAToggleFlashlightMessage _:
{ {
if (EntityManager.TryGetComponent(pda.Owner, out UnpoweredFlashlightComponent? flashlight)) if (EntityManager.TryGetComponent(pda.Owner, out UnpoweredFlashlightComponent? flashlight))
_unpoweredFlashlight.ToggleLight(flashlight); _unpoweredFlashlight.ToggleLight(flashlight.Owner, flashlight);
break; break;
} }

View File

@@ -20,6 +20,7 @@ namespace Content.Server.Paper
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
[Dependency] private readonly IAdminLogManager _adminLogger = default!; [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -40,10 +41,10 @@ namespace Content.Server.Paper
if (TryComp<AppearanceComponent>(uid, out var appearance)) if (TryComp<AppearanceComponent>(uid, out var appearance))
{ {
if (paperComp.Content != "") if (paperComp.Content != "")
appearance.SetData(PaperVisuals.Status, PaperStatus.Written); _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
if (paperComp.StampState != null) 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'; paperComp.Content += text + '\n';
if (TryComp<AppearanceComponent>(uid, out var appearance)) if (TryComp<AppearanceComponent>(uid, out var appearance))
appearance.SetData(PaperVisuals.Status, PaperStatus.Written); _appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
if (TryComp<MetaDataComponent>(uid, out var meta)) if (TryComp<MetaDataComponent>(uid, out var meta))
meta.EntityDescription = ""; meta.EntityDescription = "";
@@ -137,7 +138,7 @@ namespace Content.Server.Paper
if (paperComp.StampState == null && TryComp<AppearanceComponent>(uid, out var appearance)) if (paperComp.StampState == null && TryComp<AppearanceComponent>(uid, out var appearance))
{ {
paperComp.StampState = stampState; paperComp.StampState = stampState;
appearance.SetData(PaperVisuals.Stamp, paperComp.StampState); _appearance.SetData(uid, PaperVisuals.Stamp, paperComp.StampState, appearance);
} }
} }
return true; return true;
@@ -158,7 +159,7 @@ namespace Content.Server.Paper
? PaperStatus.Blank ? PaperStatus.Blank
: PaperStatus.Written; : PaperStatus.Written;
appearance.SetData(PaperVisuals.Status, status); _appearance.SetData(uid, PaperVisuals.Status, status, appearance);
} }
public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null) public void UpdateUserInterface(EntityUid uid, PaperComponent? paperComp = null)

View File

@@ -15,6 +15,7 @@ namespace Content.Server.Pointing.EntitySystems
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ExplosionSystem _explosion = default!; [Dependency] private readonly ExplosionSystem _explosion = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private EntityUid? RandomNearbyPlayer(EntityUid uid, RoguePointingArrowComponent? component = null, TransformComponent? transform = null) 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) if (!Resolve(uid, ref component, ref transform, ref appearance) || component.Chasing == null)
return; 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) public void SetTarget(EntityUid arrow, EntityUid target, RoguePointingArrowComponent? component = null)

View File

@@ -27,6 +27,7 @@ namespace Content.Server.Power.EntitySystems
[Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly ToolSystem _toolSystem = default!; [Dependency] private readonly ToolSystem _toolSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
private const float ScrewTime = 2f; private const float ScrewTime = 2f;
@@ -114,7 +115,7 @@ namespace Content.Server.Power.EntitySystems
if (appearance != null) 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)) if (!Resolve(uid, ref appearance, ref apc, false))
return; return;
appearance.SetData(ApcVisuals.PanelState, GetPanelState(apc)); _appearance.SetData(uid, ApcVisuals.PanelState, GetPanelState(apc), appearance);
} }
private sealed class ApcToolFinishedEvent : EntityEventArgs private sealed class ApcToolFinishedEvent : EntityEventArgs

View File

@@ -4,6 +4,7 @@ using Content.Server.Power.Components;
using Content.Server.Power.Nodes; using Content.Server.Power.Nodes;
using Content.Shared.Wires; using Content.Shared.Wires;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
namespace Content.Server.Power.EntitySystems namespace Content.Server.Power.EntitySystems
@@ -12,6 +13,7 @@ namespace Content.Server.Power.EntitySystems
public sealed class CableVisSystem : EntitySystem public sealed class CableVisSystem : EntitySystem
{ {
[Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() 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);
} }
} }
} }

View File

@@ -22,14 +22,14 @@ public sealed class PowerWireAction : BaseWireAction
public override StatusLightState? GetLightState(Wire wire) public override StatusLightState? GetLightState(Wire wire)
{ {
if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.MainWire, out int main) if (WiresSystem.TryGetData<int>(wire.Owner, PowerWireActionKey.MainWire, out var main)
&& main != wire.Id) && main != wire.Id)
{ {
return null; return null;
} }
if (!AllWiresMended(wire.Owner) if (!AllWiresMended(wire.Owner)
|| WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed) || WiresSystem.TryGetData<bool>(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed)
&& pulsed) && pulsed)
{ {
return StatusLightState.BlinkingSlow; return StatusLightState.BlinkingSlow;
@@ -40,14 +40,14 @@ public sealed class PowerWireAction : BaseWireAction
private bool AllWiresCut(EntityUid owner) private bool AllWiresCut(EntityUid owner)
{ {
return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) return WiresSystem.TryGetData<int?>(owner, PowerWireActionKey.CutWires, out var cut)
&& WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out int? count) && WiresSystem.TryGetData<int?>(owner, PowerWireActionKey.WireCount, out var count)
&& count == cut; && count == cut;
} }
private bool AllWiresMended(EntityUid owner) private bool AllWiresMended(EntityUid owner)
{ {
return WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) return WiresSystem.TryGetData<int?>(owner, PowerWireActionKey.CutWires, out var cut)
&& cut == 0; && cut == 0;
} }
@@ -72,7 +72,7 @@ public sealed class PowerWireAction : BaseWireAction
} }
else else
{ {
if (WiresSystem.TryGetData(owner, PowerWireActionKey.Pulsed, out bool isPulsed) if (WiresSystem.TryGetData<bool>(owner, PowerWireActionKey.Pulsed, out var isPulsed)
&& isPulsed) && isPulsed)
{ {
return; return;
@@ -84,8 +84,8 @@ public sealed class PowerWireAction : BaseWireAction
private void SetWireCuts(EntityUid owner, bool isCut) private void SetWireCuts(EntityUid owner, bool isCut)
{ {
if (WiresSystem.TryGetData(owner, PowerWireActionKey.CutWires, out int? cut) if (WiresSystem.TryGetData<int?>(owner, PowerWireActionKey.CutWires, out var cut)
&& WiresSystem.TryGetData(owner, PowerWireActionKey.WireCount, out int? count)) && WiresSystem.TryGetData<int?>(owner, PowerWireActionKey.WireCount, out var count))
{ {
if (cut == count && isCut if (cut == count && isCut
|| cut <= 0 && !isCut) || cut <= 0 && !isCut)
@@ -131,7 +131,7 @@ public sealed class PowerWireAction : BaseWireAction
var activePulse = false; var activePulse = false;
if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed)) if (WiresSystem.TryGetData<bool>(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed))
{ {
activePulse = pulsed; activePulse = pulsed;
} }
@@ -218,7 +218,7 @@ public sealed class PowerWireAction : BaseWireAction
var electrocuted = !TrySetElectrocution(user, wire, true); var electrocuted = !TrySetElectrocution(user, wire, true);
if (WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsedKey) && pulsedKey) if (WiresSystem.TryGetData<bool>(wire.Owner, PowerWireActionKey.Pulsed, out var pulsedKey) && pulsedKey)
return; return;
WiresSystem.SetData(wire.Owner, PowerWireActionKey.Pulsed, true); WiresSystem.SetData(wire.Owner, PowerWireActionKey.Pulsed, true);
@@ -236,7 +236,7 @@ public sealed class PowerWireAction : BaseWireAction
if (!IsPowered(wire.Owner)) if (!IsPowered(wire.Owner))
{ {
if (!WiresSystem.TryGetData(wire.Owner, PowerWireActionKey.Pulsed, out bool pulsed) if (!WiresSystem.TryGetData<bool>(wire.Owner, PowerWireActionKey.Pulsed, out var pulsed)
|| !pulsed) || !pulsed)
{ {
WiresSystem.TryCancelWireAction(wire.Owner, PowerWireActionKey.ElectrifiedCancel); WiresSystem.TryCancelWireAction(wire.Owner, PowerWireActionKey.ElectrifiedCancel);

View File

@@ -26,7 +26,7 @@ public sealed class RadioDeviceSystem : EntitySystem
[Dependency] private readonly ChatSystem _chat = default!; [Dependency] private readonly ChatSystem _chat = default!;
[Dependency] private readonly RadioSystem _radio = default!; [Dependency] private readonly RadioSystem _radio = default!;
[Dependency] private readonly InteractionSystem _interaction = 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. // Used to prevent a shitter from using a bunch of radios to spam chat.
private HashSet<(string, EntityUid)> _recentlySent = new(); private HashSet<(string, EntityUid)> _recentlySent = new();

View File

@@ -1,10 +1,12 @@
using Robust.Shared.Random; using Robust.Server.GameObjects;
using Robust.Shared.Random;
namespace Content.Server.RandomAppearance; namespace Content.Server.RandomAppearance;
public sealed class RandomAppearanceSystem : EntitySystem public sealed class RandomAppearanceSystem : EntitySystem
{ {
[Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
@@ -17,7 +19,7 @@ public sealed class RandomAppearanceSystem : EntitySystem
{ {
if (TryComp(uid, out AppearanceComponent? appearance) && component.EnumKey != null) 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);
} }
} }
} }

View File

@@ -7,6 +7,8 @@ namespace Content.Server.Security.Systems
{ {
public sealed class DeployableBarrierSystem : EntitySystem public sealed class DeployableBarrierSystem : EntitySystem
{ {
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -19,23 +21,23 @@ namespace Content.Server.Security.Systems
if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent)) if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent))
return; return;
ToggleBarrierDeploy(component, lockComponent.Locked); ToggleBarrierDeploy(uid, component, lockComponent.Locked);
} }
private void OnLockToggled(EntityUid uid, DeployableBarrierComponent component, LockToggledEvent args) 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<TransformComponent>(component.Owner).Anchored = isDeployed; EntityManager.GetComponent<TransformComponent>(component.Owner).Anchored = isDeployed;
if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComponent)) if (!EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
return; return;
var state = isDeployed ? DeployableBarrierState.Deployed : DeployableBarrierState.Idle; 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)) if (EntityManager.TryGetComponent(component.Owner, out PointLightComponent? light))
light.Enabled = isDeployed; light.Enabled = isDeployed;

View File

@@ -1,5 +1,4 @@
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using Content.Server.Audio; using Content.Server.Audio;
using Content.Server.Construction; using Content.Server.Construction;
using Content.Server.Power.Components; using Content.Server.Power.Components;
@@ -14,10 +13,8 @@ using Content.Shared.Shuttles.Components;
using Content.Shared.Temperature; using Content.Shared.Temperature;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Collision.Shapes; using Robust.Shared.Physics.Collision.Shapes;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Dynamics;
using Robust.Shared.Physics.Events; using Robust.Shared.Physics.Events;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
using Robust.Shared.Utility; using Robust.Shared.Utility;
@@ -26,11 +23,12 @@ namespace Content.Server.Shuttles.Systems
{ {
public sealed class ThrusterSystem : EntitySystem public sealed class ThrusterSystem : EntitySystem
{ {
[Robust.Shared.IoC.Dependency] private readonly IMapManager _mapManager = default!; [Dependency] private readonly IMapManager _mapManager = default!;
[Robust.Shared.IoC.Dependency] private readonly ITileDefinitionManager _tileDefManager = default!; [Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Robust.Shared.IoC.Dependency] private readonly AmbientSoundSystem _ambient = default!; [Dependency] private readonly AmbientSoundSystem _ambient = default!;
[Robust.Shared.IoC.Dependency] private readonly FixtureSystem _fixtureSystem = default!; [Dependency] private readonly FixtureSystem _fixtureSystem = default!;
[Robust.Shared.IoC.Dependency] private readonly DamageableSystem _damageable = 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. // Essentially whenever thruster enables we update the shuttle's available impulses which are used for movement.
// This is done for each direction available. // This is done for each direction available.
@@ -276,9 +274,9 @@ namespace Content.Server.Shuttles.Systems
throw new ArgumentOutOfRangeException(); 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)) if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
@@ -329,9 +327,9 @@ namespace Content.Server.Shuttles.Systems
throw new ArgumentOutOfRangeException(); 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)) if (EntityManager.TryGetComponent(uid, out PointLightComponent? pointLightComponent))
@@ -439,11 +437,8 @@ namespace Content.Server.Shuttles.Systems
foreach (var comp in component.LinearThrusters[index]) foreach (var comp in component.LinearThrusters[index])
{ {
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = true; 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]) foreach (var comp in component.LinearThrusters[index])
{ {
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = false; 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) foreach (var comp in component.AngularThrusters)
{ {
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = true; comp.Firing = true;
appearanceComponent.SetData(ThrusterVisualState.Thrusting, true); _appearance.SetData(comp.Owner, ThrusterVisualState.Thrusting, true);
} }
} }
else else
{ {
foreach (var comp in component.AngularThrusters) foreach (var comp in component.AngularThrusters)
{ {
if (!EntityManager.TryGetComponent((comp).Owner, out AppearanceComponent? appearanceComponent))
continue;
comp.Firing = false; 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 #endregion
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private int GetFlagIndex(DirectionFlag flag) private int GetFlagIndex(DirectionFlag flag)
{ {
return (int) Math.Log2((int) flag); return (int) Math.Log2((int) flag);

Some files were not shown because too many files have changed in this diff Show More