From 8b46538e3f98498700928fd08ac6227d5c2aba9a Mon Sep 17 00:00:00 2001 From: Zachary Higgs Date: Sun, 9 Feb 2025 23:13:27 -0400 Subject: [PATCH] Move CloneAppearance to Shared (#35017) * Move CloneAppearance - Move CloneAppearance from HumanoidAppearanceSystem to SharedHumanoidAppearanceSystem * CR - Fix the sins of the past --- .../Systems/HumanoidAppearanceSystem.cs | 34 ------------------- .../SharedHumanoidAppearanceSystem.cs | 28 +++++++++++++++ 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs index 505ad4f16c..9e719bda66 100644 --- a/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs +++ b/Content.Server/Humanoid/Systems/HumanoidAppearanceSystem.cs @@ -20,40 +20,6 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS SubscribeLocalEvent>(OnVerbsRequest); } - // this was done enough times that it only made sense to do it here - - /// - /// Clones a humanoid's appearance to a target mob, provided they both have humanoid components. - /// - /// Source entity to fetch the original appearance from. - /// Target entity to apply the source entity's appearance to. - /// Source entity's humanoid component. - /// Target entity's humanoid component. - public void CloneAppearance(EntityUid source, EntityUid target, HumanoidAppearanceComponent? sourceHumanoid = null, - HumanoidAppearanceComponent? targetHumanoid = null) - { - if (!Resolve(source, ref sourceHumanoid) || !Resolve(target, ref targetHumanoid)) - { - return; - } - - targetHumanoid.Species = sourceHumanoid.Species; - targetHumanoid.SkinColor = sourceHumanoid.SkinColor; - targetHumanoid.EyeColor = sourceHumanoid.EyeColor; - targetHumanoid.Age = sourceHumanoid.Age; - SetSex(target, sourceHumanoid.Sex, false, targetHumanoid); - targetHumanoid.CustomBaseLayers = new(sourceHumanoid.CustomBaseLayers); - targetHumanoid.MarkingSet = new(sourceHumanoid.MarkingSet); - - targetHumanoid.Gender = sourceHumanoid.Gender; - if (TryComp(target, out var grammar)) - { - grammar.Gender = sourceHumanoid.Gender; - } - - Dirty(target, targetHumanoid); - } - /// /// Removes a marking from a humanoid by ID. /// diff --git a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs index 64c60436f6..8133ca4c98 100644 --- a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs @@ -132,6 +132,34 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem Dirty(uid, humanoid); } + /// + /// Clones a humanoid's appearance to a target mob, provided they both have humanoid components. + /// + /// Source entity to fetch the original appearance from. + /// Target entity to apply the source entity's appearance to. + /// Source entity's humanoid component. + /// Target entity's humanoid component. + public void CloneAppearance(EntityUid source, EntityUid target, HumanoidAppearanceComponent? sourceHumanoid = null, + HumanoidAppearanceComponent? targetHumanoid = null) + { + if (!Resolve(source, ref sourceHumanoid) || !Resolve(target, ref targetHumanoid)) + return; + + targetHumanoid.Species = sourceHumanoid.Species; + targetHumanoid.SkinColor = sourceHumanoid.SkinColor; + targetHumanoid.EyeColor = sourceHumanoid.EyeColor; + targetHumanoid.Age = sourceHumanoid.Age; + SetSex(target, sourceHumanoid.Sex, false, targetHumanoid); + targetHumanoid.CustomBaseLayers = new(sourceHumanoid.CustomBaseLayers); + targetHumanoid.MarkingSet = new(sourceHumanoid.MarkingSet); + + targetHumanoid.Gender = sourceHumanoid.Gender; + if (TryComp(target, out var grammar)) + grammar.Gender = sourceHumanoid.Gender; + + Dirty(target, targetHumanoid); + } + /// /// Sets the visibility for multiple layers at once on a humanoid's sprite. ///