From efeb93b74e188c5a79b8ebf53e7e1cf2e1fcb073 Mon Sep 17 00:00:00 2001 From: VMSolidus Date: Thu, 27 Jun 2024 13:46:50 -0400 Subject: [PATCH] Port Height Sliders (#458) --- .../Humanoid/HumanoidAppearanceSystem.cs | 12 + .../Preferences/UI/HumanoidProfileEditor.xaml | 16 + .../UI/HumanoidProfileEditor.xaml.cs | 148 ++ .../Tests/Preferences/ServerDbSqliteTests.cs | 2 + .../20240127102028_Height.Designer.cs | 1372 +++++++++++++++++ .../Postgres/20240127102028_Height.cs | 40 + .../PostgresServerDbContextModelSnapshot.cs | 10 + .../Sqlite/20240127102028_Height.Designer.cs | 1304 ++++++++++++++++ .../Sqlite/20240127102028_Height.cs | 40 + .../SqliteServerDbContextModelSnapshot.cs | 10 + Content.Server.Database/Model.cs | 2 + Content.Server/Database/ServerDbBase.cs | 4 + .../Systems/HumanoidAppearanceSystem.cs | 2 + Content.Shared/CCVar/CCVars.cs | 12 + .../HeightAdjust/HeightAdjustSystem.cs | 80 + .../Humanoid/HumanoidAppearanceComponent.cs | 12 + .../Humanoid/Prototypes/SpeciesPrototype.cs | 48 + .../SharedHumanoidAppearanceSystem.cs | 63 + .../Preferences/HumanoidCharacterProfile.cs | 65 +- .../ui/humanoid-profile-editor.ftl | 3 + Resources/Prototypes/DeltaV/Species/harpy.yml | 6 + .../Entities/Mobs/Species/dwarf.yml | 4 - .../Nyanotrasen/Entities/Mobs/Species/Oni.yml | 2 +- .../Entities/Mobs/Species/felinid.yml | 1 + .../Prototypes/Nyanotrasen/Species/Oni.yml | 6 + .../Nyanotrasen/Species/felinid.yml | 6 + .../humanoidProfiles/felinid.yml | 6 + .../SimpleStation14/humanoidProfiles/oni.yml | 6 + Resources/Prototypes/Species/dwarf.yml | 6 + Resources/Prototypes/Species/reptilian.yml | 6 + 30 files changed, 3279 insertions(+), 15 deletions(-) create mode 100644 Content.Server.Database/Migrations/Postgres/20240127102028_Height.Designer.cs create mode 100644 Content.Server.Database/Migrations/Postgres/20240127102028_Height.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20240127102028_Height.Designer.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20240127102028_Height.cs create mode 100644 Content.Shared/HeightAdjust/HeightAdjustSystem.cs create mode 100644 Resources/Prototypes/SimpleStation14/humanoidProfiles/felinid.yml create mode 100644 Resources/Prototypes/SimpleStation14/humanoidProfiles/oni.yml diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 5bae35da5b..8087d1833e 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 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem 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; } @@ -194,6 +204,8 @@ public sealed class HumanoidAppearanceSystem : SharedHumanoidAppearanceSystem 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)); } diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml index 38d4a411ff..e34eb41ef9 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -108,6 +108,22 @@