Skip to content

Commit

Permalink
Cherry-picked commit 986ac58 from space-wizards/space-station-14/master
Browse files Browse the repository at this point in the history
  • Loading branch information
SimpleStation14 authored and TheShuEd committed Mar 15, 2024
1 parent 3bf08c7 commit 8748004
Show file tree
Hide file tree
Showing 46 changed files with 412 additions and 44 deletions.
3 changes: 3 additions & 0 deletions Content.Client/Clothing/ClientClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ private void RenderEquipment(EntityUid equipee, EntityUid equipment, string slot
// note that every insertion requires reshuffling & remapping all the existing layers.
sprite.AddBlankLayer(index);
sprite.LayerMapSet(key, index);

if (layerData.Color != null)
sprite.LayerSetColor(key, layerData.Color.Value);
}
else
index = sprite.LayerMapReserveBlank(key);
Expand Down
27 changes: 24 additions & 3 deletions Content.Client/Sprite/RandomSpriteSystem.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Content.Client.Clothing;
using Content.Shared.Clothing.Components;
using Content.Shared.Sprite;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
Expand All @@ -8,6 +10,7 @@ namespace Content.Client.Sprite;
public sealed class RandomSpriteSystem : SharedRandomSpriteSystem
{
[Dependency] private readonly IReflectionManager _reflection = default!;
[Dependency] private readonly ClientClothingSystem _clothing = default!;

public override void Initialize()
{
Expand All @@ -31,10 +34,29 @@ private void OnHandleState(EntityUid uid, RandomSpriteComponent component, ref C
component.Selected.Add(layer.Key, layer.Value);
}

UpdateAppearance(uid, component);
UpdateSpriteComponentAppearance(uid, component);
UpdateClothingComponentAppearance(uid, component);
}

private void UpdateAppearance(EntityUid uid, RandomSpriteComponent component, SpriteComponent? sprite = null)
private void UpdateClothingComponentAppearance(EntityUid uid, RandomSpriteComponent component, ClothingComponent? clothing = null)
{
if (!Resolve(uid, ref clothing, false))
return;

if (clothing.ClothingVisuals == null)
return;

foreach (var slotPair in clothing.ClothingVisuals)
{
foreach (var keyColorPair in component.Selected)
{
_clothing.SetLayerColor(clothing, slotPair.Key, keyColorPair.Key, keyColorPair.Value.Color);
_clothing.SetLayerState(clothing, slotPair.Key, keyColorPair.Key, keyColorPair.Value.State);
}
}
}

private void UpdateSpriteComponentAppearance(EntityUid uid, RandomSpriteComponent component, SpriteComponent? sprite = null)
{
if (!Resolve(uid, ref sprite, false))
return;
Expand All @@ -55,7 +77,6 @@ private void UpdateAppearance(EntityUid uid, RandomSpriteComponent component, Sp
continue;
}
}

sprite.LayerSetState(index, layer.Value.State);
sprite.LayerSetColor(index, layer.Value.Color ?? Color.White);
}
Expand Down
33 changes: 33 additions & 0 deletions Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,38 @@ public void CopyVisuals(EntityUid uid, ClothingComponent otherClothing, Clothing
Dirty(uid, clothing);
}

public void SetLayerColor(ClothingComponent clothing, string slot, string mapKey, Color? color)
{
if (clothing.ClothingVisuals == null)
return;

foreach (var layer in clothing.ClothingVisuals[slot])
{
if (layer.MapKeys == null)
return;

if (!layer.MapKeys.Contains(mapKey))
continue;

layer.Color = color;
}
}
public void SetLayerState(ClothingComponent clothing, string slot, string mapKey, string state)
{
if (clothing.ClothingVisuals == null)
return;

foreach (var layer in clothing.ClothingVisuals[slot])
{
if (layer.MapKeys == null)
return;

if (!layer.MapKeys.Contains(mapKey))
continue;

layer.State = state;
}
}

