From 83e9a8821c9f58ca14b234b4e4582505a261b884 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 13 Jun 2024 19:15:49 -0400 Subject: [PATCH 01/25] Start port --- .../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 | 4 + .../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, 2884 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 9a70d678310..b5894d83fcc 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -108,6 +108,13 @@