try
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
using Content.Shared.DisplacementMap;
|
||||
|
||||
namespace Content.Client._CP14.Displacement;
|
||||
|
||||
/// <summary>
|
||||
/// Simply apply displacements to sprite layers
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed partial class CP14SimpleDisplacementMapComponent : Component
|
||||
{
|
||||
[DataField]
|
||||
public Dictionary<string, DisplacementData> Displacements = new();
|
||||
|
||||
public readonly HashSet<string> RevealedLayers = new();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using Content.Client.DisplacementMap;
|
||||
using Content.Shared.Item;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client._CP14.Displacement;
|
||||
|
||||
public sealed class CP14SimpleDisplacementMapSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DisplacementMapSystem _displacement = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CP14SimpleDisplacementMapComponent, VisualsChangedEvent>(OnVisualChanged);
|
||||
}
|
||||
|
||||
private void OnVisualChanged(Entity<CP14SimpleDisplacementMapComponent> ent, ref VisualsChangedEvent args)
|
||||
{
|
||||
if (!TryComp<SpriteComponent>(ent, out var sprite))
|
||||
return;
|
||||
|
||||
foreach (var key in ent.Comp.RevealedLayers)
|
||||
{
|
||||
sprite.RemoveLayer(key);
|
||||
}
|
||||
ent.Comp.RevealedLayers.Clear();
|
||||
|
||||
foreach (var (key, dData) in ent.Comp.Displacements)
|
||||
{
|
||||
if (!sprite.LayerMapTryGet(key, out var index))
|
||||
continue;
|
||||
|
||||
_displacement.TryAddDisplacement(dData, sprite, index, key, ent.Comp.RevealedLayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ namespace Content.Server.Entry
|
||||
public static class IgnoredComponents
|
||||
{
|
||||
public static string[] List => new[] {
|
||||
"CP14WaveShader", // CP14 Wave shader
|
||||
"CP14WorldSprite", // CP14 World Sprite
|
||||
"CP14WaveShader", // CP14
|
||||
"CP14SimpleDisplacementMap", // CP14
|
||||
"ConstructionGhost",
|
||||
"IconSmooth",
|
||||
"InteractionOutline",
|
||||
|
||||
@@ -4,6 +4,54 @@
|
||||
name: Mr. Goblin
|
||||
abstract: true
|
||||
components:
|
||||
- type: Sprite
|
||||
layers:
|
||||
- map: [ "enum.HumanoidVisualLayers.Chest" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.Head" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.Snout" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.Eyes" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.RArm" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.LArm" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.RLeg" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.LLeg" ]
|
||||
- shader: StencilClear
|
||||
sprite: _CP14/Mobs/Species/Human/parts.rsi
|
||||
state: l_leg
|
||||
- shader: StencilMask
|
||||
map: [ "enum.HumanoidVisualLayers.StencilMask" ]
|
||||
sprite: Mobs/Customization/masking_helpers.rsi
|
||||
state: unisex_full
|
||||
visible: false
|
||||
- map: [ "enum.HumanoidVisualLayers.LFoot" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.RFoot" ]
|
||||
- map: [ "pants" ]
|
||||
- map: [ "shoes" ]
|
||||
- map: [ "shirt" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.LHand" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.RHand" ]
|
||||
- map: [ "gloves" ]
|
||||
- map: [ "ears" ]
|
||||
- map: [ "outerClothing" ]
|
||||
- map: [ "cloak" ]
|
||||
- map: [ "eyes" ]
|
||||
- map: [ "belt1" ]
|
||||
- map: [ "belt2" ]
|
||||
- map: [ "neck" ]
|
||||
- map: [ "back" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.FacialHair" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.Hair", "HairDisplacement" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.HeadSide" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.HeadTop" ]
|
||||
- map: [ "enum.HumanoidVisualLayers.Tail" ]
|
||||
- map: [ "mask" ]
|
||||
- map: [ "head" ]
|
||||
- map: [ "pocket1" ]
|
||||
- map: [ "pocket2" ]
|
||||
- map: ["enum.HumanoidVisualLayers.Handcuffs"]
|
||||
color: "#ffffff"
|
||||
sprite: Objects/Misc/handcuffs.rsi
|
||||
state: body-overlay-2
|
||||
visible: false
|
||||
- type: HumanoidAppearance
|
||||
species: CP14Goblin
|
||||
- type: Hunger
|
||||
@@ -73,6 +121,16 @@
|
||||
32:
|
||||
sprite: _CP14/Mobs/Species/Goblin/displacement.rsi
|
||||
state: hands
|
||||
- type: CP14SimpleDisplacementMap
|
||||
displacements:
|
||||
HairDisplacement:
|
||||
sizeMaps:
|
||||
32:
|
||||
sprite: _CP14/Mobs/Species/Goblin/displacement.rsi
|
||||
state: head
|
||||
48:
|
||||
sprite: _CP14/Mobs/Species/Goblin/displacement48.rsi
|
||||
state: head
|
||||
- type: Inventory
|
||||
templateId: CP14Human
|
||||
speciesId: goblin
|
||||
|
||||
Reference in New Issue
Block a user