#endregion
}
50 changes: 10 additions & 40 deletions Resources/Prototypes/Catalog/Fills/Lockers/wardrobe_colors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,46 +24,6 @@
components:
- type: StorageFill
contents:
- id: ClothingUniformJumpsuitColorWhite
prob: 0.25
- id: ClothingUniformJumpskirtColorWhite
prob: 0.25
- id: ClothingUniformJumpsuitColorBlue
prob: 0.25
- id: ClothingUniformJumpskirtColorBlue
prob: 0.25
- id: ClothingUniformJumpsuitColorYellow
prob: 0.25
- id: ClothingUniformJumpskirtColorYellow
prob: 0.25
- id: ClothingUniformJumpsuitColorGreen
prob: 0.25
- id: ClothingUniformJumpskirtColorGreen
prob: 0.25
- id: ClothingUniformJumpsuitColorOrange
prob: 0.25
- id: ClothingUniformJumpskirtColorOrange
prob: 0.25
- id: ClothingUniformJumpsuitColorPink
prob: 0.25
- id: ClothingUniformJumpskirtColorPink
prob: 0.25
- id: ClothingUniformJumpsuitColorRed
prob: 0.25
- id: ClothingUniformJumpskirtColorRed
prob: 0.25
- id: ClothingUniformJumpsuitColorDarkBlue
prob: 0.25
- id: ClothingUniformJumpskirtColorDarkBlue
prob: 0.25
- id: ClothingUniformJumpsuitColorTeal
prob: 0.25
- id: ClothingUniformJumpskirtColorTeal
prob: 0.25
- id: ClothingUniformJumpsuitColorPurple
prob: 0.25
- id: ClothingUniformJumpskirtColorPurple
prob: 0.25
- id: ClothingShoesColorBlack
amount: 1
- id: ClothingShoesColorBrown
Expand All @@ -74,6 +34,16 @@
prob: 0.4
- id: ClothingOuterCoatGentle
prob: 0.3
- id: ClothingUniformRandomShorts
amount: 3
- id: ClothingUniformRandomArmless
amount: 5
- id: ClothingUniformRandomStandart
amount: 5
- id: ClothingUniformRandomBra
amount: 5
- id: ClothingUniformRandomShirt
amount: 4

- type: entity
id: WardrobeYellowFilled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ClothingBackpackDuffel: 5
ClothingBackpackSatchel: 3
ClothingBackpackSatchelLeather: 2
ClothingRandomSpawner: 8
ClothingHeadHatBeret: 4
ClothingHeadBandBlack: 2
ClothingHeadBandBlue: 2
Expand Down
169 changes: 169 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Uniforms/random_suit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@

- type: entity
parent: ClothingUniformBase
id: ClothingUniformRandom
abstract: true
description: Generated by neural networks based on the latest fashion trends.
suffix: Random visual
components:
- type: SuitSensor
- type: Sprite
sprite: Clothing/Uniforms/procedural.rsi
layers:
- state: base_torso_standart
map: [ "torso" ]
- state: base_leg_standart
map: [ "leg" ]
- state: mask_null
map: [ "decor" ]
- state: mask_null
map: [ "overlay" ]
- type: Clothing
femaleMask: UniformTop
maleMask: UniformTop
sprite: Clothing/Uniforms/procedural.rsi
clothingVisuals:
jumpsuit:
- state: base_torso_standart
map: [ "torso" ]
- state: base_leg_standart
map: [ "leg" ]
- state: mask_null
map: [ "decor" ]
- state: mask_null
map: [ "overlay" ]

- type: entity
parent: ClothingUniformRandom
id: ClothingRandomSpawner
name: random colorful costume
components:
- type: RandomSpawner
offset: 0
prototypes:
- ClothingUniformRandomArmless
- ClothingUniformRandomStandart
- ClothingUniformRandomBra
- ClothingUniformRandomShorts
- ClothingUniformRandomShirt

- type: entity
parent: ClothingUniformRandom
id: ClothingUniformRandomArmless
name: colorful hands-free costume
components:
- type: RandomSprite
available:
- torso:
base_torso_armless: Sixteen
leg:
base_leg_standart: Sixteen
base_leg_short: Sixteen
base_leg_skirt: Sixteen
base_leg_skirt_long: Sixteen
decor:
decor_torso_armless1: Sixteen
decor_torso_armless2: Sixteen
decor_torso_armless3: Sixteen
decor_torso_armless4: Sixteen
decor_torso_armless5: Sixteen
decor_torso_armless6: Sixteen
decor_torso_armless7: Sixteen
decor_torso_armless8: Sixteen
decor_torso_armless9: Sixteen
decor_torso_armless10: Sixteen
mask_null: ""

- type: entity
parent: ClothingUniformRandom
id: ClothingUniformRandomStandart
name: colorful costume
components:
- type: RandomSprite
available:
- torso:
base_torso_standart: Sixteen
base_torso_standart2: Sixteen
leg:
base_leg_standart: Sixteen
base_leg_short: Sixteen
base_leg_skirt: Sixteen
base_leg_skirt_long: Sixteen
decor:
decor_torso_armless1: Sixteen
decor_torso_armless2: Sixteen
decor_torso_armless3: Sixteen
decor_torso_armless4: Sixteen
decor_torso_armless5: Sixteen
decor_torso_armless6: Sixteen
decor_torso_armless7: Sixteen
decor_torso_armless8: Sixteen
decor_torso_armless9: Sixteen
decor_torso_armless10: Sixteen
decor_torso_standart1: Sixteen
decor_torso_standart2: Sixteen
decor_torso_standart3: Sixteen
decor_torso_standart4: Sixteen
decor_torso_standart5: Sixteen
decor_torso_standart6: Sixteen
decor_torso_standart7: Sixteen
decor_torso_standart8: Sixteen
decor_torso_standart9: Sixteen
mask_null: ""

- type: entity
parent: ClothingUniformRandom
id: ClothingUniformRandomBra
name: colorful bra
components:
- type: RandomSprite
available:
- torso:
base_torso_bra: Sixteen
leg:
base_leg_standart: Sixteen
base_leg_short: Sixteen
base_leg_skirt: Sixteen
base_leg_skirt_long: Sixteen
decor:
decor_torso_bra1: Sixteen
decor_torso_bra2: Sixteen
decor_torso_bra3: Sixteen
decor_torso_bra4: Sixteen
decor_torso_bra5: Sixteen
mask_null: ""

- type: entity
parent: ClothingUniformRandom
id: ClothingUniformRandomShorts
name: colorful pants
components:
- type: RandomSprite
available:
- torso:
mask_null: ""
leg:
base_leg_standart: Sixteen
base_leg_short: Sixteen
base_leg_skirt: Sixteen
base_leg_skirt_long: Sixteen

- type: entity
parent: ClothingUniformRandom
id: ClothingUniformRandomShirt
name: colorful costume
components:
- type: RandomSprite
available:
- torso:
base_torso_armless: Sixteen
mask_null: ""
leg:
base_leg_standart: Sixteen
base_leg_short: Sixteen
decor:
base_torso_shirt: Sixteen
overlay:
decor_torso_shirt1: Sixteen
decor_torso_shirt2: Sixteen
decor_torso_shirt3: Sixteen
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
- type: UserInterface
interfaces:
- key: enum.ChameleonUiKey.Key
type: ChameleonBoundUserInterface
type: ChameleonBoundUserInterface
12 changes: 12 additions & 0 deletions Resources/Prototypes/Entities/Structures/Furniture/dresser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@
components:
- type: StorageFill
contents:
- id: ClothingUniformRandomArmless
prob: 0.05
orGroup: dressermainloot
- id: ClothingUniformRandomStandart
prob: 0.05
orGroup: dressermainloot
- id: ClothingUniformRandomBra
prob: 0.05
orGroup: dressermainloot
- id: ClothingUniformRandomShorts
prob: 0.05
orGroup: dressermainloot
- id: ClothingNeckLGBTPin
prob: 0.06
orGroup: dressermainloot
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8748004

Please sign in to comment.