Add subfloor appearance data, pipes correctly render subfloor. (#4393)

This commit is contained in:
Vera Aguilera Puerto
2021-08-01 04:50:36 +02:00
committed by GitHub
parent eee3c940fb
commit f2a3987343
7 changed files with 135 additions and 11 deletions

View File

@@ -1,9 +1,11 @@
using System;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using Robust.Shared.ViewVariables;
namespace Content.Shared.SubFloor
@@ -146,10 +148,19 @@ namespace Content.Shared.SubFloor
subFloor = !transformComponent.Anchored;
}
// Whether to show this entity as visible, visually.
var subFloorVisible = ShowAll || subFloor;
// Show sprite
if (ComponentManager.TryGetComponent(uid, out SharedSpriteComponent? spriteComponent))
{
spriteComponent.Visible = ShowAll || subFloor;
spriteComponent.Visible = subFloorVisible;
}
// Set an appearance data value so visualizers can use this as needed.
if (ComponentManager.TryGetComponent(uid, out SharedAppearanceComponent? appearanceComponent))
{
appearanceComponent.SetData(SubFloorVisuals.SubFloor, subFloorVisible);
}
// So for collision all we care about is that the component is running.
@@ -169,4 +180,10 @@ namespace Content.Shared.SubFloor
SubFloor = subFloor;
}
}
[Serializable, NetSerializable]
public enum SubFloorVisuals : byte
{
SubFloor,
}
}