Wires are now actually hidden by floor tiles. (#181)

This commit is contained in:
Pieter-Jan Briers
2019-04-04 15:09:06 +02:00
committed by GitHub
parent 3b0ec7f695
commit 9f3f09871e
10 changed files with 192 additions and 3 deletions

View File

@@ -0,0 +1,50 @@
using Content.Shared.Maps;
using SS14.Client.Interfaces.GameObjects.Components;
using SS14.Shared.GameObjects;
using SS14.Shared.GameObjects.Components.Transform;
namespace Content.Client.GameObjects.Components
{
/// <summary>
/// Simple component that automatically hides the sibling <see cref="ISpriteComponent"/> when the tile it's on
/// is not a sub floor (plating).
/// </summary>
/// <seealso cref="ContentTileDefinition.IsSubFloor"/>
public sealed class SubFloorHideComponent : Component
{
private SnapGridComponent _snapGridComponent;
public override string Name => "SubFloorHide";
public override void Initialize()
{
base.Initialize();
_snapGridComponent = Owner.GetComponent<SnapGridComponent>();
}
public override void Startup()
{
base.Startup();
_snapGridComponent.OnPositionChanged += SnapGridOnPositionChanged;
Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
}
public override void Shutdown()
{
base.Shutdown();
_snapGridComponent.OnPositionChanged -= SnapGridOnPositionChanged;
}
private void SnapGridOnPositionChanged()
{
Owner.EntityManager.RaiseEvent(Owner, new SubFloorHideDirtyEvent());
}
}
internal sealed class SubFloorHideDirtyEvent : EntitySystemMessage
{
}
}