Water gun cargo crate (#16172)

This commit is contained in:
Nemanja
2023-05-06 23:14:54 -04:00
committed by GitHub
parent 883d6646ea
commit 4c2b521c90
22 changed files with 221 additions and 13 deletions

View File

@@ -1,4 +1,3 @@
using System.Linq;
using Content.Shared.Decals;
using Content.Shared.Sprite;
using Robust.Shared.GameStates;
@@ -27,17 +26,29 @@ public sealed class RandomSpriteSystem: SharedRandomSpriteSystem
if (component.Available.Count == 0)
return;
var group = _random.Pick(component.Available);
component.Selected.EnsureCapacity(group.Count);
foreach (var layer in group)
var groups = new List<Dictionary<string, (string, string?)>>();
if (component.GetAllGroups)
{
Color? color = null;
groups = component.Available;
}
else
{
groups.Add(_random.Pick(component.Available));
}
if (!string.IsNullOrEmpty(layer.Value.Color))
color = _random.Pick(_prototype.Index<ColorPalettePrototype>(layer.Value.Color).Colors.Values);
component.Selected.EnsureCapacity(groups.Count);
component.Selected.Add(layer.Key, (layer.Value.State, color));
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);
component.Selected.Add(layer.Key, (layer.Value.Item1, color));
}
}
Dirty(component);