Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 106 additions & 36 deletions Content.Client/Humanoid/HumanoidAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public void UpdateSprite(Entity<HumanoidAppearanceComponent, SpriteComponent> en
var width = Math.Clamp(humanoidAppearance.Width, speciesPrototype.MinWidth, speciesPrototype.MaxWidth);
humanoidAppearance.Height = height;
humanoidAppearance.Width = width;
// TODO? Floof/pirate port: The pirate port changed these settings, will look into it after some testing.
//I havent noticed much in testing so far? If theres some sizeing issues with tails someone poke me to port the change in this area
//But it looks like a check if info is sent and if it fails then set to min size by default.

_sprite.SetScale((entity, sprite), new Vector2(width, height));
// end Goobstation: port EE height/width sliders
Expand Down Expand Up @@ -337,14 +340,53 @@ private void RemoveMarking(Marking marking, Entity<SpriteComponent> spriteEnt)
_sprite.RemoveLayer(spriteEnt.AsNullable(), index);
}
}
private void ApplyMarking(MarkingPrototype markingPrototype,
private void ApplyMarking(
MarkingPrototype markingPrototype,
IReadOnlyList<Color>? colors,
bool visible,
Entity<HumanoidAppearanceComponent, SpriteComponent> entity)
{
var humanoid = entity.Comp1;
var sprite = entity.Comp2;

//Floof/Pirate PR port Omustation custom layers start
var colorDict = new Dictionary<string, Color>();

for (var i = 0; i < markingPrototype.Sprites.Count; i++)
{
var spriteName = markingPrototype.Sprites[i] switch
{
SpriteSpecifier.Rsi rsi => rsi.RsiState,
SpriteSpecifier.Texture texture => texture.TexturePath.Filename,
_ => null
};

if (spriteName != null)
{
var color = (colors != null && i < colors.Count)
? colors[i]
: Color.White;
colorDict[spriteName] = color;
}
}

if (markingPrototype.ColorLinks != null)
{
foreach (var (child, parent) in markingPrototype.ColorLinks)
{
if (child == null || parent == null)
continue;

if (colorDict.TryGetValue(parent, out var color))
{
colorDict[child] = color;
}
}
}

var layerDict = new Dictionary<string, int>();
//Floof/Pirate PR port Omustation custom layers end

if (!_sprite.LayerMapTryGet((entity.Owner, sprite), markingPrototype.BodyPart, out var targetLayer, false))
{
return;
Expand All @@ -365,28 +407,70 @@ private void ApplyMarking(MarkingPrototype markingPrototype,

var layerId = $"{markingPrototype.ID}-{rsi.RsiState}";

if (!_sprite.LayerMapTryGet((entity.Owner, sprite), layerId, out var layer, false)) // Goob edit
// Floof/Pirate PR port for Omu Start
var layerSlot = markingPrototype.BodyPart;
var currentTargetIndex = 0;

if (markingPrototype.Layering != null &&
markingPrototype.Layering.TryGetValue(rsi.RsiState, out var layerValue))
{
var layerKey = layerValue?.ToString();

if (layerKey != null && Enum.TryParse<HumanoidVisualLayers>(layerKey, true, out var layerEnum))
{
layerSlot = layerEnum;
}
}

if (!_sprite.LayerMapTryGet((entity.Owner, sprite), layerSlot, out var customLayerIndex, false))
{
layerSlot = markingPrototype.BodyPart;
currentTargetIndex = targetLayer;
}
else
{
currentTargetIndex = customLayerIndex;
}

if (layerDict.TryGetValue(layerSlot.ToString(), out var layerIndex))
{
layerDict[layerSlot.ToString()] = layerIndex + 1;
}
else
{
layerDict.Add(layerSlot.ToString(), 0);
}

var targLayerAdj = currentTargetIndex + layerDict[layerSlot.ToString()] + 1;


// Floof/Pirate PR port Floofstation custom layers end

if (!_sprite.LayerMapTryGet((entity.Owner, sprite), layerId, out _, false)) // Floof/Pirate PR port Omustation custom layers
{
layer = _sprite.AddLayer((entity.Owner, sprite), markingSprite, targetLayer + j + 1); // Goob edit
var layer = _sprite.AddLayer((entity.Owner, sprite), markingSprite, targLayerAdj); // Floof/Pirate PR port Omustation custom layers
_sprite.LayerMapSet((entity.Owner, sprite), layerId, layer);
_sprite.LayerSetSprite((entity.Owner, sprite), layerId, rsi);
}

var hasInfo = humanoid.CustomBaseLayers.TryGetValue(markingPrototype.BodyPart, out var info); // Goobstation

// impstation edit begin - check if there's a shader defined in the markingPrototype's shader datafield, and if there is...
if (markingPrototype.Shader != null)
{
// use spriteComponent's layersetshader function to set the layer's shader to that which is specified.
sprite.LayerSetShader(layer, markingPrototype.Shader); // Goob edit
}
else // Goobstation
if (markingPrototype.Shader != null)
{
if (hasInfo && info.Shader != null)
sprite.LayerSetShader(layer, info.Shader);
else
sprite.LayerSetShader(layer, null, null);
// use spriteComponent's layersetshader function to set the layer's shader to that which is specified.
sprite.LayerSetShader(layerId, markingPrototype.Shader); // Floof/Pirate PR port Omustation custom layers, also Goobstation
}
else if (hasInfo && info.Shader != null)
{
sprite.LayerSetShader(layerId, info.Shader); // Floof/Pirate PR port Omustation custom layers, also Goobstation
}
else
{
if (_sprite.LayerMapTryGet((entity.Owner, sprite), layerId, out var shaderLayerIndex, false)) // Floof/Pirate PR port Floofstation custom layers
sprite.LayerSetShader(shaderLayerIndex, null, null); // Floof/Pirate PR port Floofstation custom layers
}
// impstation edit end
// impstation edit end

_sprite.LayerSetVisible((entity.Owner, sprite), layerId, visible);

Expand All @@ -395,31 +479,17 @@ private void ApplyMarking(MarkingPrototype markingPrototype,
continue;
}

// Okay so if the marking prototype is modified but we load old marking data this may no longer be valid
// and we need to check the index is correct.
// So if that happens just default to white?
if (colors != null && j < colors.Count)
{
// Goob edit start
var color = colors[j];
if (hasInfo && info.Color != null)
color = Color.InterpolateBetween(color, info.Color.Value, 0.5f);
_sprite.LayerSetColor((entity.Owner, sprite), layerId, color);
// Goob edit end
}
else
{
// Goob edit start
var color = Color.White;
if (hasInfo && info.Color != null)
color = info.Color.Value;
_sprite.LayerSetColor((entity.Owner, sprite), layerId, color);
// Goob edit end
}
// Omustation Floof/Pirate port - use colorDict (respects ColorLinks), then info.Color
var spriteColor = colorDict.TryGetValue(rsi.RsiState, out var dictColor) ? dictColor : Color.White;

if (hasInfo && info.Color != null)
spriteColor = Color.InterpolateBetween(spriteColor, info.Color.Value, 0.5f);
_sprite.LayerSetColor((entity.Owner, sprite), layerId, spriteColor);
// Floof/Pirate PR port Omustation custom layers end

if (humanoid.MarkingsDisplacement.TryGetValue(markingPrototype.BodyPart, out var displacementData) && markingPrototype.CanBeDisplaced)
{
_displacement.TryAddDisplacement(displacementData, (entity.Owner, sprite), targetLayer + j + 1, layerId, out _);
_displacement.TryAddDisplacement(displacementData, (entity.Owner, sprite), targLayerAdj, layerId, out _); // Floof/Pirate PR port Omustation custom layers
}
}
}
Expand Down
29 changes: 27 additions & 2 deletions Content.Client/Humanoid/MarkingPicker.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -420,12 +420,37 @@ private void OnUsedMarkingSelected(ItemList.ItemListSelectedEventArgs item)
List<ColorSelectorSliders> colorSliders = new();
for (int i = 0; i < prototype.Sprites.Count; i++)
{
//Floof/pirate PR port Omustation custom layers start
var skipDraw = false;
if (prototype.ColorLinks?.Count > 0)
{
var name = prototype.Sprites[i] switch
{
SpriteSpecifier.Rsi rsi => rsi.RsiState,
SpriteSpecifier.Texture texture => texture.TexturePath.Filename,
_ => null
};

if (name != null && prototype.ColorLinks.ContainsKey(name))
{
// this layer is colored by another layer, so skip it
skipDraw = true;
}
}
//Floof/pirate PR port Omustation custom layers end

var colorContainer = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
};

CMarkingColors.AddChild(colorContainer);
//CMarkingColors.AddChild(colorContainer);
//Floof/pirate PR port Omustation custom layers start
if (!skipDraw)
{
CMarkingColors.AddChild(colorContainer);
}
//Floof/pirate PR port Omustation custom layers end

ColorSelectorSliders colorSelector = new ColorSelectorSliders();
colorSelector.SelectorType = ColorSelectorSliders.ColorSelectorType.Hsv; // defaults color selector to HSV
Expand Down Expand Up @@ -562,4 +587,4 @@ private void MarkingRemove()
CMarkingColors.Visible = false;
OnMarkingRemoved?.Invoke(_currentMarkings);
}
}
}
2 changes: 2 additions & 0 deletions Content.Shared/Humanoid/HumanoidVisualLayers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public enum HumanoidVisualLayers : byte
Snout,
HeadSide, // side parts (i.e., frills)
HeadTop, // top parts (i.e., ears)
TailBehind, // Omustation Floof/Pirate PR port custom layers: For tails that render behind the body
TailOversuit, // Omustation Floof/Pirate PR port custom layers: For tails that render over the body
Eyes,
RArm,
LArm,
Expand Down
6 changes: 5 additions & 1 deletion Content.Shared/Humanoid/HumanoidVisualLayersExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,16 @@ public static IEnumerable<HumanoidVisualLayers> Sublayers(HumanoidVisualLayers l
yield return HumanoidVisualLayers.Chest;
yield return HumanoidVisualLayers.Wings; // for IPC wings port from SimpleStation
yield return HumanoidVisualLayers.Tail;
yield return HumanoidVisualLayers.TailBehind; // Omustation Floof/Pirate PR port custom layers
yield return HumanoidVisualLayers.TailOversuit; // Omustation Floof/Pirate PR port custom layers
// Shitmed Change Start
yield return HumanoidVisualLayers.Groin;
break;
case HumanoidVisualLayers.Groin:
yield return HumanoidVisualLayers.Groin;
yield return HumanoidVisualLayers.Tail;
yield return HumanoidVisualLayers.TailBehind; // Omustation Floof/Pirate PR port custom layers
yield return HumanoidVisualLayers.TailOversuit; // Omustation Floof/Pirate PR port custom layers
break;
case HumanoidVisualLayers.LHand:
yield return HumanoidVisualLayers.LHand;
Expand Down Expand Up @@ -175,4 +179,4 @@ public static IEnumerable<HumanoidVisualLayers> Sublayers(HumanoidVisualLayers l
return null;
}
}
}
}
2 changes: 1 addition & 1 deletion Content.Shared/Humanoid/Markings/MarkingColoring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,4 @@ public abstract partial class LayerColoringType
}
return color;
}
}
}
9 changes: 9 additions & 0 deletions Content.Shared/Humanoid/Markings/MarkingPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ public sealed partial class MarkingPrototype : IPrototype
public string? Shader { get; private set; } = null;
/// Impstation end

///Floof/Pirate PR port Omustation custom layers start
[DataField("layering")]
public Dictionary<string, string?>? Layering { get; private set; }

[DataField("colorLinks")]
public Dictionary<string, string?>? ColorLinks { get; private set; }
///Floof/Pirate PR port Omustation custom layers end


public Marking AsMarking()
{
return new Marking(ID, Sprites.Count);
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/arachnid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
- Chittin # Until they have a species-specific
- type: Sprite # I'd prefer if these maps were better. Insert map pun here.
layers:
- map: [ "enum.HumanoidVisualLayers.TailBehind" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Groin" ]
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
Expand All @@ -151,6 +152,7 @@
- map: [ "id" ]
- map: [ "outerClothing" ]
- map: [ "beltalt" ] # Omu change.
- map: [ "enum.HumanoidVisualLayers.TailOversuit" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Tail" ] # Mentioned in moth code: This needs renaming lol.
- map: [ "back" ]
- map: [ "neck" ]
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
components:
- type: Sprite
layers:
- map: [ "enum.HumanoidVisualLayers.TailBehind" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Groin" ]
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
Expand All @@ -284,6 +285,7 @@
- map: [ "ears" ]
- map: [ "eyes" ]
- map: [ "belt" ]
- map: [ "enum.HumanoidVisualLayers.TailOversuit" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "id" ]
- map: [ "outerClothing" ]
- map: [ "beltalt" ] # Omu change.
Expand Down Expand Up @@ -610,6 +612,7 @@
noRot: true
# TODO BODY Turn these into individual body parts?
layers:
- map: [ "enum.HumanoidVisualLayers.TailBehind" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Groin" ]
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
Expand Down Expand Up @@ -637,6 +640,7 @@
- map: [ "ears" ]
- map: [ "eyes" ]
- map: [ "belt" ]
- map: [ "enum.HumanoidVisualLayers.TailOversuit" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "id" ]
- map: [ "outerClothing" ]
- map: [ "back" ]
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/moth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@
noRot: true
drawdepth: Mobs
layers:
- map: [ "enum.HumanoidVisualLayers.TailBehind" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Groin" ]
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
Expand Down Expand Up @@ -232,6 +233,7 @@
- map: [ "id" ]
- map: [ "outerClothing" ]
- map: [ "beltalt" ] # Omu change.
- map: [ "enum.HumanoidVisualLayers.TailOversuit" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Tail" ] #in the utopian future we should probably have a wings enum inserted here so everyhting doesn't break
- map: [ "back" ]
- map: [ "neck" ]
Expand Down
4 changes: 3 additions & 1 deletion Resources/Prototypes/Entities/Mobs/Species/vox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
Slash: 5 # Reduce?
- type: Sprite # Need to redefine the whole order to draw the tail over their gas tank
layers:
- map: [ "enum.HumanoidVisualLayers.TailBehind" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "enum.HumanoidVisualLayers.Groin" ]
- map: [ "enum.HumanoidVisualLayers.Chest" ]
- map: [ "enum.HumanoidVisualLayers.Head" ]
Expand All @@ -217,6 +218,7 @@
- map: [ "id" ]
- map: [ "outerClothing" ]
- map: [ "beltalt" ] # Omu
- map: [ "enum.HumanoidVisualLayers.TailOversuit" ] # Omustation Floof/Pirate PR port custom layers
- map: [ "back" ]
- map: [ "enum.HumanoidVisualLayers.Face" ]
- map: [ "neck" ]
Expand Down Expand Up @@ -291,7 +293,7 @@
32:
sprite: Mobs/Species/Vox/displacement.rsi
state: shoes
outerClothing: # Goob
outerClothing: # Goob
sizeMaps:
32:
sprite: Mobs/Species/Vox/displacement.rsi
Expand Down
Loading
Loading