Cleanup more SpriteComponent warnings (part 2) (#37527)
* Cleanup warnings in MagazineVisualsSpriteTest * Cleanup warnings in WiresVisualizerSystem * Cleanup warnings in GunSystem.SpentAmmo * Cleanup warnings in GunSystem * Cleanup warnings in GunSystem.ChamberMagazine * Cleanup warnings in MeleeWeaponSystem.Effects * Cleanup warnings in ToggleableLightVisualsSystem * Cleanup warnings in StatusIconOverlay * Cleanup warnings in SpriteFadeSystem * Cleanup warnings in PdaVisualizerSystem * Cleanup warnings in EnvelopeSystem * Cleanup warnings in MechSystem * Cleanup warnings in MappingOverlay * Cleanup warnings in LockVisualizerSystem * Cleanup warnings in DragDropSystem * Cleanup warnings in GhostSystem * Cleanup warnings in TriggerSystem.Proximity * Cleanup warnings in DragonSystem * Cleanup warnings in PortableScrubberVisualsSystem * File-scoped namespace for PortableScrubberVisualsSystem
This commit is contained in:
@@ -2,35 +2,37 @@ using Robust.Client.GameObjects;
|
|||||||
using Content.Shared.Atmos.Visuals;
|
using Content.Shared.Atmos.Visuals;
|
||||||
using Content.Client.Power;
|
using Content.Client.Power;
|
||||||
|
|
||||||
namespace Content.Client.Atmos.Visualizers
|
namespace Content.Client.Atmos.Visualizers;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Controls client-side visuals for portable scrubbers.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class PortableScrubberSystem : VisualizerSystem<PortableScrubberVisualsComponent>
|
||||||
{
|
{
|
||||||
/// <summary>
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
/// Controls client-side visuals for portable scrubbers.
|
|
||||||
/// </summary>
|
protected override void OnAppearanceChange(EntityUid uid, PortableScrubberVisualsComponent component, ref AppearanceChangeEvent args)
|
||||||
public sealed class PortableScrubberSystem : VisualizerSystem<PortableScrubberVisualsComponent>
|
|
||||||
{
|
{
|
||||||
protected override void OnAppearanceChange(EntityUid uid, PortableScrubberVisualsComponent component, ref AppearanceChangeEvent args)
|
if (args.Sprite == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
|
||||||
|
&& AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
|
||||||
{
|
{
|
||||||
if (args.Sprite == null)
|
var runningState = isRunning ? component.RunningState : component.IdleState;
|
||||||
return;
|
_sprite.LayerSetRsiState((uid, args.Sprite), PortableScrubberVisualLayers.IsRunning, runningState);
|
||||||
|
|
||||||
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
|
var fullState = isFull ? component.FullState : component.ReadyState;
|
||||||
&& AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
|
_sprite.LayerSetRsiState((uid, args.Sprite), PowerDeviceVisualLayers.Powered, fullState);
|
||||||
{
|
}
|
||||||
var runningState = isRunning ? component.RunningState : component.IdleState;
|
|
||||||
args.Sprite.LayerSetState(PortableScrubberVisualLayers.IsRunning, runningState);
|
|
||||||
|
|
||||||
var fullState = isFull ? component.FullState : component.ReadyState;
|
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
|
||||||
args.Sprite.LayerSetState(PowerDeviceVisualLayers.Powered, fullState);
|
{
|
||||||
}
|
_sprite.LayerSetVisible((uid, args.Sprite), PortableScrubberVisualLayers.IsDraining, isDraining);
|
||||||
|
|
||||||
if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
|
|
||||||
{
|
|
||||||
args.Sprite.LayerSetVisible(PortableScrubberVisualLayers.IsDraining, isDraining);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PortableScrubberVisualLayers : byte
|
public enum PortableScrubberVisualLayers : byte
|
||||||
{
|
{
|
||||||
IsRunning,
|
IsRunning,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace Content.Client.Dragon;
|
|||||||
public sealed class DragonSystem : EntitySystem
|
public sealed class DragonSystem : EntitySystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedPointLightSystem _lights = default!;
|
[Dependency] private readonly SharedPointLightSystem _lights = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -31,7 +32,7 @@ public sealed class DragonSystem : EntitySystem
|
|||||||
switch (state.State)
|
switch (state.State)
|
||||||
{
|
{
|
||||||
case DragonRiftState.Charging:
|
case DragonRiftState.Charging:
|
||||||
sprite?.LayerSetColor(0, Color.FromHex("#569fff"));
|
_sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#569fff"));
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
{
|
{
|
||||||
@@ -39,7 +40,7 @@ public sealed class DragonSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DragonRiftState.AlmostFinished:
|
case DragonRiftState.AlmostFinished:
|
||||||
sprite?.LayerSetColor(0, Color.FromHex("#cf4cff"));
|
_sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#cf4cff"));
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
{
|
{
|
||||||
@@ -47,7 +48,7 @@ public sealed class DragonSystem : EntitySystem
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DragonRiftState.Finished:
|
case DragonRiftState.Finished:
|
||||||
sprite?.LayerSetColor(0, Color.FromHex("#edbc36"));
|
_sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#edbc36"));
|
||||||
|
|
||||||
if (light != null)
|
if (light != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public sealed partial class TriggerSystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly AnimationPlayerSystem _player = default!;
|
[Dependency] private readonly AnimationPlayerSystem _player = default!;
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Currently all of the appearance stuff is hardcoded for portable flashers
|
* Currently all of the appearance stuff is hardcoded for portable flashers
|
||||||
@@ -79,7 +80,7 @@ public sealed partial class TriggerSystem
|
|||||||
if (!_appearance.TryGetData<ProximityTriggerVisuals>(uid, ProximityTriggerVisualState.State, out var state, appearance))
|
if (!_appearance.TryGetData<ProximityTriggerVisuals>(uid, ProximityTriggerVisualState.State, out var state, appearance))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!spriteComponent.LayerMapTryGet(ProximityTriggerVisualLayers.Base, out var layer))
|
if (!_sprite.LayerMapTryGet((uid, spriteComponent), ProximityTriggerVisualLayers.Base, out var layer, false))
|
||||||
// Don't do anything if the sprite doesn't have the layer.
|
// Don't do anything if the sprite doesn't have the layer.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -89,7 +90,7 @@ public sealed partial class TriggerSystem
|
|||||||
// Don't interrupt the flash animation
|
// Don't interrupt the flash animation
|
||||||
if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
|
if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
|
||||||
_player.Stop(uid, player, AnimKey);
|
_player.Stop(uid, player, AnimKey);
|
||||||
spriteComponent.LayerSetState(layer, "on");
|
_sprite.LayerSetRsiState((uid, spriteComponent), layer, "on");
|
||||||
break;
|
break;
|
||||||
case ProximityTriggerVisuals.Active:
|
case ProximityTriggerVisuals.Active:
|
||||||
if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
|
if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
|
||||||
@@ -98,7 +99,7 @@ public sealed partial class TriggerSystem
|
|||||||
case ProximityTriggerVisuals.Off:
|
case ProximityTriggerVisuals.Off:
|
||||||
default:
|
default:
|
||||||
_player.Stop(uid, player, AnimKey);
|
_player.Stop(uid, player, AnimKey);
|
||||||
spriteComponent.LayerSetState(layer, "off");
|
_sprite.LayerSetRsiState((uid, spriteComponent), layer, "off");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ namespace Content.Client.Ghost
|
|||||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||||
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
|
[Dependency] private readonly PointLightSystem _pointLightSystem = default!;
|
||||||
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
|
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
public int AvailableGhostRoleCount { get; private set; }
|
public int AvailableGhostRoleCount { get; private set; }
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ namespace Content.Client.Ghost
|
|||||||
var query = AllEntityQuery<GhostComponent, SpriteComponent>();
|
var query = AllEntityQuery<GhostComponent, SpriteComponent>();
|
||||||
while (query.MoveNext(out var uid, out _, out var sprite))
|
while (query.MoveNext(out var uid, out _, out var sprite))
|
||||||
{
|
{
|
||||||
sprite.Visible = value || uid == _playerManager.LocalEntity;
|
_sprite.SetVisible((uid, sprite), value || uid == _playerManager.LocalEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +73,7 @@ namespace Content.Client.Ghost
|
|||||||
private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
|
private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
|
||||||
{
|
{
|
||||||
if (TryComp(uid, out SpriteComponent? sprite))
|
if (TryComp(uid, out SpriteComponent? sprite))
|
||||||
sprite.Visible = GhostVisibility || uid == _playerManager.LocalEntity;
|
_sprite.SetVisible((uid, sprite), GhostVisibility || uid == _playerManager.LocalEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLightingActionEvent args)
|
private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLightingActionEvent args)
|
||||||
@@ -150,7 +151,7 @@ namespace Content.Client.Ghost
|
|||||||
private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args)
|
private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args)
|
||||||
{
|
{
|
||||||
if (TryComp<SpriteComponent>(uid, out var sprite))
|
if (TryComp<SpriteComponent>(uid, out var sprite))
|
||||||
sprite.LayerSetColor(0, component.Color);
|
_sprite.LayerSetColor((uid, sprite), 0, component.Color);
|
||||||
|
|
||||||
if (uid != _playerManager.LocalEntity)
|
if (uid != _playerManager.LocalEntity)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||||
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
||||||
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
[Dependency] private readonly SharedTransformSystem _transformSystem = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
// how often to recheck possible targets (prevents calling expensive
|
// how often to recheck possible targets (prevents calling expensive
|
||||||
// check logic each update)
|
// check logic each update)
|
||||||
@@ -178,7 +179,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
|
|
||||||
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||||
{
|
{
|
||||||
if (args.Session?.AttachedEntity is not {Valid: true} dragger ||
|
if (args.Session?.AttachedEntity is not { Valid: true } dragger ||
|
||||||
_combatMode.IsInCombatMode())
|
_combatMode.IsInCombatMode())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -249,11 +250,11 @@ public sealed class DragDropSystem : SharedDragDropSystem
|
|||||||
var mousePos = _eyeManager.PixelToMap(screenPos);
|
var mousePos = _eyeManager.PixelToMap(screenPos);
|
||||||
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
_dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
|
||||||
var dragSprite = Comp<SpriteComponent>(_dragShadow.Value);
|
var dragSprite = Comp<SpriteComponent>(_dragShadow.Value);
|
||||||
dragSprite.CopyFrom(draggedSprite);
|
_sprite.CopySprite((_draggedEntity.Value, draggedSprite), (_dragShadow.Value, dragSprite));
|
||||||
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
|
||||||
dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
|
_sprite.SetColor((_dragShadow.Value, dragSprite), dragSprite.Color.WithAlpha(0.7f));
|
||||||
// keep it on top of everything
|
// keep it on top of everything
|
||||||
dragSprite.DrawDepth = (int) DrawDepth.Overlays;
|
_sprite.SetDrawDepth((_dragShadow.Value, dragSprite), (int)DrawDepth.Overlays);
|
||||||
if (!dragSprite.NoRotation)
|
if (!dragSprite.NoRotation)
|
||||||
{
|
{
|
||||||
_transformSystem.SetWorldRotationNoLerp(_dragShadow.Value, _transformSystem.GetWorldRotation(_draggedEntity.Value));
|
_transformSystem.SetWorldRotationNoLerp(_dragShadow.Value, _transformSystem.GetWorldRotation(_draggedEntity.Value));
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace Content.Client.Lock.Visualizers;
|
|||||||
|
|
||||||
public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent>
|
public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent>
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
protected override void OnAppearanceChange(EntityUid uid, LockVisualsComponent comp, ref AppearanceChangeEvent args)
|
protected override void OnAppearanceChange(EntityUid uid, LockVisualsComponent comp, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
if (args.Sprite == null
|
if (args.Sprite == null
|
||||||
@@ -20,14 +22,14 @@ public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent
|
|||||||
|
|
||||||
if (AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.Open, out var open, args.Component))
|
if (AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.Open, out var open, args.Component))
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetVisible(LockVisualLayers.Lock, !open);
|
_sprite.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, !open);
|
||||||
}
|
}
|
||||||
else if (!(bool) unlockedStateExist!)
|
else if (!(bool)unlockedStateExist!)
|
||||||
args.Sprite.LayerSetVisible(LockVisualLayers.Lock, locked);
|
_sprite.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, locked);
|
||||||
|
|
||||||
if (!open && (bool) unlockedStateExist!)
|
if (!open && (bool)unlockedStateExist!)
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetState(LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
|
_sprite.LayerSetRsiState((uid, args.Sprite), LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ public sealed class MappingOverlay : Overlay
|
|||||||
[Dependency] private readonly IPlayerManager _player = default!;
|
[Dependency] private readonly IPlayerManager _player = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
[Dependency] private readonly IPrototypeManager _prototypes = default!;
|
||||||
|
|
||||||
|
private readonly SpriteSystem _sprite;
|
||||||
|
|
||||||
// 1 off in case something else uses these colors since we use them to compare
|
// 1 off in case something else uses these colors since we use them to compare
|
||||||
private static readonly Color PickColor = new(1, 255, 0);
|
private static readonly Color PickColor = new(1, 255, 0);
|
||||||
private static readonly Color DeleteColor = new(255, 1, 0);
|
private static readonly Color DeleteColor = new(255, 1, 0);
|
||||||
@@ -30,6 +32,8 @@ public sealed class MappingOverlay : Overlay
|
|||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
|
_sprite = _entities.System<SpriteSystem>();
|
||||||
|
|
||||||
_state = state;
|
_state = state;
|
||||||
_shader = _prototypes.Index<ShaderPrototype>("unshaded").Instance();
|
_shader = _prototypes.Index<ShaderPrototype>("unshaded").Instance();
|
||||||
}
|
}
|
||||||
@@ -42,7 +46,7 @@ public sealed class MappingOverlay : Overlay
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sprite.Color == DeleteColor || sprite.Color == PickColor)
|
if (sprite.Color == DeleteColor || sprite.Color == PickColor)
|
||||||
sprite.Color = color;
|
_sprite.SetColor((id, sprite), color);
|
||||||
}
|
}
|
||||||
|
|
||||||
_oldColors.Clear();
|
_oldColors.Clear();
|
||||||
@@ -61,7 +65,7 @@ public sealed class MappingOverlay : Overlay
|
|||||||
_entities.TryGetComponent(entity, out SpriteComponent? sprite))
|
_entities.TryGetComponent(entity, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
_oldColors[entity] = sprite.Color;
|
_oldColors[entity] = sprite.Color;
|
||||||
sprite.Color = PickColor;
|
_sprite.SetColor((entity, sprite), PickColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -72,7 +76,7 @@ public sealed class MappingOverlay : Overlay
|
|||||||
_entities.TryGetComponent(entity, out SpriteComponent? sprite))
|
_entities.TryGetComponent(entity, out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
_oldColors[entity] = sprite.Color;
|
_oldColors[entity] = sprite.Color;
|
||||||
sprite.Color = DeleteColor;
|
_sprite.SetColor((entity, sprite), DeleteColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace Content.Client.Mech;
|
|||||||
public sealed class MechSystem : SharedMechSystem
|
public sealed class MechSystem : SharedMechSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -24,7 +25,7 @@ public sealed class MechSystem : SharedMechSystem
|
|||||||
if (args.Sprite == null)
|
if (args.Sprite == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!args.Sprite.TryGetLayer((int) MechVisualLayers.Base, out var layer))
|
if (!_sprite.LayerExists((uid, args.Sprite), MechVisualLayers.Base))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var state = component.BaseState;
|
var state = component.BaseState;
|
||||||
@@ -40,7 +41,7 @@ public sealed class MechSystem : SharedMechSystem
|
|||||||
drawDepth = DrawDepth.SmallMobs;
|
drawDepth = DrawDepth.SmallMobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
layer.SetState(state);
|
_sprite.LayerSetRsiState((uid, args.Sprite), MechVisualLayers.Base, state);
|
||||||
args.Sprite.DrawDepth = (int) drawDepth;
|
_sprite.SetDrawDepth((uid, args.Sprite), (int)drawDepth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,19 +6,20 @@ namespace Content.Client.PDA;
|
|||||||
|
|
||||||
public sealed class PdaVisualizerSystem : VisualizerSystem<PdaVisualsComponent>
|
public sealed class PdaVisualizerSystem : VisualizerSystem<PdaVisualsComponent>
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
protected override void OnAppearanceChange(EntityUid uid, PdaVisualsComponent comp, ref AppearanceChangeEvent args)
|
protected override void OnAppearanceChange(EntityUid uid, PdaVisualsComponent comp, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
if (args.Sprite == null)
|
if (args.Sprite == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (AppearanceSystem.TryGetData<string>(uid, PdaVisuals.PdaType, out var pdaType, args.Component))
|
if (AppearanceSystem.TryGetData<string>(uid, PdaVisuals.PdaType, out var pdaType, args.Component))
|
||||||
args.Sprite.LayerSetState(PdaVisualLayers.Base, pdaType);
|
_sprite.LayerSetRsiState((uid, args.Sprite), PdaVisualLayers.Base, pdaType);
|
||||||
|
|
||||||
if (AppearanceSystem.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
|
if (AppearanceSystem.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
|
||||||
args.Sprite.LayerSetVisible(PdaVisualLayers.Flashlight, isFlashlightOn);
|
_sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.Flashlight, isFlashlightOn);
|
||||||
|
|
||||||
if (AppearanceSystem.TryGetData<bool>(uid, PdaVisuals.IdCardInserted, out var isCardInserted, args.Component))
|
if (AppearanceSystem.TryGetData<bool>(uid, PdaVisuals.IdCardInserted, out var isCardInserted, args.Component))
|
||||||
args.Sprite.LayerSetVisible(PdaVisualLayers.IdLight, isCardInserted);
|
_sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.IdLight, isCardInserted);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PdaVisualLayers : byte
|
public enum PdaVisualLayers : byte
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ namespace Content.Client.Paper;
|
|||||||
|
|
||||||
public sealed class EnvelopeSystem : VisualizerSystem<EnvelopeComponent>
|
public sealed class EnvelopeSystem : VisualizerSystem<EnvelopeComponent>
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
@@ -21,9 +23,9 @@ public sealed class EnvelopeSystem : VisualizerSystem<EnvelopeComponent>
|
|||||||
if (!Resolve(ent.Owner, ref sprite))
|
if (!Resolve(ent.Owner, ref sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprite.LayerSetVisible(EnvelopeVisualLayers.Open, ent.Comp.State == EnvelopeComponent.EnvelopeState.Open);
|
_sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Open, ent.Comp.State == EnvelopeComponent.EnvelopeState.Open);
|
||||||
sprite.LayerSetVisible(EnvelopeVisualLayers.Sealed, ent.Comp.State == EnvelopeComponent.EnvelopeState.Sealed);
|
_sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Sealed, ent.Comp.State == EnvelopeComponent.EnvelopeState.Sealed);
|
||||||
sprite.LayerSetVisible(EnvelopeVisualLayers.Torn, ent.Comp.State == EnvelopeComponent.EnvelopeState.Torn);
|
_sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Torn, ent.Comp.State == EnvelopeComponent.EnvelopeState.Torn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum EnvelopeVisualLayers : byte
|
public enum EnvelopeVisualLayers : byte
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
using System.Numerics;
|
|
||||||
using Content.Client.Gameplay;
|
using Content.Client.Gameplay;
|
||||||
using Content.Shared.Sprite;
|
using Content.Shared.Sprite;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -10,7 +9,6 @@ using Robust.Client.UserInterface;
|
|||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Physics.Systems;
|
using Robust.Shared.Physics.Systems;
|
||||||
using Robust.Shared.Physics;
|
using Robust.Shared.Physics;
|
||||||
using Robust.Shared.Physics.Components;
|
|
||||||
|
|
||||||
namespace Content.Client.Sprite;
|
namespace Content.Client.Sprite;
|
||||||
|
|
||||||
@@ -28,6 +26,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _uiManager = default!;
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
private List<(MapCoordinates Point, bool ExcludeBoundingBox)> _points = new();
|
private List<(MapCoordinates Point, bool ExcludeBoundingBox)> _points = new();
|
||||||
|
|
||||||
@@ -58,7 +57,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
if (MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating || !TryComp<SpriteComponent>(uid, out var sprite))
|
if (MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating || !TryComp<SpriteComponent>(uid, out var sprite))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sprite.Color = sprite.Color.WithAlpha(component.OriginalAlpha);
|
_sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(component.OriginalAlpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -132,7 +131,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
|
|
||||||
if (!sprite.Color.A.Equals(newColor))
|
if (!sprite.Color.A.Equals(newColor))
|
||||||
{
|
{
|
||||||
sprite.Color = sprite.Color.WithAlpha(newColor);
|
_sprite.SetColor((ent, sprite), sprite.Color.WithAlpha(newColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +156,7 @@ public sealed class SpriteFadeSystem : EntitySystem
|
|||||||
|
|
||||||
if (!newColor.Equals(sprite.Color.A))
|
if (!newColor.Equals(sprite.Color.A))
|
||||||
{
|
{
|
||||||
sprite.Color = sprite.Color.WithAlpha(newColor);
|
_sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(newColor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public sealed class StatusIconOverlay : Overlay
|
|||||||
if (xform.MapID != args.MapId || !sprite.Visible)
|
if (xform.MapID != args.MapId || !sprite.Visible)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var bounds = comp.Bounds ?? sprite.Bounds;
|
var bounds = comp.Bounds ?? _sprite.GetLocalBounds((uid, sprite));
|
||||||
|
|
||||||
var worldPos = _transform.GetWorldPosition(xform, xformQuery);
|
var worldPos = _transform.GetWorldPosition(xform, xformQuery);
|
||||||
|
|
||||||
@@ -86,28 +86,28 @@ public sealed class StatusIconOverlay : Overlay
|
|||||||
if (proto.LocationPreference == StatusIconLocationPreference.Left ||
|
if (proto.LocationPreference == StatusIconLocationPreference.Left ||
|
||||||
proto.LocationPreference == StatusIconLocationPreference.None && countL <= countR)
|
proto.LocationPreference == StatusIconLocationPreference.None && countL <= countR)
|
||||||
{
|
{
|
||||||
if (accOffsetL + texture.Height > sprite.Bounds.Height * EyeManager.PixelsPerMeter)
|
if (accOffsetL + texture.Height > _sprite.GetLocalBounds((uid, sprite)).Height * EyeManager.PixelsPerMeter)
|
||||||
break;
|
break;
|
||||||
if (proto.Layer == StatusIconLayer.Base)
|
if (proto.Layer == StatusIconLayer.Base)
|
||||||
{
|
{
|
||||||
accOffsetL += texture.Height;
|
accOffsetL += texture.Height;
|
||||||
countL++;
|
countL++;
|
||||||
}
|
}
|
||||||
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) (accOffsetL - proto.Offset) / EyeManager.PixelsPerMeter;
|
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float)(accOffsetL - proto.Offset) / EyeManager.PixelsPerMeter;
|
||||||
xOffset = -(bounds.Width + sprite.Offset.X) / 2f;
|
xOffset = -(bounds.Width + sprite.Offset.X) / 2f;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (accOffsetR + texture.Height > sprite.Bounds.Height * EyeManager.PixelsPerMeter)
|
if (accOffsetR + texture.Height > _sprite.GetLocalBounds((uid, sprite)).Height * EyeManager.PixelsPerMeter)
|
||||||
break;
|
break;
|
||||||
if (proto.Layer == StatusIconLayer.Base)
|
if (proto.Layer == StatusIconLayer.Base)
|
||||||
{
|
{
|
||||||
accOffsetR += texture.Height;
|
accOffsetR += texture.Height;
|
||||||
countR++;
|
countR++;
|
||||||
}
|
}
|
||||||
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) (accOffsetR - proto.Offset) / EyeManager.PixelsPerMeter;
|
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float)(accOffsetR - proto.Offset) / EyeManager.PixelsPerMeter;
|
||||||
xOffset = (bounds.Width + sprite.Offset.X) / 2f - (float) texture.Width / EyeManager.PixelsPerMeter;
|
xOffset = (bounds.Width + sprite.Offset.X) / 2f - (float)texture.Width / EyeManager.PixelsPerMeter;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly SharedItemSystem _itemSys = default!;
|
[Dependency] private readonly SharedItemSystem _itemSys = default!;
|
||||||
[Dependency] private readonly SharedPointLightSystem _lights = default!;
|
[Dependency] private readonly SharedPointLightSystem _lights = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -31,11 +32,11 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
|
|||||||
var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, args.Component);
|
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 && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
|
if (args.Sprite != null && component.SpriteLayer != null && _sprite.LayerMapTryGet((uid, args.Sprite), component.SpriteLayer, out var layer, false))
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetVisible(layer, enabled);
|
_sprite.LayerSetVisible((uid, args.Sprite), layer, enabled);
|
||||||
if (modulate)
|
if (modulate)
|
||||||
args.Sprite.LayerSetColor(layer, color);
|
_sprite.LayerSetColor((uid, args.Sprite), layer, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update any point-lights
|
// Update any point-lights
|
||||||
|
|||||||
@@ -49,14 +49,14 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
{
|
{
|
||||||
if (user != weapon
|
if (user != weapon
|
||||||
&& TryComp(weapon, out SpriteComponent? weaponSpriteComponent))
|
&& TryComp(weapon, out SpriteComponent? weaponSpriteComponent))
|
||||||
sprite.CopyFrom(weaponSpriteComponent);
|
_sprite.CopySprite((weapon, weaponSpriteComponent), (animationUid, sprite));
|
||||||
|
|
||||||
spriteRotation = meleeWeaponComponent.WideAnimationRotation;
|
spriteRotation = meleeWeaponComponent.WideAnimationRotation;
|
||||||
|
|
||||||
if (meleeWeaponComponent.SwingLeft)
|
if (meleeWeaponComponent.SwingLeft)
|
||||||
angle *= -1;
|
angle *= -1;
|
||||||
}
|
}
|
||||||
sprite.Rotation = localPos.ToWorldAngle();
|
_sprite.SetRotation((animationUid, sprite), localPos.ToWorldAngle());
|
||||||
var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f);
|
var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f);
|
||||||
|
|
||||||
var xform = _xformQuery.GetComponent(animationUid);
|
var xform = _xformQuery.GetComponent(animationUid);
|
||||||
@@ -74,7 +74,7 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
case WeaponArcAnimation.Thrust:
|
case WeaponArcAnimation.Thrust:
|
||||||
track = EnsureComp<TrackUserComponent>(animationUid);
|
track = EnsureComp<TrackUserComponent>(animationUid);
|
||||||
track.User = user;
|
track.User = user;
|
||||||
_animation.Play(animationUid, GetThrustAnimation(sprite, distance, spriteRotation), ThrustAnimationKey);
|
_animation.Play(animationUid, GetThrustAnimation((animationUid, sprite), distance, spriteRotation), ThrustAnimationKey);
|
||||||
if (arcComponent.Fadeout)
|
if (arcComponent.Fadeout)
|
||||||
_animation.Play(animationUid, GetFadeAnimation(sprite, 0.05f, 0.15f), FadeAnimationKey);
|
_animation.Play(animationUid, GetFadeAnimation(sprite, 0.05f, 0.15f), FadeAnimationKey);
|
||||||
break;
|
break;
|
||||||
@@ -132,13 +132,13 @@ public sealed partial class MeleeWeaponSystem
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Animation GetThrustAnimation(SpriteComponent sprite, float distance, Angle spriteRotation)
|
private Animation GetThrustAnimation(Entity<SpriteComponent> sprite, float distance, Angle spriteRotation)
|
||||||
{
|
{
|
||||||
const float thrustEnd = 0.05f;
|
const float thrustEnd = 0.05f;
|
||||||
const float length = 0.15f;
|
const float length = 0.15f;
|
||||||
var startOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance / 5f));
|
var startOffset = sprite.Comp.Rotation.RotateVec(new Vector2(0f, -distance / 5f));
|
||||||
var endOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance));
|
var endOffset = sprite.Comp.Rotation.RotateVec(new Vector2(0f, -distance));
|
||||||
sprite.Rotation += spriteRotation;
|
_sprite.SetRotation(sprite.AsNullable(), sprite.Comp.Rotation + spriteRotation);
|
||||||
|
|
||||||
return new Animation()
|
return new Animation()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
|
|||||||
[Dependency] private readonly InputSystem _inputSystem = default!;
|
[Dependency] private readonly InputSystem _inputSystem = default!;
|
||||||
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
|
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
|
||||||
[Dependency] private readonly MapSystem _map = default!;
|
[Dependency] private readonly MapSystem _map = default!;
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
private EntityQuery<TransformComponent> _xformQuery;
|
private EntityQuery<TransformComponent> _xformQuery;
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public sealed partial class GunSystem
|
|||||||
private void OnChamberMagazineAppearance(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref AppearanceChangeEvent args)
|
private void OnChamberMagazineAppearance(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
if (args.Sprite == null ||
|
if (args.Sprite == null ||
|
||||||
!args.Sprite.LayerMapTryGet(GunVisualLayers.Base, out var boltLayer) ||
|
!_sprite.LayerMapTryGet((uid, args.Sprite), GunVisualLayers.Base, out var boltLayer, false) ||
|
||||||
!Appearance.TryGetData(uid, AmmoVisuals.BoltClosed, out bool boltClosed))
|
!Appearance.TryGetData(uid, AmmoVisuals.BoltClosed, out bool boltClosed))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -30,11 +30,11 @@ public sealed partial class GunSystem
|
|||||||
// Maybe re-using base layer for this will bite me someday but screw you future sloth.
|
// Maybe re-using base layer for this will bite me someday but screw you future sloth.
|
||||||
if (boltClosed)
|
if (boltClosed)
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetState(boltLayer, "base");
|
_sprite.LayerSetRsiState((uid, args.Sprite), boltLayer, "base");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetState(boltLayer, "bolt-open");
|
_sprite.LayerSetRsiState((uid, args.Sprite), boltLayer, "bolt-open");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ public sealed partial class GunSystem
|
|||||||
else
|
else
|
||||||
state = component.State;
|
state = component.State;
|
||||||
|
|
||||||
sprite.LayerSetState(AmmoVisualLayers.Base, state);
|
_sprite.LayerSetRsiState((uid, sprite), AmmoVisualLayers.Base, state);
|
||||||
if (sprite.LayerExists(AmmoVisualLayers.Tip)){
|
_sprite.RemoveLayer((uid, sprite), AmmoVisualLayers.Tip, false);
|
||||||
sprite.RemoveLayer(AmmoVisualLayers.Tip);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,9 +130,9 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
_xform.SetLocalRotationNoLerp(ent, xform.LocalRotation + delta, xform);
|
_xform.SetLocalRotationNoLerp(ent, xform.LocalRotation + delta, xform);
|
||||||
|
|
||||||
sprite[EffectLayers.Unshaded].AutoAnimated = false;
|
sprite[EffectLayers.Unshaded].AutoAnimated = false;
|
||||||
sprite.LayerSetSprite(EffectLayers.Unshaded, rsi);
|
_sprite.LayerSetSprite((ent, sprite), EffectLayers.Unshaded, rsi);
|
||||||
sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState);
|
_sprite.LayerSetRsiState((ent, sprite), EffectLayers.Unshaded, rsi.RsiState);
|
||||||
sprite.Scale = new Vector2(a.Distance, 1f);
|
_sprite.SetScale((ent, sprite), new Vector2(a.Distance, 1f));
|
||||||
sprite[EffectLayers.Unshaded].Visible = true;
|
sprite[EffectLayers.Unshaded].Visible = true;
|
||||||
|
|
||||||
var anim = new Animation()
|
var anim = new Animation()
|
||||||
|
|||||||
@@ -5,22 +5,24 @@ namespace Content.Client.Wires.Visualizers
|
|||||||
{
|
{
|
||||||
public sealed class WiresVisualizerSystem : VisualizerSystem<WiresVisualsComponent>
|
public sealed class WiresVisualizerSystem : VisualizerSystem<WiresVisualsComponent>
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly SpriteSystem _sprite = default!;
|
||||||
|
|
||||||
protected override void OnAppearanceChange(EntityUid uid, WiresVisualsComponent component, ref AppearanceChangeEvent args)
|
protected override void OnAppearanceChange(EntityUid uid, WiresVisualsComponent component, ref AppearanceChangeEvent args)
|
||||||
{
|
{
|
||||||
if (args.Sprite == null)
|
if (args.Sprite == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var layer = args.Sprite.LayerMapReserveBlank(WiresVisualLayers.MaintenancePanel);
|
var layer = _sprite.LayerMapReserve((uid, args.Sprite), WiresVisualLayers.MaintenancePanel);
|
||||||
|
|
||||||
if(args.AppearanceData.TryGetValue(WiresVisuals.MaintenancePanelState, out var panelStateObject) &&
|
if (args.AppearanceData.TryGetValue(WiresVisuals.MaintenancePanelState, out var panelStateObject) &&
|
||||||
panelStateObject is bool panelState)
|
panelStateObject is bool panelState)
|
||||||
{
|
{
|
||||||
args.Sprite.LayerSetVisible(layer, panelState);
|
_sprite.LayerSetVisible((uid, args.Sprite), layer, panelState);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Mainly for spawn window
|
//Mainly for spawn window
|
||||||
args.Sprite.LayerSetVisible(layer, false);
|
_sprite.LayerSetVisible((uid, args.Sprite), layer, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Client.Weapons.Ranged.Components;
|
using Content.Client.Weapons.Ranged.Components;
|
||||||
using Content.Shared.Prototypes;
|
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
|
|
||||||
namespace Content.IntegrationTests.Tests;
|
namespace Content.IntegrationTests.Tests;
|
||||||
|
|
||||||
@@ -16,10 +14,11 @@ public sealed class MagazineVisualsSpriteTest
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task MagazineVisualsSpritesExist()
|
public async Task MagazineVisualsSpritesExist()
|
||||||
{
|
{
|
||||||
await using var pair = await PoolManager.GetServerClient();
|
await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
|
||||||
var client = pair.Client;
|
var client = pair.Client;
|
||||||
var toTest = new List<(int, string)>();
|
var toTest = new List<(int, string)>();
|
||||||
var protos = pair.GetPrototypesWithComponent<MagazineVisualsComponent>();
|
var protos = pair.GetPrototypesWithComponent<MagazineVisualsComponent>();
|
||||||
|
var spriteSys = client.System<SpriteSystem>();
|
||||||
|
|
||||||
await client.WaitAssertion(() =>
|
await client.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
@@ -36,9 +35,9 @@ public sealed class MagazineVisualsSpriteTest
|
|||||||
@$"{proto.ID} has MagazineVisualsComponent but no AppearanceComponent.");
|
@$"{proto.ID} has MagazineVisualsComponent but no AppearanceComponent.");
|
||||||
|
|
||||||
toTest.Clear();
|
toTest.Clear();
|
||||||
if (sprite.LayerMapTryGet(GunVisualLayers.Mag, out var magLayerId))
|
if (spriteSys.LayerMapTryGet((uid, sprite), GunVisualLayers.Mag, out var magLayerId, false))
|
||||||
toTest.Add((magLayerId, ""));
|
toTest.Add((magLayerId, ""));
|
||||||
if (sprite.LayerMapTryGet(GunVisualLayers.MagUnshaded, out var magUnshadedLayerId))
|
if (spriteSys.LayerMapTryGet((uid, sprite), GunVisualLayers.MagUnshaded, out var magUnshadedLayerId, false))
|
||||||
toTest.Add((magUnshadedLayerId, "-unshaded"));
|
toTest.Add((magUnshadedLayerId, "-unshaded"));
|
||||||
|
|
||||||
Assert.That(
|
Assert.That(
|
||||||
@@ -49,7 +48,7 @@ public sealed class MagazineVisualsSpriteTest
|
|||||||
var start = visuals.ZeroVisible ? 0 : 1;
|
var start = visuals.ZeroVisible ? 0 : 1;
|
||||||
foreach (var (id, midfix) in toTest)
|
foreach (var (id, midfix) in toTest)
|
||||||
{
|
{
|
||||||
Assert.That(sprite.TryGetLayer(id, out var layer));
|
Assert.That(spriteSys.TryGetLayer((uid, sprite), id, out var layer, false));
|
||||||
var rsi = layer.ActualRsi;
|
var rsi = layer.ActualRsi;
|
||||||
for (var i = start; i < visuals.MagSteps; i++)
|
for (var i = start; i < visuals.MagSteps; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user