Move CloneAppearance to Shared (#35017)
* Move CloneAppearance - Move CloneAppearance from HumanoidAppearanceSystem to SharedHumanoidAppearanceSystem * CR - Fix the sins of the past
This commit is contained in:
@@ -20,40 +20,6 @@ public sealed partial class HumanoidAppearanceSystem : SharedHumanoidAppearanceS
|
||||
SubscribeLocalEvent<HumanoidAppearanceComponent, GetVerbsEvent<Verb>>(OnVerbsRequest);
|
||||
}
|
||||
|
||||
// this was done enough times that it only made sense to do it here
|
||||
|
||||
/// <summary>
|
||||
/// Clones a humanoid's appearance to a target mob, provided they both have humanoid components.
|
||||
/// </summary>
|
||||
/// <param name="source">Source entity to fetch the original appearance from.</param>
|
||||
/// <param name="target">Target entity to apply the source entity's appearance to.</param>
|
||||
/// <param name="sourceHumanoid">Source entity's humanoid component.</param>
|
||||
/// <param name="targetHumanoid">Target entity's humanoid component.</param>
|
||||
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<GrammarComponent>(target, out var grammar))
|
||||
{
|
||||
grammar.Gender = sourceHumanoid.Gender;
|
||||
}
|
||||
|
||||
Dirty(target, targetHumanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a marking from a humanoid by ID.
|
||||
/// </summary>
|
||||
|
||||
@@ -132,6 +132,34 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem
|
||||
Dirty(uid, humanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clones a humanoid's appearance to a target mob, provided they both have humanoid components.
|
||||
/// </summary>
|
||||
/// <param name="source">Source entity to fetch the original appearance from.</param>
|
||||
/// <param name="target">Target entity to apply the source entity's appearance to.</param>
|
||||
/// <param name="sourceHumanoid">Source entity's humanoid component.</param>
|
||||
/// <param name="targetHumanoid">Target entity's humanoid component.</param>
|
||||
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<GrammarComponent>(target, out var grammar))
|
||||
grammar.Gender = sourceHumanoid.Gender;
|
||||
|
||||
Dirty(target, targetHumanoid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the visibility for multiple layers at once on a humanoid's sprite.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user