]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix medhud bounds with 64x64 inhands (#24102)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Mon, 15 Jan 2024 06:54:08 +0000 (01:54 -0500)
committerGitHub <noreply@github.com>
Mon, 15 Jan 2024 06:54:08 +0000 (23:54 -0700)
Content.Client/Overlays/EntityHealthBarOverlay.cs
Resources/Prototypes/Entities/Mobs/Species/base.yml

index 6bf68fc3b5db588dcea0846562fc643b4823573b..11bec135397fa601b679ce8e3679fe28fbbbbd1f 100644 (file)
@@ -7,6 +7,7 @@ using Robust.Client.GameObjects;
 using Robust.Client.Graphics;
 using Robust.Shared.Enums;
 using System.Numerics;
+using Content.Shared.StatusIcon.Components;
 using static Robust.Shared.Maths.Color;
 
 namespace Content.Client.Overlays;
@@ -65,7 +66,8 @@ public sealed class EntityHealthBarOverlay : Overlay
                 continue;
             }
 
-            var bounds = spriteComponent.Bounds;
+            // we use the status icon component bounds if specified otherwise use sprite
+            var bounds = _entManager.GetComponentOrNull<StatusIconComponent>(uid)?.Bounds ?? spriteComponent.Bounds;
             var worldPos = _transform.GetWorldPosition(xform, xformQuery);
 
             if (!bounds.Translated(worldPos).Intersects(args.WorldAABB))
@@ -81,8 +83,8 @@ public sealed class EntityHealthBarOverlay : Overlay
 
             handle.SetTransform(matty);
 
-            var yOffset = spriteComponent.Bounds.Height * EyeManager.PixelsPerMeter / 2 - 3f;
-            var widthOfMob = spriteComponent.Bounds.Width * EyeManager.PixelsPerMeter;
+            var yOffset = bounds.Height * EyeManager.PixelsPerMeter / 2 - 3f;
+            var widthOfMob = bounds.Width * EyeManager.PixelsPerMeter;
 
             var position = new Vector2(-widthOfMob / EyeManager.PixelsPerMeter / 2, yOffset / EyeManager.PixelsPerMeter);
 
index 1ce48ce140351075af8790ac1505192c4e7f6d21..eb104e05fa309027b5b7c01a0a1922ff7a1ac1e3 100644 (file)
@@ -80,6 +80,8 @@
         clownedon: # Not 'creampied' bc I can already see Skyrat complaining about conflicts.
           True: {visible: true}
           False: {visible: false}
+  - type: StatusIcon
+    bounds: -0.5,-0.5,0.5,0.5
   - type: RotationVisuals
     defaultRotation: 90
     horizontalRotation: 90