Fix zombie eye appearance (#19427)

This commit is contained in:
Doru991
2023-08-23 07:51:59 +03:00
committed by GitHub
parent f8bdfd6d26
commit ecd145b274
3 changed files with 16 additions and 2 deletions

View File

@@ -133,12 +133,15 @@ namespace Content.Server.Zombies
{
//store some values before changing them in case the humanoid get cloned later
zombiecomp.BeforeZombifiedSkinColor = huApComp.SkinColor;
zombiecomp.BeforeZombifiedEyeColor = huApComp.EyeColor;
zombiecomp.BeforeZombifiedCustomBaseLayers = new(huApComp.CustomBaseLayers);
if (TryComp<BloodstreamComponent>(target, out var stream))
zombiecomp.BeforeZombifiedBloodReagent = stream.BloodReagent;
_humanoidAppearance.SetSkinColor(target, zombiecomp.SkinColor, verify: false, humanoid: huApComp);
_humanoidAppearance.SetBaseLayerColor(target, HumanoidVisualLayers.Eyes, zombiecomp.EyeColor, humanoid: huApComp);
// Messing with the eye layer made it vanish upon cloning, and also it didn't even appear right
huApComp.EyeColor = zombiecomp.EyeColor;
// this might not resync on clone?
_humanoidAppearance.SetBaseLayerId(target, HumanoidVisualLayers.Tail, zombiecomp.BaseLayerExternal, humanoid: huApComp);

View File

@@ -20,6 +20,7 @@ using Content.Shared.Zombies;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Content.Shared.Humanoid;
namespace Content.Server.Zombies
{
@@ -256,7 +257,11 @@ namespace Content.Server.Zombies
_humanoidAppearance.SetBaseLayerColor(target, layer, info.Color);
_humanoidAppearance.SetBaseLayerId(target, layer, info.ID);
}
_humanoidAppearance.SetSkinColor(target, zombiecomp.BeforeZombifiedSkinColor);
if(TryComp<HumanoidAppearanceComponent>(target, out var appcomp))
{
appcomp.EyeColor = zombiecomp.BeforeZombifiedEyeColor;
}
_humanoidAppearance.SetSkinColor(target, zombiecomp.BeforeZombifiedSkinColor, false);
_bloodstream.ChangeBloodReagent(target, zombiecomp.BeforeZombifiedBloodReagent);
_metaData.SetEntityName(target, zombiecomp.BeforeZombifiedEntityName);

View File

@@ -80,6 +80,12 @@ public sealed partial class ZombieComponent : Component
[DataField("beforeZombifiedSkinColor")]
public Color BeforeZombifiedSkinColor;
/// <summary>
/// The eye color of the humanoid to restore in case of cloning
/// </summary>
[DataField("beforeZombifiedEyeColor")]
public Color BeforeZombifiedEyeColor;
[DataField("emoteId", customTypeSerializer: typeof(PrototypeIdSerializer<EmoteSoundsPrototype>))]
public string? EmoteSoundsId = "Zombie";