Kobold variety - allows kobolds to have random colors and horns (+ allows RandomSpriteComponent to uh. Actually choose random sprites for specific layers) (#23393)

* kobold variety - allows kobolds to have random colors and horns

* hey lets maybe not crash in this case, lets maybe let the color continue being null in this case

* excuse us vscode what the fuck is this

* brightens kob base, makes kob outline more bold, fixes to the prototype because our code spaghett

* okay yeah angler horns just dont work At All. the floppy kobold ears, however? MWAH. chef's kis

* we've been staring at these critters all day - makes base color line up with the base color of some of the markings
This commit is contained in:
deathride58
2024-01-03 19:39:00 -05:00
committed by GitHub
parent 2130e39732
commit 4d0d2e4c5a
7 changed files with 89 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
using Content.Shared.Decals; using Content.Shared.Decals;
using Content.Shared.Random.Helpers;
using Content.Shared.Sprite; using Content.Shared.Sprite;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
@@ -26,7 +27,7 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
if (component.Available.Count == 0) if (component.Available.Count == 0)
return; return;
var groups = new List<Dictionary<string, (string, string?)>>(); var groups = new List<Dictionary<string, Dictionary<string, string?>>>();
if (component.GetAllGroups) if (component.GetAllGroups)
{ {
groups = component.Available; groups = component.Available;
@@ -38,16 +39,27 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
component.Selected.EnsureCapacity(groups.Count); component.Selected.EnsureCapacity(groups.Count);
Color? previousColor = null;
foreach (var group in groups) foreach (var group in groups)
{ {
foreach (var layer in group) foreach (var layer in group)
{ {
Color? color = null; Color? color = null;
if (!string.IsNullOrEmpty(layer.Value.Item2)) var selectedState = _random.Pick(layer.Value);
color = _random.Pick(_prototype.Index<ColorPalettePrototype>(layer.Value.Item2).Colors.Values); if (!string.IsNullOrEmpty(selectedState.Value))
{
if (selectedState.Value == $"Inherit")
color = previousColor;
else
{
color = _random.Pick(_prototype.Index<ColorPalettePrototype>(selectedState.Value).Colors.Values);
previousColor = color;
}
}
component.Selected.Add(layer.Key, (layer.Value.Item1, color)); component.Selected.Add(layer.Key, (selectedState.Key, color));
} }
} }

View File

@@ -17,7 +17,7 @@ public sealed partial class RandomSpriteComponent : Component
/// Stored as a list so we can have groups of random sprites (e.g. tech_base + tech_flare for holoparasite) /// Stored as a list so we can have groups of random sprites (e.g. tech_base + tech_flare for holoparasite)
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite), DataField("available")] [ViewVariables(VVAccess.ReadWrite), DataField("available")]
public List<Dictionary<string, (string State, string? Color)>> Available = new(); public List<Dictionary<string, Dictionary<string, string?>>> Available = new();
/// <summary> /// <summary>
/// Selected colors /// Selected colors

View File

@@ -1160,7 +1160,7 @@
name: kobold name: kobold
id: MobKobold id: MobKobold
parent: MobMonkey parent: MobMonkey
description: Cousins to the sentient race of lizard people, kobolds blend in with industrial tiling and are as nasty as monkeys; ready to pull out your hair and stab you to death. description: Cousins to the sentient race of lizard people, kobolds blend in with their natural habitat and are as nasty as monkeys; ready to pull out your hair and stab you to death.
components: components:
- type: LizardAccent - type: LizardAccent
- type: Speech # I don't know how to get it to work and i want someone to make them speak like a lizard with normal accents (or optionally another language altogether) - type: Speech # I don't know how to get it to work and i want someone to make them speak like a lizard with normal accents (or optionally another language altogether)
@@ -1195,8 +1195,14 @@
drawdepth: Mobs drawdepth: Mobs
layers: layers:
- map: ["enum.DamageStateVisualLayers.Base"] - map: ["enum.DamageStateVisualLayers.Base"]
state: kobold
sprite: Mobs/Animals/kobold.rsi sprite: Mobs/Animals/kobold.rsi
state: kobold
- map: [ "outline" ]
sprite: Mobs/Animals/kobold.rsi
state: outline
- map: [ "horns" ]
sprite: Mobs/Customization/reptilian_parts.rsi
state: horns_short
- map: [ "enum.HumanoidVisualLayers.Handcuffs" ] - map: [ "enum.HumanoidVisualLayers.Handcuffs" ]
color: "#ffffff" color: "#ffffff"
sprite: Objects/Misc/handcuffs.rsi sprite: Objects/Misc/handcuffs.rsi
@@ -1210,6 +1216,22 @@
sprite: "Effects/creampie.rsi" sprite: "Effects/creampie.rsi"
state: "creampie_human" state: "creampie_human"
visible: false visible: false
- type: RandomSprite
getAllGroups: true
available:
- enum.DamageStateVisualLayers.Base:
kobold: KoboldColors
- horns:
horns_curled: KoboldHornColors
horns_ram: KoboldHornColors
horns_short: KoboldHornColors
horns_myrsore: KoboldHornColors
horns_bighorn: KoboldHornColors
horns_argali: KoboldHornColors
horns_ayrshire: KoboldHornColors
horns_floppy_kobold_ears: Inherit
horns_double: Inherit
horns_kobold_ears: Inherit
- type: Butcherable - type: Butcherable
butcheringType: Spike butcheringType: Spike
spawned: spawned:

View File

@@ -0,0 +1,43 @@
- type: palette
id: KoboldColors
name: KoboldColors
colors:
ForestA: "#71a457"
ForestB: "#536f18"
ForestC: "#1e5026"
ForestD: "#519b71"
ForestE: "#61a003"
ForestF: "#729953"
DesertA: "#999453"
DesertB: "#daa976"
DesertC: "#a4582f"
DesertD: "#af9369"
DesertE: "#c27d3b"
DesertF: "#ddc3a1"
SwampA: "#635033"
SwampB: "#455132"
SwampC: "#4a4d12"
SwampD: "#452d1d"
SwampE: "#5f544c"
SwampF: "#413b0a"
CaveA: "#4a4260"
CaveB: "#3f3330"
CaveC: "#4a4542"
CaveD: "#413d32"
CaveE: "#726f6a"
CaveF: "#d4c8bf"
TechniRed: "#b32828"
TechniOrange: "#da8929"
TechniGreen: "#28df58"
TechniBlue: "#144bb3"
TechniCyan: "#1ddfbe"
TechniPurple: "#792da9"
TechniFuchsia: "#d11a82"
- type: palette
id: KoboldHornColors
name: KoboldHornColors
colors:
HornA: "#d4c8bf"
hornB: "#eec7ab"
hornC: "#ad9584"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -5,11 +5,15 @@
"y": 32 "y": 32
}, },
"license": "CC-BY-SA-3.0", "license": "CC-BY-SA-3.0",
"copyright": "Drawn by Ubaser", "copyright": "Drawn by Ubaser, modified by Bhijn and Myr",
"states": [ "states": [
{ {
"name": "kobold", "name": "kobold",
"directions": 4 "directions": 4
},
{
"name": "outline",
"directions": 4
} }
] ]
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB