Airlock bolt and deconstruction fixes (#11985)

This commit is contained in:
0x6273
2022-10-17 02:44:04 +02:00
committed by GitHub
parent a5a92c4dca
commit fe00c1c10b
9 changed files with 19 additions and 29 deletions

View File

@@ -1,5 +1,4 @@
using Content.Shared.Doors.Components; using Content.Shared.Doors.Components;
using Robust.Shared.GameObjects;
namespace Content.Client.Doors; namespace Content.Client.Doors;

View File

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

View File

@@ -112,6 +112,12 @@ namespace Content.Server.Doors.Components
} }
} }
/// <summary>
/// True if the bolt wire is cut, which will force the airlock to always be bolted as long as it has power.
/// </summary>
[ViewVariables]
public bool BoltWireCut;
/// <summary> /// <summary>
/// Whether the airlock should auto close. This value is reset every time the airlock closes. /// Whether the airlock should auto close. This value is reset every time the airlock closes.
/// </summary> /// </summary>

View File

@@ -48,6 +48,8 @@ namespace Content.Server.Doors.Systems
} }
else else
{ {
if (component.BoltWireCut)
component.SetBoltsWithAudio(true);
UpdateAutoClose(uid, door: door); UpdateAutoClose(uid, door: door);
} }

View File

@@ -2,7 +2,6 @@ using Content.Server.Access;
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems; using Content.Server.Atmos.EntitySystems;
using Content.Server.Construction; using Content.Server.Construction;
using Content.Server.Construction.Components;
using Content.Server.Doors.Components; using Content.Server.Doors.Components;
using Content.Server.Tools; using Content.Server.Tools;
using Content.Server.Tools.Systems; using Content.Server.Tools.Systems;
@@ -271,7 +270,6 @@ public sealed class DoorSystem : SharedDoorSystem
if (Tags.HasTag(otherUid, "DoorBumpOpener")) if (Tags.HasTag(otherUid, "DoorBumpOpener"))
TryOpen(uid, door, otherUid); TryOpen(uid, door, otherUid);
} }
private void OnEmagged(EntityUid uid, DoorComponent door, GotEmaggedEvent args) private void OnEmagged(EntityUid uid, DoorComponent door, GotEmaggedEvent args)
{ {
if(TryComp<AirlockComponent>(uid, out var airlockComponent)) if(TryComp<AirlockComponent>(uid, out var airlockComponent))

View File

@@ -38,18 +38,19 @@ public sealed class DoorBoltWireAction : BaseWireAction
{ {
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door)) if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
{ {
if (!door.BoltsDown) door.BoltWireCut = true;
{ if (!door.BoltsDown && IsPowered(wire.Owner))
door.SetBoltsWithAudio(true); door.SetBoltsWithAudio(true);
} }
}
return true; return true;
} }
// does nothing
public override bool Mend(EntityUid user, Wire wire) public override bool Mend(EntityUid user, Wire wire)
{ {
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
door.BoltWireCut = false;
return true; return true;
} }

View File

@@ -84,7 +84,7 @@ namespace Content.Server.Remotes
_doorSystem.TryToggleDoor(doorComp.Owner, doorComp, args.Used); _doorSystem.TryToggleDoor(doorComp.Owner, doorComp, args.Used);
break; break;
case OperatingMode.ToggleBolts: case OperatingMode.ToggleBolts:
//TODO: What about cut wires...? if (!airlockComp.BoltWireCut)
airlockComp.SetBoltsWithAudio(!airlockComp.IsBolted()); airlockComp.SetBoltsWithAudio(!airlockComp.IsBolted());
break; break;
case OperatingMode.ToggleEmergencyAccess: case OperatingMode.ToggleEmergencyAccess:

View File

@@ -91,8 +91,6 @@
value: false value: false
- !type:WirePanel {} - !type:WirePanel {}
- !type:AllWiresCut - !type:AllWiresCut
ignoreTypes:
- !type:DoorBoltWireAction
completed: completed:
- !type:EmptyAllContainers {} - !type:EmptyAllContainers {}
steps: steps:
@@ -131,8 +129,6 @@
value: false value: false
- !type:WirePanel {} - !type:WirePanel {}
- !type:AllWiresCut - !type:AllWiresCut
ignoreTypes:
- !type:DoorBoltWireAction
completed: completed:
- !type:SpawnPrototype - !type:SpawnPrototype
prototype: SheetRGlass1 prototype: SheetRGlass1

View File

@@ -113,8 +113,6 @@
value: false value: false
- !type:WirePanel {} - !type:WirePanel {}
- !type:AllWiresCut - !type:AllWiresCut
ignoreTypes:
- !type:DoorBoltWireAction
completed: completed:
- !type:EmptyAllContainers {} - !type:EmptyAllContainers {}
steps: steps:
@@ -216,8 +214,6 @@
- !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated - !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated
container: board container: board
- !type:AllWiresCut - !type:AllWiresCut
ignoreTypes:
- !type:DoorBoltWireAction
completed: completed:
- !type:EmptyAllContainers {} - !type:EmptyAllContainers {}
steps: steps: