From 8c10ac94ec82e84b1b7932c8295a6a90889d7ce9 Mon Sep 17 00:00:00 2001 From: LankLTE <135308300+LankLTE@users.noreply.github.com> Date: Sun, 22 Oct 2023 19:14:37 -0700 Subject: [PATCH] Cherrypicked https://github.com/cosmatic-drift-14/cosmatic-drift/pull/1 --- .../Humanoid/HumanoidAppearanceSystem.cs | 10 + .../Preferences/UI/HumanoidProfileEditor.xaml | 7 + .../UI/HumanoidProfileEditor.xaml.cs | 55 + .../Tests/Preferences/ServerDbSqliteTests.cs | 1 + .../20230711102742_Height.Designer.cs | 1368 +++++++++++++++++ .../Postgres/20230711102742_Height.cs | 29 + .../PostgresServerDbContextModelSnapshot.cs | 4 + .../Sqlite/20230711102028_Height.Designer.cs | 1300 ++++++++++++++++ .../Sqlite/20230711102028_Height.cs | 29 + .../SqliteServerDbContextModelSnapshot.cs | 4 + Content.Server.Database/Model.cs | 1 + Content.Server/Database/ServerDbBase.cs | 2 + .../Systems/HumanoidAppearanceSystem.cs | 1 + .../Humanoid/HumanoidAppearanceComponent.cs | 6 + .../Humanoid/Prototypes/SpeciesPrototype.cs | 36 + .../SharedHumanoidAppearanceSystem.cs | 2 + .../Preferences/HumanoidCharacterProfile.cs | 27 +- .../ui/humanoid-profile-editor.ftl | 2 + .../Entities/Mobs/Species/dwarf.yml | 4 - Resources/Prototypes/Species/dwarf.yml | 5 + 20 files changed, 2886 insertions(+), 7 deletions(-) create mode 100644 Content.Server.Database/Migrations/Postgres/20230711102742_Height.Designer.cs create mode 100644 Content.Server.Database/Migrations/Postgres/20230711102742_Height.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230711102028_Height.Designer.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230711102028_Height.cs diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 5bae35da5ba..f0b30601176 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -1,8 +1,10 @@ +using System.Numerics; using Content.Shared.Humanoid; using Content.Shared.Humanoid.Markings; using Content.Shared.Humanoid.Prototypes; using Content.Shared.Preferences; using Robust.Client.GameObjects; +using Robust.Client.Console; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -12,6 +14,8 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly MarkingManager _markingManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly IClientConsoleHost _consoleHost = default!; public override void Initialize() { @@ -30,6 +34,11 @@ private void UpdateSprite(HumanoidAppearanceComponent component, SpriteComponent UpdateLayers(component, sprite); ApplyMarkingSet(component, sprite); + var speciesPrototype = _prototypeManager.Index(component.Species); + var height = Math.Clamp(MathF.Round(component.Height, 1), speciesPrototype.MinHeight, speciesPrototype.MaxHeight); // should NOT be locked, at all + + sprite.Scale = new Vector2(speciesPrototype.ScaleHeight ? height : 1f, height); + sprite[sprite.LayerMapReserveBlank(HumanoidVisualLayers.Eyes)].Color = component.EyeColor; } @@ -194,6 +203,7 @@ public override void LoadProfile(EntityUid uid, HumanoidCharacterProfile profile humanoid.Species = profile.Species; humanoid.SkinColor = profile.Appearance.SkinColor; humanoid.EyeColor = profile.Appearance.EyeColor; + humanoid.Height = profile.Height; UpdateSprite(humanoid, Comp(uid)); } diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index d0dd02a58ad..d25cfb6b815 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -102,6 +102,13 @@