Vent and Siphon visualizer and icon fixes (#2288)

* Half pipes

* PipeVisualizer pipeRSI field

* Vent and Siphon visualizer fixes

Co-authored-by: py01 <pyronetics01@gmail.com>
This commit is contained in:
py01
2020-10-18 04:13:06 -06:00
committed by GitHub
parent 32138958ce
commit f01a50012e
7 changed files with 93 additions and 20 deletions

View File

@@ -11,6 +11,7 @@ using Robust.Shared.Utility;
using System;
using Content.Shared.GameObjects.Components.Atmos;
using YamlDotNet.RepresentationModel;
using Robust.Shared.Interfaces.GameObjects;
namespace Content.Client.GameObjects.Components.Atmos
{
@@ -37,23 +38,26 @@ namespace Content.Client.GameObjects.Components.Atmos
}
}
public override void InitializeEntity(IEntity entity)
{
base.InitializeEntity(entity);
if (!entity.TryGetComponent(out ISpriteComponent sprite)) return;
sprite.LayerMapReserveBlank(Layer.VentBase);
var pipeBaseLayer = sprite.LayerMapGet(Layer.VentBase);
sprite.LayerSetRSI(pipeBaseLayer, _ventRSI);
sprite.LayerSetVisible(pipeBaseLayer, true);
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite))
{
return;
}
if (!component.TryGetData(VentVisuals.VisualState, out VentVisualState ventVisualState))
{
return;
}
if (!component.Owner.TryGetComponent(out ISpriteComponent sprite)) return;
if (!component.TryGetData(VentVisuals.VisualState, out VentVisualState ventVisualState)) return;
var ventBaseState = "vent";
ventBaseState += ventVisualState.VentEnabled ? "On" : "Off";
sprite.LayerMapReserveBlank(Layer.VentBase);
var baseVentLayer = sprite.LayerMapGet(Layer.VentBase);
sprite.LayerSetRSI(baseVentLayer, _ventRSI);
sprite.LayerSetState(baseVentLayer, ventBaseState);