Engineering lockers. (#210)
* Import Eris engineering locker sprites. * Allow customizing ClientStorageComponent open/close states better. * EntityStorage does not blow up if Storage is also defined in prototype. * Engineering styled lockers.
This commit is contained in:
committed by
GitHub
parent
fe0414eda7
commit
6e5680b3c2
@@ -11,6 +11,8 @@ using Robust.Shared.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Storage
|
||||
{
|
||||
@@ -24,6 +26,9 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
private int StorageCapacityMax;
|
||||
private StorageWindow Window;
|
||||
|
||||
[ViewVariables] private string _closedState;
|
||||
[ViewVariables] private string _openState;
|
||||
|
||||
public bool Open
|
||||
{
|
||||
get => _open;
|
||||
@@ -48,6 +53,14 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _closedState, "state_door_closed", null);
|
||||
serializer.DataField(ref _openState, "state_door_open", null);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||
{
|
||||
@@ -127,7 +140,7 @@ namespace Content.Client.GameObjects.Components.Storage
|
||||
|
||||
var baseName = spriteComp.LayerGetState(0).Name;
|
||||
|
||||
var stateId = open ? $"{baseName}_open" : $"{baseName}_door";
|
||||
var stateId = open ? _openState ?? $"{baseName}_open" : _closedState ?? $"{baseName}_door";
|
||||
|
||||
if (spriteComp.BaseRSI.TryGetState(stateId, out _))
|
||||
spriteComp.LayerSetState(1, stateId);
|
||||
|
||||
Reference in New Issue
Block a user