]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Generalize Sprite Views (#15881)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sat, 29 Apr 2023 06:09:07 +0000 (18:09 +1200)
committerGitHub <noreply@github.com>
Sat, 29 Apr 2023 06:09:07 +0000 (16:09 +1000)
Content.Client/Hands/ShowHandItemOverlay.cs
Resources/Prototypes/Entities/Debugging/rotation_marker.yml [deleted file]

index 67e7733625e779f9ff7d5fecc2243a561191f862..9b478333c8cd8e923b9a3c2582f924ceda1dc3d9 100644 (file)
@@ -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<HandsSystem>().GetActiveHandEntity();
+            _hands ??= _entMan.System<HandsSystem>();
+            var handEntity = _hands.GetActiveHandEntity();
 
-            if (handEntity == null || !_entMan.HasComponent<SpriteComponent>(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 (file)
index 738a99a..0000000
+++ /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