Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs
Pieter-Jan Briers 195c16d800 Wire hacking is now fancy.
1. new UI
2. wires are correctly randomized.
3. wires layouts
are shared across machines in the same round.
2020-05-27 15:24:07 +02:00

53 lines
1.4 KiB
C#

using System.Collections.Generic;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.ViewVariables;
using static Content.Shared.GameObjects.Components.SharedWiresComponent;
namespace Content.Server.GameObjects.EntitySystems
{
public class WireHackingSystem : EntitySystem
{
[ViewVariables] private readonly Dictionary<string, WireLayout> _layouts =
new Dictionary<string, WireLayout>();
public bool TryGetLayout(string id, out WireLayout layout)
{
return _layouts.TryGetValue(id, out layout);
}
public void AddLayout(string id, WireLayout layout)
{
_layouts.Add(id, layout);
}
public void ResetLayouts()
{
_layouts.Clear();
}
}
public sealed class WireLayout
{
[ViewVariables] public IReadOnlyDictionary<object, WireData> Specifications { get; }
public WireLayout(IReadOnlyDictionary<object, WireData> specifications)
{
Specifications = specifications;
}
public sealed class WireData
{
public WireLetter Letter { get; }
public WireColor Color { get; }
public int Position { get; }
public WireData(WireLetter letter, WireColor color, int position)
{
Letter = letter;
Color = color;
Position = position;
}
}
}
}