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