Switch to TG hair sprites.
This removes the need for a separate shader because they're multiply-based instead of additive like /vg/ or Bay.
This commit is contained in:
@@ -1,48 +1,18 @@
|
||||
using Content.Shared.GameObjects.Components.Mobs;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics.Shaders;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class HairComponent : SharedHairComponent
|
||||
{
|
||||
private const string HairShaderName = "hair";
|
||||
private const string HairColorParameter = "hairColor";
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
private ShaderInstance _facialHairShader;
|
||||
private ShaderInstance _hairShader;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var shaderProto = _prototypeManager.Index<ShaderPrototype>(HairShaderName);
|
||||
|
||||
_facialHairShader = shaderProto.InstanceUnique();
|
||||
_hairShader = shaderProto.InstanceUnique();
|
||||
}
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
if (Owner.TryGetComponent(out ISpriteComponent sprite))
|
||||
{
|
||||
sprite.LayerSetShader(HumanoidVisualLayers.Hair, _hairShader);
|
||||
sprite.LayerSetShader(HumanoidVisualLayers.FacialHair, _facialHairShader);
|
||||
}
|
||||
|
||||
UpdateHairStyle();
|
||||
}
|
||||
|
||||
@@ -90,8 +60,8 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
{
|
||||
var sprite = Owner.GetComponent<SpriteComponent>();
|
||||
|
||||
_hairShader?.SetParameter(HairColorParameter, HairColor);
|
||||
_facialHairShader?.SetParameter(HairColorParameter, FacialHairColor);
|
||||
sprite.LayerSetColor(HumanoidVisualLayers.Hair, HairColor);
|
||||
sprite.LayerSetColor(HumanoidVisualLayers.FacialHair, FacialHairColor);
|
||||
|
||||
sprite.LayerSetState(HumanoidVisualLayers.Hair,
|
||||
HairStyles.HairStylesMap[HairStyleName ?? HairStyles.DefaultHairStyle]);
|
||||
|
||||
Reference in New Issue
Block a user