From 299b13f21b91166fa0db6a4dd97578a03a1ef966 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sun, 8 Dec 2024 02:46:41 +0100 Subject: [PATCH] Give silicons proper lobby/character editor previews (#33763) * Give silicons proper lobby/character editor previews No more naked dummies, properly show a borg/AI sprite now. This means taking the JobEntity into account when spawning the dummy. For AIs I had to add a "JobPreviewEntity" field because they'd look like a posibrain otherwise. AI therefore uses a custom dummy entity I defined. Also I had to add some margins to the UI, because otherwise the 32x32 sprite of the AI would look bad. * Update Content.Shared/Roles/JobPrototype.cs * Update Content.Client/Lobby/LobbyUIController.cs * Update Resources/Prototypes/Entities/Mobs/Player/silicon.yml --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- Content.Client/Lobby/LobbyUIController.cs | 19 +++++++++++++++++-- .../Lobby/UI/CharacterPickerButton.xaml | 1 + .../Lobby/UI/HumanoidProfileEditor.xaml | 2 +- Content.Shared/Roles/JobPrototype.cs | 7 +++++++ .../Entities/Mobs/Player/silicon.yml | 13 ++++++++++++- .../Prototypes/Roles/Jobs/Science/borg.yml | 1 + 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Content.Client/Lobby/LobbyUIController.cs b/Content.Client/Lobby/LobbyUIController.cs index 50a25519988616..56dc9d6d412326 100644 --- a/Content.Client/Lobby/LobbyUIController.cs +++ b/Content.Client/Lobby/LobbyUIController.cs @@ -455,7 +455,21 @@ public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, JobProtot { EntityUid dummyEnt; - if (humanoid is not null) + EntProtoId? previewEntity = null; + if (humanoid != null && jobClothes) + { + job ??= GetPreferredJob(humanoid); + + previewEntity = job.JobPreviewEntity ?? (EntProtoId?)job?.JobEntity; + } + + if (previewEntity != null) + { + // Special type like borg or AI, do not spawn a human just spawn the entity. + dummyEnt = EntityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace); + return dummyEnt; + } + else if (humanoid is not null) { var dummy = _prototypeManager.Index(humanoid.Species).DollPrototype; dummyEnt = EntityManager.SpawnEntity(dummy, MapCoordinates.Nullspace); @@ -469,7 +483,8 @@ public EntityUid LoadProfileEntity(HumanoidCharacterProfile? humanoid, JobProtot if (humanoid != null && jobClothes) { - job ??= GetPreferredJob(humanoid); + DebugTools.Assert(job != null); + GiveDummyJobClothes(dummyEnt, humanoid, job); if (_prototypeManager.HasIndex(LoadoutSystem.GetJobPrototype(job.ID))) diff --git a/Content.Client/Lobby/UI/CharacterPickerButton.xaml b/Content.Client/Lobby/UI/CharacterPickerButton.xaml index af1e640aadb652..2edfd19a24e8a3 100644 --- a/Content.Client/Lobby/UI/CharacterPickerButton.xaml +++ b/Content.Client/Lobby/UI/CharacterPickerButton.xaml @@ -6,6 +6,7 @@ SeparationOverride="0" Name="InternalHBox">