Makes it so that all wires (except the bolt wire) have to be cut on airlocks/windoors (#11056)

This commit is contained in:
Flipp Syder
2022-09-05 18:41:39 -07:00
committed by GitHub
parent 77784882e0
commit 8e54ec27f2
3 changed files with 25 additions and 2 deletions

View File

@@ -1,7 +1,9 @@
using Content.Server.Wires;
using System.Linq;
using Content.Server.Wires;
using Content.Shared.Construction;
using Content.Shared.Examine;
using JetBrains.Annotations;
using Robust.Shared.Reflection;
namespace Content.Server.Construction.Conditions
{
@@ -15,13 +17,22 @@ namespace Content.Server.Construction.Conditions
{
[DataField("value")] public bool Value { get; private set; } = true;
[DataField("ignoreTypes")] public HashSet<IWireAction> IgnoreTypes { get; } = new();
public bool Condition(EntityUid uid, IEntityManager entityManager)
{
if (!entityManager.TryGetComponent(uid, out WiresComponent? wires))
return true;
var ignoreTypes = IgnoreTypes.Select(t => t.GetType()).ToHashSet();
foreach (var wire in wires.WiresList)
{
if (ignoreTypes.Contains(wire.Action.GetType()))
{
continue;
}
switch (Value)
{
case true when !wire.IsCut: