Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/WireHackingSystem.cs
DrSmugleaf 5c0cf1b1a0 Use 'new' expression in places where the type is evident for content (#2590)
* Content.Client

* Content.Benchmarks

* Content.IntegrationTests

* Content.Server

* Content.Server.Database

* Content.Shared

* Content.Tests

* Merge fixes

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2020-11-27 21:00:49 +11:00

54 lines
1.5 KiB
C#

using System.Collections.Generic;
using Content.Shared.GameTicking;
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, IResettingEntitySystem
{
[ViewVariables] private readonly Dictionary<string, WireLayout> _layouts =
new();
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 Reset()
{
_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;
}
}
}
}