Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,55 @@
using Content.Shared.MachineLinking;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Client.Conveyor.Visualizers
{
[UsedImplicitly]
public class TwoWayLeverVisualizer : AppearanceVisualizer
{
[DataField("state_forward")]
private string? _stateForward;
[DataField("state_off")]
private string? _stateOff;
[DataField("state_reversed")]
private string? _stateReversed;
private void ChangeState(AppearanceComponent appearance)
{
if (!appearance.Owner.TryGetComponent(out ISpriteComponent? sprite))
{
return;
}
appearance.TryGetData(TwoWayLeverVisuals.State, out TwoWayLeverSignal state);
var texture = state switch
{
TwoWayLeverSignal.Middle => _stateOff,
TwoWayLeverSignal.Right => _stateForward,
TwoWayLeverSignal.Left => _stateReversed,
_ => _stateOff
};
sprite.LayerSetState(0, texture);
}
public override void InitializeEntity(IEntity entity)
{
base.InitializeEntity(entity);
var appearance = entity.EnsureComponent<AppearanceComponent>();
ChangeState(appearance);
}
public override void OnChangeData(AppearanceComponent component)
{
base.OnChangeData(component);
ChangeState(component);
}
}
}