From d0ea3876611b7b76beefe2f11145b1928fa9e3c6 Mon Sep 17 00:00:00 2001 From: gluesniffler <159397573+gluesniffler@users.noreply.github.com> Date: Tue, 31 Dec 2024 23:33:47 -0400 Subject: [PATCH] Fixes Broken Heights/Widths (#1390) # Description I broke some things # Changelog :cl: Mocho - fix: Fixed heights/widths being broken due to the shitmed patch. --- Content.Client/Humanoid/HumanoidAppearanceSystem.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 0416f4b8139..c7bd719f523 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -1,3 +1,4 @@ +using System.Numerics; using Content.Shared.Humanoid; using Content.Shared.Humanoid.Markings; using Content.Shared.Humanoid.Prototypes; @@ -30,6 +31,15 @@ private void UpdateSprite(HumanoidAppearanceComponent component, SpriteComponent UpdateLayers(component, sprite); ApplyMarkingSet(component, sprite); + var speciesPrototype = _prototypeManager.Index(component.Species); + + var height = Math.Clamp(component.Height, speciesPrototype.MinHeight, speciesPrototype.MaxHeight); + var width = Math.Clamp(component.Width, speciesPrototype.MinWidth, speciesPrototype.MaxWidth); + component.Height = height; + component.Width = width; + + sprite.Scale = new Vector2(width, height); + sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = component.EyeColor; } @@ -199,6 +209,8 @@ public override void LoadProfile(EntityUid uid, HumanoidCharacterProfile? profil humanoid.Species = profile.Species; humanoid.SkinColor = profile.Appearance.SkinColor; humanoid.EyeColor = profile.Appearance.EyeColor; + humanoid.Height = profile.Height; + humanoid.Width = profile.Width; UpdateSprite(humanoid, Comp(uid)); }