// 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);
+using Content.Client.Clothing;
+using Content.Shared.Clothing.Components;
using Content.Shared.Sprite;
using Robust.Client.GameObjects;
using Robust.Shared.GameStates;
public sealed class RandomSpriteSystem : SharedRandomSpriteSystem
{
[Dependency] private readonly IReflectionManager _reflection = default!;
+ [Dependency] private readonly ClientClothingSystem _clothing = default!;
public override void Initialize()
{
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;
continue;
}
}
-
sprite.LayerSetState(index, layer.Value.State);
sprite.LayerSetColor(index, layer.Value.Color ?? Color.White);
}
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
}
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
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
ClothingBackpackDuffel: 5
ClothingBackpackSatchel: 3
ClothingBackpackSatchelLeather: 2
+ ClothingRandomSpawner: 8
ClothingHeadHatBeret: 4
ClothingHeadBandBlack: 2
ClothingHeadBandBlue: 2
--- /dev/null
+
+- 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
\ No newline at end of file
- type: UserInterface
interfaces:
- key: enum.ChameleonUiKey.Key
- type: ChameleonBoundUserInterface
+ type: ChameleonBoundUserInterface
\ No newline at end of file
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
--- /dev/null
+{
+ "version": 1,
+ "license": "CC-BY-SA-3.0",
+ "copyright": "The sprite base is taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c838ba21dae97db345e0113f99596decd1d66039, separated into layers and added new ones by TheShuEd (github)",
+ "size": {
+ "x": 32,
+ "y": 32
+ },
+ "states": [
+ {
+ "name": "base_leg_short",
+ "directions": 4
+ },
+ {
+ "name": "base_leg_skirt",
+ "directions": 4
+ },
+ {
+ "name": "base_leg_skirt_long",
+ "directions": 4
+ },
+ {
+ "name": "base_leg_standart",
+ "directions": 4
+ },
+ {
+ "name": "base_torso_armless",
+ "directions": 4
+ },
+ {
+ "name": "base_torso_bra",
+ "directions": 4
+ },
+ {
+ "name": "base_torso_shirt",
+ "directions": 4
+ },
+ {
+ "name": "base_torso_standart",
+ "directions": 4
+ },
+ {
+ "name": "base_torso_standart2",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless1",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless2",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless3",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless4",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless5",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless6",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless7",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless8",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless9",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_armless10",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_bra1",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_bra2",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_bra3",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_bra4",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_bra5",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_shirt1",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_shirt2",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_shirt3",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart1",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart2",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart3",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart4",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart5",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart6",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart7",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart8",
+ "directions": 4
+ },
+ {
+ "name": "decor_torso_standart9",
+ "directions": 4
+ },
+ {
+ "name": "mask_null",
+ "directions": 4
+ }
+ ]
+}