From 8e54ec27f2d4fa8e12093eaea492c205aa7dab4c Mon Sep 17 00:00:00 2001 From: Flipp Syder <76629141+vulppine@users.noreply.github.com> Date: Mon, 5 Sep 2022 18:41:39 -0700 Subject: [PATCH] Makes it so that all wires (except the bolt wire) have to be cut on airlocks/windoors (#11056) --- .../Construction/Conditions/AllWiresCut.cs | 13 ++++++++++++- .../Construction/Graphs/structures/airlock.yml | 8 +++++++- .../Construction/Graphs/structures/windoor.yml | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Content.Server/Construction/Conditions/AllWiresCut.cs b/Content.Server/Construction/Conditions/AllWiresCut.cs index 198b399fc6..5310f2c8db 100644 --- a/Content.Server/Construction/Conditions/AllWiresCut.cs +++ b/Content.Server/Construction/Conditions/AllWiresCut.cs @@ -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 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: diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock.yml b/Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock.yml index e18e9e63cd..6b9337f5ef 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/structures/airlock.yml @@ -90,12 +90,15 @@ - !type:AirlockBolted value: false - !type:WirePanel {} + - !type:AllWiresCut + ignoreTypes: + - !type:DoorBoltWireAction completed: - !type:EmptyAllContainers {} steps: - tool: Prying doAfter: 5 - + - node: glassElectronics entity: AirlockAssembly edges: @@ -127,6 +130,9 @@ - !type:AirlockBolted value: false - !type:WirePanel {} + - !type:AllWiresCut + ignoreTypes: + - !type:DoorBoltWireAction completed: - !type:SpawnPrototype prototype: SheetRGlass1 diff --git a/Resources/Prototypes/Recipes/Construction/Graphs/structures/windoor.yml b/Resources/Prototypes/Recipes/Construction/Graphs/structures/windoor.yml index 861aaf568e..da5dccfd26 100644 --- a/Resources/Prototypes/Recipes/Construction/Graphs/structures/windoor.yml +++ b/Resources/Prototypes/Recipes/Construction/Graphs/structures/windoor.yml @@ -112,6 +112,9 @@ - !type:AirlockBolted value: false - !type:WirePanel {} + - !type:AllWiresCut + ignoreTypes: + - !type:DoorBoltWireAction completed: - !type:EmptyAllContainers {} steps: @@ -212,6 +215,9 @@ - !type:WirePanel {} - !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated container: board + - !type:AllWiresCut + ignoreTypes: + - !type:DoorBoltWireAction completed: - !type:EmptyAllContainers {} steps: