* Put the damage in the windows * add crack overlays * Window cracking * glass related sounds * let's use a valid state * run optipng on these for posterity * Examine damage descriptions * add "Constructible" to dictionary * Downmix stereo effects to mono * breaking and knocking * Add shard etc. sprites * shard inhands * more sprite wrangling * Expand destructiblecomponent drop system + implement it for windows * Shard descriptions * Random sprite component * no nullbabby * Random destroysounds * random offset on destructible drops * fix fucked yaml * sound collections * random pitch for knocking * Localization * hascomponent * better spawnondestroy * missed one
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System.Collections.Generic;
|
|
using Robust.Server.GameObjects;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Interfaces.Random;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Random;
|
|
using Robust.Shared.Serialization;
|
|
|
|
namespace Content.Server.GameObjects.Components
|
|
{
|
|
[RegisterComponent]
|
|
public class RandomSpriteStateComponent : Component
|
|
{
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
public override string Name => "RandomSpriteState";
|
|
|
|
private List<string> _spriteStates;
|
|
|
|
private int _spriteLayer;
|
|
|
|
public override void ExposeData(ObjectSerializer serializer)
|
|
{
|
|
base.ExposeData(serializer);
|
|
serializer.DataField(ref _spriteStates, "spriteStates", null);
|
|
serializer.DataField(ref _spriteLayer, "spriteLayer", 0);
|
|
}
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
if (_spriteStates == null) return;
|
|
if (!Owner.TryGetComponent(out SpriteComponent spriteComponent)) return;
|
|
spriteComponent.LayerSetState(_spriteLayer, _random.Pick(_spriteStates));
|
|
}
|
|
}
|
|
}
|