From dce29b48f8a89ff7c0e05fff48e10f0c2b073d4f Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Sat, 29 Apr 2023 18:09:07 +1200 Subject: [PATCH] Generalize Sprite Views (#15881) --- Content.Client/Hands/ShowHandItemOverlay.cs | 8 +-- .../Entities/Debugging/rotation_marker.yml | 53 ------------------- 2 files changed, 5 insertions(+), 56 deletions(-) delete mode 100644 Resources/Prototypes/Entities/Debugging/rotation_marker.yml diff --git a/Content.Client/Hands/ShowHandItemOverlay.cs b/Content.Client/Hands/ShowHandItemOverlay.cs index 67e7733625..9b478333c8 100644 --- a/Content.Client/Hands/ShowHandItemOverlay.cs +++ b/Content.Client/Hands/ShowHandItemOverlay.cs @@ -16,6 +16,7 @@ namespace Content.Client.Hands [Dependency] private readonly IClyde _clyde = default!; [Dependency] private readonly IEntityManager _entMan = default!; + private HandsSystem? _hands; private readonly IRenderTexture _renderBackbuffer; public override OverlaySpace Space => OverlaySpace.ScreenSpace; @@ -58,9 +59,10 @@ namespace Content.Client.Hands return; } - var handEntity = EntityOverride ?? EntitySystem.Get().GetActiveHandEntity(); + _hands ??= _entMan.System(); + var handEntity = _hands.GetActiveHandEntity(); - if (handEntity == null || !_entMan.HasComponent(handEntity)) + if (handEntity == null || !_entMan.TryGetComponent(handEntity, out SpriteComponent? sprite)) return; var halfSize = _renderBackbuffer.Size / 2; @@ -68,7 +70,7 @@ namespace Content.Client.Hands screen.RenderInRenderTarget(_renderBackbuffer, () => { - screen.DrawEntity(handEntity.Value, halfSize, new Vector2(1f, 1f) * uiScale, Direction.South); + screen.DrawEntity(handEntity.Value, halfSize, new Vector2(1f, 1f) * uiScale, Angle.Zero, Angle.Zero, Direction.South, sprite); }, Color.Transparent); screen.DrawTexture(_renderBackbuffer.Texture, mousePos - halfSize + offset, Color.White.WithAlpha(0.75f)); diff --git a/Resources/Prototypes/Entities/Debugging/rotation_marker.yml b/Resources/Prototypes/Entities/Debugging/rotation_marker.yml deleted file mode 100644 index 738a99a3ad..0000000000 --- a/Resources/Prototypes/Entities/Debugging/rotation_marker.yml +++ /dev/null @@ -1,53 +0,0 @@ -- type: entity - id: debugRotation1 - name: dbg_rotation1 - suffix: DEBUG - components: - - type: Tag - tags: - - Debug - - type: Clickable - - type: InteractionOutline - - type: Sprite - netsync: false - visible: true - sprite: debugRotation.rsi - state: direction1 - placement: - mode: AlignTileAny - -- type: entity - id: debugRotation4 - name: dbg_rotation4 - suffix: DEBUG - components: - - type: Tag - tags: - - Debug - - type: Clickable - - type: InteractionOutline - - type: Sprite - netsync: false - visible: true - sprite: debugRotation.rsi - state: direction4 - placement: - mode: AlignTileAny - -- type: entity - id: debugRotationTex - name: dbg_rotationTex - suffix: DEBUG - components: - - type: Tag - tags: - - Debug - - type: Clickable - - type: InteractionOutline - - type: Sprite - netsync: false - visible: true - sprite: debugRotation.rsi - state: direction1 - placement: - mode: AlignTileAny