Hunger and thirst HUDs (#18066)

* security HUD now shows a job icon on entities with a body

* thirst goggles

* set starting hud gear
This commit is contained in:
PrPleGoo
2023-07-18 08:01:22 +02:00
committed by GitHub
parent 9268789618
commit 67e4b626c1
26 changed files with 1027 additions and 95 deletions

View File

@@ -1,8 +1,9 @@
using System.Numerics;
using Content.Shared.StatusIcon;
using Content.Shared.StatusIcon.Components;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Shared.Enums;
using System.Numerics;
namespace Content.Client.StatusIcon;
@@ -57,7 +58,8 @@ public sealed class StatusIconOverlay : Overlay
Matrix3.Multiply(rotationMatrix, scaledWorld, out var matty);
handle.SetTransform(matty);
var count = 0;
var countL = 0;
var countR = 0;
var accOffsetL = 0;
var accOffsetR = 0;
icons.Sort();
@@ -71,13 +73,16 @@ public sealed class StatusIconOverlay : Overlay
// the icons are ordered left to right, top to bottom.
// extra icons that don't fit are just cut off.
if (count % 2 == 0)
if (proto.LocationPreference == StatusIconLocationPreference.Left ||
proto.LocationPreference == StatusIconLocationPreference.None && countL <= countR)
{
if (accOffsetL + texture.Height > sprite.Bounds.Height * EyeManager.PixelsPerMeter)
break;
accOffsetL += texture.Height;
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) accOffsetL / EyeManager.PixelsPerMeter;
xOffset = -(bounds.Width + sprite.Offset.X) / 2f;
countL++;
}
else
{
@@ -86,8 +91,9 @@ public sealed class StatusIconOverlay : Overlay
accOffsetR += texture.Height;
yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) accOffsetR / EyeManager.PixelsPerMeter;
xOffset = (bounds.Width + sprite.Offset.X) / 2f - (float) texture.Width / EyeManager.PixelsPerMeter;
countR++;
}
count++;
var position = new Vector2(xOffset, yOffset);
handle.DrawTexture(texture, position);