Rollerbeds (#5681)

This commit is contained in:
metalgearsloth
2021-12-29 15:57:20 +11:00
committed by GitHub
parent 0bab6ecb71
commit e5e144d99c
40 changed files with 627 additions and 53 deletions

View File

@@ -0,0 +1,36 @@
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.Visualizer;
public sealed class FoldableVisualizer : AppearanceVisualizer
{
[DataField("key")]
private string _key = default!;
public override void OnChangeData(AppearanceComponent appearance)
{
base.OnChangeData(appearance);
var entManager = IoCManager.Resolve<IEntityManager>();
if (!entManager.TryGetComponent(appearance.Owner, out SpriteComponent? sprite)) return;
if (appearance.TryGetData("FoldedState", out bool folded) && folded)
{
sprite.LayerSetState(FoldableVisualLayers.Base, $"{_key}_folded");
}
else
{
sprite.LayerSetState(FoldableVisualLayers.Base, $"{_key}");
}
}
public enum FoldableVisualLayers : byte
{
Base,
}
}