Fix crematorium visualizer crash (#2513)

* Fix crematorium visualizer crash

* Also morgue

Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2020-11-07 14:44:47 +11:00
committed by GitHub
parent bf5b9ad03b
commit 54e0747577
2 changed files with 16 additions and 12 deletions

View File

@@ -44,12 +44,14 @@ namespace Content.Client.GameObjects.Components.Storage
if (!component.Owner.TryGetComponent(out ISpriteComponent? sprite)) return;
sprite.LayerSetState(
CrematoriumVisualLayers.Base,
component.GetData<bool>(MorgueVisuals.Open)
? _stateOpen
: _stateClosed
);
if (component.TryGetData(MorgueVisuals.Open, out bool open))
{
sprite.LayerSetState(CrematoriumVisualLayers.Base, open ? _stateOpen : _stateClosed);
}
else
{
sprite.LayerSetState(CrematoriumVisualLayers.Base, _stateClosed);
}
var lightState = "";
if (component.TryGetData(MorgueVisuals.HasContents, out bool hasContents) && hasContents) lightState = _lightContents;