TG locker sprites & prototypes.

Closes #947
This commit is contained in:
Pieter-Jan Briers
2020-05-22 15:44:49 +02:00
parent 28774740ef
commit 40432cdc14
168 changed files with 30966 additions and 262 deletions

View File

@@ -1,6 +1,7 @@
using Content.Shared.GameObjects.Components.Storage;
using Robust.Client.GameObjects;
using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Utility;
using YamlDotNet.RepresentationModel;
@@ -8,6 +9,7 @@ namespace Content.Client.GameObjects.Components.Storage
{
public sealed class StorageVisualizer2D : AppearanceVisualizer
{
private string _stateBase;
private string _stateOpen;
private string _stateClosed;
@@ -15,7 +17,12 @@ namespace Content.Client.GameObjects.Components.Storage
{
base.LoadData(node);
if (node.TryGetNode("state_open", out var child))
if (node.TryGetNode("state", out var child))
{
_stateBase = child.AsString();
}
if (node.TryGetNode("state_open", out child))
{
_stateOpen = child.AsString();
}
@@ -26,6 +33,19 @@ namespace Content.Client.GameObjects.Components.Storage
}
}
public override void InitializeEntity(IEntity entity)
{
if (!entity.TryGetComponent(out ISpriteComponent sprite))
{
return;
}
if (_stateBase != null)
{
sprite.LayerSetState(0, _stateBase);
}
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
@@ -36,7 +56,9 @@ namespace Content.Client.GameObjects.Components.Storage
}
component.TryGetData(StorageVisuals.Open, out bool open);
sprite.LayerSetState(StorageVisualLayers.Door, open ? _stateOpen : _stateClosed);
sprite.LayerSetState(StorageVisualLayers.Door, open
? _stateOpen ?? $"{_stateBase}_open"
: _stateClosed ?? $"{_stateBase}_door");
}
}