* Fixed Rack/Shelf * Fixes bookshelf, bed * Placeable for beds for bedsheets * Bunch of Physics changes, ask metalgearsloth about em' * More modifications * More * Other stuff * Organizes entities yaml a little bit * Something new * Fixed, happy with the state of this rn * A * A * Ye * E * Done for now... * Applied Reviws * Changes * Fix the robust commit * Fixes tests? * E Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
31 lines
949 B
C#
31 lines
949 B
C#
using System.Collections.Generic;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
namespace Content.Server.GameObjects.Components
|
|
{
|
|
[RegisterComponent]
|
|
public class RandomSpriteStateComponent : Component
|
|
{
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
public override string Name => "RandomSpriteState";
|
|
|
|
[DataField("spriteStates")]
|
|
private List<string>? _spriteStates;
|
|
|
|
[DataField("spriteLayer")]
|
|
private int _spriteLayer;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
if (_spriteStates == null) return;
|
|
if (!Owner.TryGetComponent(out SpriteComponent? spriteComponent)) return;
|
|
spriteComponent.LayerSetState(_spriteLayer, _random.Pick(_spriteStates));
|
|
}
|
|
}
|
|
}
|