From 9948d1d6256660538a6f31183b2e2bd058361b84 Mon Sep 17 00:00:00 2001 From: revsys413 Date: Wed, 3 Apr 2024 21:46:10 -0700 Subject: [PATCH] Adds CD records, height slider --- .../UI/Tabs/AdminTab/AdminTab.xaml | 3 + .../Humanoid/HumanoidAppearanceSystem.cs | 10 + .../Preferences/UI/HumanoidProfileEditor.xaml | 8 + .../UI/HumanoidProfileEditor.xaml.cs | 91 + .../_CD/Admin/UI/ModifyCharacterRecords.xaml | 14 + .../Admin/UI/ModifyCharacterRecords.xaml.cs | 48 + ...haracterRecordConsoleBoundUserInterface.cs | 82 + .../_CD/Records/UI/CharacterRecordViewer.xaml | 117 ++ .../Records/UI/CharacterRecordViewer.xaml.cs | 361 ++++ .../Records/UI/RecordEditorEntrySelector.xaml | 14 + .../UI/RecordEditorEntrySelector.xaml.cs | 136 ++ .../_CD/Records/UI/RecordEditorGui.xaml | 68 + .../_CD/Records/UI/RecordEditorGui.xaml.cs | 155 ++ .../_CD/Records/UI/RecordEntryEditPopup.xaml | 13 + .../Records/UI/RecordEntryEditPopup.xaml.cs | 38 + .../_CD/Records/UI/RecordEntryViewPopup.xaml | 19 + .../Records/UI/RecordEntryViewPopup.xaml.cs | 34 + .../_CD/Records/UI/RecordLongItemDisplay.cs | 65 + .../_CD/Records/UI/UnitConversion.cs | 16 + .../Tests/Preferences/ServerDbSqliteTests.cs | 6 +- .../20230711102742_Height.Designer.cs | 1368 +++++++++++++ .../Postgres/20230711102742_Height.cs | 29 + ...40119204209_CDCharacterRecords.Designer.cs | 1764 +++++++++++++++++ .../20240119204209_CDCharacterRecords.cs | 29 + .../PostgresServerDbContextModelSnapshot.cs | 8 + .../Sqlite/20230711102028_Height.Designer.cs | 1300 ++++++++++++ .../Sqlite/20230711102028_Height.cs | 29 + ...40119204158_CDCharacterRecords.Designer.cs | 1696 ++++++++++++++++ .../20240119204158_CDCharacterRecords.cs | 28 + .../SqliteServerDbContextModelSnapshot.cs | 8 + Content.Server.Database/Model.cs | 5 + Content.Server.Database/ModelSqlite.cs | 5 + .../Administration/Systems/AdminSystem.cs | 9 + .../Systems/CriminalRecordsConsoleSystem.cs | 16 + Content.Server/Database/ServerDbBase.cs | 17 +- .../Systems/HumanoidAppearanceSystem.cs | 1 + .../_CD/CryoSleep/CryoSleepSystem.cs | 261 +++ .../CharacterRecordKeyStorageComponent.cs | 17 + .../_CD/Records/CharacterRecordsComponent.cs | 31 + .../_CD/Records/CharacterRecordsSystem.cs | 176 ++ .../Records/Commands/DelRecordEntryCommand.cs | 55 + .../Commands/PurgeCharacterRecordsCommand.cs | 42 + .../CharacterRecordConsoleComponent.cs | 17 + .../Consoles/CharacterRecordConsoleSystem.cs | 151 ++ .../_CD/Records/RecordsSerialization.cs | 92 + .../Humanoid/HumanoidAppearanceComponent.cs | 6 + .../Humanoid/Prototypes/SpeciesPrototype.cs | 44 +- .../SharedHumanoidAppearanceSystem.cs | 2 + .../Preferences/HumanoidCharacterProfile.cs | 61 +- .../_CD/Records/CharacterRecords.cs | 252 +++ .../_CD/Records/FullCharacterRecords.cs | 109 + .../Records/SharedCharacterRecordConsole.cs | 73 + Resources/Locale/en-US/_CD/admin/admin.ftl | 4 + .../Locale/en-US/_CD/guidebook/guides.ftl | 1 + .../Locale/en-US/_CD/records/corrections.ftl | 5 + Resources/Locale/en-US/_CD/records/editor.ftl | 36 + Resources/Locale/en-US/_CD/records/viewer.ftl | 26 + .../ui/humanoid-profile-editor.ftl | 2 + .../Entities/Mobs/Player/admin_ghost.yml | 24 +- .../Entities/Mobs/Species/dwarf.yml | 4 - .../Machines/Computers/computers.yml | 50 +- Resources/Prototypes/Guidebook/ss14.yml | 10 + Resources/Prototypes/Species/dwarf.yml | 5 + .../ServerInfo/Guidebook/_CD/Records.xml | 40 + 64 files changed, 9164 insertions(+), 42 deletions(-) create mode 100644 Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml create mode 100644 Content.Client/_CD/Admin/UI/ModifyCharacterRecords.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs create mode 100644 Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml create mode 100644 Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/RecordEditorEntrySelector.xaml create mode 100644 Content.Client/_CD/Records/UI/RecordEditorEntrySelector.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/RecordEditorGui.xaml create mode 100644 Content.Client/_CD/Records/UI/RecordEditorGui.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/RecordEntryEditPopup.xaml create mode 100644 Content.Client/_CD/Records/UI/RecordEntryEditPopup.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/RecordEntryViewPopup.xaml create mode 100644 Content.Client/_CD/Records/UI/RecordEntryViewPopup.xaml.cs create mode 100644 Content.Client/_CD/Records/UI/RecordLongItemDisplay.cs create mode 100644 Content.Client/_CD/Records/UI/UnitConversion.cs 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/Postgres/20240119204209_CDCharacterRecords.Designer.cs create mode 100644 Content.Server.Database/Migrations/Postgres/20240119204209_CDCharacterRecords.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230711102028_Height.Designer.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20230711102028_Height.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20240119204158_CDCharacterRecords.Designer.cs create mode 100644 Content.Server.Database/Migrations/Sqlite/20240119204158_CDCharacterRecords.cs create mode 100644 Content.Server/_CD/CryoSleep/CryoSleepSystem.cs create mode 100644 Content.Server/_CD/Records/CharacterRecordKeyStorageComponent.cs create mode 100644 Content.Server/_CD/Records/CharacterRecordsComponent.cs create mode 100644 Content.Server/_CD/Records/CharacterRecordsSystem.cs create mode 100644 Content.Server/_CD/Records/Commands/DelRecordEntryCommand.cs create mode 100644 Content.Server/_CD/Records/Commands/PurgeCharacterRecordsCommand.cs create mode 100644 Content.Server/_CD/Records/Consoles/CharacterRecordConsoleComponent.cs create mode 100644 Content.Server/_CD/Records/Consoles/CharacterRecordConsoleSystem.cs create mode 100644 Content.Server/_CD/Records/RecordsSerialization.cs create mode 100644 Content.Shared/_CD/Records/CharacterRecords.cs create mode 100644 Content.Shared/_CD/Records/FullCharacterRecords.cs create mode 100644 Content.Shared/_CD/Records/SharedCharacterRecordConsole.cs create mode 100644 Resources/Locale/en-US/_CD/admin/admin.ftl create mode 100644 Resources/Locale/en-US/_CD/guidebook/guides.ftl create mode 100644 Resources/Locale/en-US/_CD/records/corrections.ftl create mode 100644 Resources/Locale/en-US/_CD/records/editor.ftl create mode 100644 Resources/Locale/en-US/_CD/records/viewer.ftl create mode 100644 Resources/ServerInfo/Guidebook/_CD/Records.xml diff --git a/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml b/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml index 8b68487547f..b558d6114ed 100644 --- a/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml +++ b/Content.Client/Administration/UI/Tabs/AdminTab/AdminTab.xaml @@ -3,6 +3,7 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:cc="clr-namespace:Content.Client.Administration.UI.CustomControls" xmlns:at="clr-namespace:Content.Client.Administration.UI.Tabs.AdminTab" + xmlns:cdAdmin="clr-namespace:Content.Client._CD.Admin.UI" Margin="4" MinSize="50 50"> @@ -16,6 +17,8 @@ + + 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..15ce473c6ff 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml @@ -67,6 +67,14 @@ + + +