2021-07-04 18:11:52 +02:00
|
|
|
|
using Content.Shared.Wires;
|
|
|
|
|
|
using Robust.Client.GameObjects;
|
2021-11-22 23:22:59 -08:00
|
|
|
|
using Robust.Shared.GameObjects;
|
2021-12-05 18:09:01 +01:00
|
|
|
|
using Robust.Shared.IoC;
|
2021-07-04 18:11:52 +02:00
|
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.Power
|
|
|
|
|
|
{
|
|
|
|
|
|
[DataDefinition]
|
|
|
|
|
|
public sealed class CableVisualizer : AppearanceVisualizer
|
|
|
|
|
|
{
|
|
|
|
|
|
[DataField("base")]
|
|
|
|
|
|
public string? StateBase;
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnChangeData(component);
|
|
|
|
|
|
|
2021-12-05 18:09:01 +01:00
|
|
|
|
var entities = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
if (!entities.TryGetComponent(component.Owner, out SpriteComponent? sprite))
|
2021-07-04 18:11:52 +02:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (!component.TryGetData(WireVisVisuals.ConnectedMask, out WireVisDirFlags mask))
|
|
|
|
|
|
mask = WireVisDirFlags.None;
|
|
|
|
|
|
|
|
|
|
|
|
sprite.LayerSetState(0, $"{StateBase}{(int) mask}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|