Implement female uniform masking.
This commit is contained in:
@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.GameObjects.Components.Items;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Clothing
|
||||
@@ -12,6 +13,7 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
[ComponentReference(typeof(ItemComponent))]
|
||||
public class ClothingComponent : ItemComponent
|
||||
{
|
||||
private FemaleClothingMask _femaleMask;
|
||||
public override string Name => "Clothing";
|
||||
public override uint? NetID => ContentNetIDs.CLOTHING;
|
||||
public override Type StateType => typeof(ClothingComponentState);
|
||||
@@ -19,6 +21,20 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string ClothingEquippedPrefix { get; set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FemaleClothingMask FemaleMask
|
||||
{
|
||||
get => _femaleMask;
|
||||
set => _femaleMask = value;
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _femaleMask, "femaleMask", FemaleClothingMask.UniformFull);
|
||||
}
|
||||
|
||||
public (RSI rsi, RSI.StateId stateId)? GetEquippedStateInfo(EquipmentSlotDefines.SlotFlags slot)
|
||||
{
|
||||
if (RsiPath == null)
|
||||
@@ -47,4 +63,11 @@ namespace Content.Client.GameObjects.Components.Clothing
|
||||
EquippedPrefix = clothingComponentState.EquippedPrefix;
|
||||
}
|
||||
}
|
||||
|
||||
public enum FemaleClothingMask
|
||||
{
|
||||
NoMask = 0,
|
||||
UniformFull,
|
||||
UniformTop
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Clothing;
|
||||
using Content.Shared.GameObjects;
|
||||
using Content.Shared.Preferences.Appearance;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -14,8 +15,6 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using static Content.Shared.GameObjects.Components.Inventory.EquipmentSlotDefines;
|
||||
using static Content.Shared.GameObjects.SharedInventoryComponent.ClientInventoryMessage;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using System;
|
||||
|
||||
namespace Content.Client.GameObjects
|
||||
{
|
||||
@@ -130,6 +129,17 @@ namespace Content.Client.GameObjects
|
||||
_sprite.LayerSetVisible(slot, true);
|
||||
_sprite.LayerSetRSI(slot, rsi);
|
||||
_sprite.LayerSetState(slot, state);
|
||||
|
||||
if (slot == Slots.INNERCLOTHING)
|
||||
{
|
||||
_sprite.LayerSetState(HumanoidVisualLayers.StencilMask, clothing.FemaleMask switch
|
||||
{
|
||||
FemaleClothingMask.NoMask => "female_none",
|
||||
FemaleClothingMask.UniformTop => "female_top",
|
||||
_ => "female_full",
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ namespace Content.Client.GameObjects.Components.Mobs
|
||||
sprite.LayerSetState(HumanoidVisualLayers.Chest, Sex == Sex.Male ? "human_chest_m" : "human_chest_f");
|
||||
sprite.LayerSetState(HumanoidVisualLayers.Head, Sex == Sex.Male ? "human_head_m" : "human_head_f");
|
||||
|
||||
sprite.LayerSetVisible(HumanoidVisualLayers.StencilMask, Sex == Sex.Female);
|
||||
|
||||
var hairStyle = Appearance.HairStyleName;
|
||||
if (string.IsNullOrWhiteSpace(hairStyle) || !HairStyles.HairStylesMap.ContainsKey(hairStyle))
|
||||
hairStyle = HairStyles.DefaultHairStyle;
|
||||
|
||||
@@ -12,5 +12,6 @@ namespace Content.Shared.Preferences.Appearance
|
||||
LHand,
|
||||
RLeg,
|
||||
LLeg,
|
||||
StencilMask
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
|
||||
- type: Clothing
|
||||
sprite: Clothing/uniform_clown.rsi
|
||||
femaleMask: UniformTop
|
||||
|
||||
- type: entity
|
||||
parent: UniformBase
|
||||
|
||||
@@ -17,7 +17,14 @@
|
||||
description: A bright red toolbox, stocked with emergency tools
|
||||
components:
|
||||
- type: Sprite
|
||||
texture: Objects/Tools/toolbox_r.png
|
||||
layers:
|
||||
- shader: stencilClear
|
||||
- texture: Objects/Tools/wrench.png
|
||||
shader: stencilMask
|
||||
|
||||
- texture: Objects/Tools/toolbox_r.png
|
||||
shader: stencilDraw
|
||||
|
||||
- type: Icon
|
||||
texture: Objects/Tools/toolbox_r.png
|
||||
|
||||
|
||||
@@ -58,7 +58,18 @@
|
||||
sprite: Mob/human.rsi
|
||||
state: human_l_leg
|
||||
|
||||
- shader: stencilClear
|
||||
sprite: Mob/human.rsi
|
||||
state: human_l_leg
|
||||
- shader: stencilMask
|
||||
map: ["enum.HumanoidVisualLayers.StencilMask"]
|
||||
sprite: Mob/masking_helpers.rsi
|
||||
state: female_full
|
||||
visible: false
|
||||
|
||||
- map: ["enum.Slots.INNERCLOTHING"]
|
||||
shader: stencilDraw
|
||||
|
||||
- map: ["enum.Slots.IDCARD"]
|
||||
- map: ["enum.Slots.GLOVES"]
|
||||
- map: ["enum.Slots.SHOES"]
|
||||
@@ -174,7 +185,16 @@
|
||||
sprite: Mob/human.rsi
|
||||
state: human_l_leg
|
||||
|
||||
- shader: stencilClear
|
||||
- shader: stencilMask
|
||||
map: ["enum.HumanoidVisualLayers.StencilMask"]
|
||||
sprite: Mob/masking_helpers.rsi
|
||||
state: female_full
|
||||
visible: false
|
||||
|
||||
- map: ["enum.Slots.INNERCLOTHING"]
|
||||
shader: stencilDraw
|
||||
|
||||
- map: ["enum.Slots.IDCARD"]
|
||||
- map: ["enum.Slots.GLOVES"]
|
||||
- map: ["enum.Slots.SHOES"]
|
||||
|
||||
25
Resources/Prototypes/Shaders/Stencils.yml
Normal file
25
Resources/Prototypes/Shaders/Stencils.yml
Normal file
@@ -0,0 +1,25 @@
|
||||
- type: shader
|
||||
id: stencilClear
|
||||
kind: source
|
||||
path: "/Shaders/stencilclear.swsl"
|
||||
stencil:
|
||||
ref: 0
|
||||
op: Replace
|
||||
func: Always
|
||||
|
||||
- type: shader
|
||||
id: stencilMask
|
||||
kind: source
|
||||
path: "/Shaders/stencilmask.swsl"
|
||||
stencil:
|
||||
ref: 1
|
||||
op: Replace
|
||||
func: Always
|
||||
|
||||
- type: shader
|
||||
id: stencilDraw
|
||||
kind: canvas
|
||||
stencil:
|
||||
ref: 1
|
||||
op: Keep
|
||||
func: NotEqual
|
||||
3
Resources/Shaders/stencilclear.swsl
Normal file
3
Resources/Shaders/stencilclear.swsl
Normal file
@@ -0,0 +1,3 @@
|
||||
void fragment() {
|
||||
COLOR = vec4(0);
|
||||
}
|
||||
7
Resources/Shaders/stencilmask.swsl
Normal file
7
Resources/Shaders/stencilmask.swsl
Normal file
@@ -0,0 +1,7 @@
|
||||
void fragment() {
|
||||
if (texture(TEXTURE, UV).a == 0) {
|
||||
discard; // Discard if no alpha so that there's a hole in the stencil buffer.
|
||||
}
|
||||
|
||||
COLOR = vec4(0);
|
||||
}
|
||||
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_full.png
Normal file
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_full.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 134 B |
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_none.png
Normal file
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_none.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 83 B |
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_top.png
Normal file
BIN
Resources/Textures/Mob/masking_helpers.rsi/female_top.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 130 B |
1
Resources/Textures/Mob/masking_helpers.rsi/meta.json
Normal file
1
Resources/Textures/Mob/masking_helpers.rsi/meta.json
Normal file
@@ -0,0 +1 @@
|
||||
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "female_full", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}, {"name": "female_top", "directions": 4, "delays": [[1.0], [1.0], [1.0], [1.0]]}]}
|
||||
Reference in New Issue
Block a user