Airlock bolt and deconstruction fixes (#11985)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using Content.Shared.Doors.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Doors;
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
using System.Linq;
|
||||
using Content.Server.Wires;
|
||||
using Content.Server.Wires;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.Examine;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Reflection;
|
||||
|
||||
namespace Content.Server.Construction.Conditions
|
||||
{
|
||||
@@ -17,22 +15,13 @@ 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:
|
||||
@@ -46,6 +35,9 @@ namespace Content.Server.Construction.Conditions
|
||||
|
||||
public bool DoExamine(ExaminedEvent args)
|
||||
{
|
||||
if (Condition(args.Examined, IoCManager.Resolve<IEntityManager>()))
|
||||
return false;
|
||||
|
||||
args.PushMarkup(Loc.GetString(Value
|
||||
? "construction-examine-condition-all-wires-cut"
|
||||
: "construction-examine-condition-all-wires-intact"));
|
||||
|
||||
@@ -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>
|
||||
/// Whether the airlock should auto close. This value is reset every time the airlock closes.
|
||||
/// </summary>
|
||||
|
||||
@@ -48,6 +48,8 @@ namespace Content.Server.Doors.Systems
|
||||
}
|
||||
else
|
||||
{
|
||||
if (component.BoltWireCut)
|
||||
component.SetBoltsWithAudio(true);
|
||||
UpdateAutoClose(uid, door: door);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using Content.Server.Access;
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Construction.Components;
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Server.Tools;
|
||||
using Content.Server.Tools.Systems;
|
||||
@@ -271,7 +270,6 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
if (Tags.HasTag(otherUid, "DoorBumpOpener"))
|
||||
TryOpen(uid, door, otherUid);
|
||||
}
|
||||
|
||||
private void OnEmagged(EntityUid uid, DoorComponent door, GotEmaggedEvent args)
|
||||
{
|
||||
if(TryComp<AirlockComponent>(uid, out var airlockComponent))
|
||||
|
||||
@@ -38,18 +38,19 @@ public sealed class DoorBoltWireAction : BaseWireAction
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
{
|
||||
if (!door.BoltsDown)
|
||||
{
|
||||
door.BoltWireCut = true;
|
||||
if (!door.BoltsDown && IsPowered(wire.Owner))
|
||||
door.SetBoltsWithAudio(true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// does nothing
|
||||
public override bool Mend(EntityUid user, Wire wire)
|
||||
{
|
||||
if (EntityManager.TryGetComponent<AirlockComponent>(wire.Owner, out var door))
|
||||
door.BoltWireCut = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Content.Server.Remotes
|
||||
_doorSystem.TryToggleDoor(doorComp.Owner, doorComp, args.Used);
|
||||
break;
|
||||
case OperatingMode.ToggleBolts:
|
||||
//TODO: What about cut wires...?
|
||||
if (!airlockComp.BoltWireCut)
|
||||
airlockComp.SetBoltsWithAudio(!airlockComp.IsBolted());
|
||||
break;
|
||||
case OperatingMode.ToggleEmergencyAccess:
|
||||
|
||||
@@ -91,8 +91,6 @@
|
||||
value: false
|
||||
- !type:WirePanel {}
|
||||
- !type:AllWiresCut
|
||||
ignoreTypes:
|
||||
- !type:DoorBoltWireAction
|
||||
completed:
|
||||
- !type:EmptyAllContainers {}
|
||||
steps:
|
||||
@@ -131,8 +129,6 @@
|
||||
value: false
|
||||
- !type:WirePanel {}
|
||||
- !type:AllWiresCut
|
||||
ignoreTypes:
|
||||
- !type:DoorBoltWireAction
|
||||
completed:
|
||||
- !type:SpawnPrototype
|
||||
prototype: SheetRGlass1
|
||||
|
||||
@@ -113,8 +113,6 @@
|
||||
value: false
|
||||
- !type:WirePanel {}
|
||||
- !type:AllWiresCut
|
||||
ignoreTypes:
|
||||
- !type:DoorBoltWireAction
|
||||
completed:
|
||||
- !type:EmptyAllContainers {}
|
||||
steps:
|
||||
@@ -216,8 +214,6 @@
|
||||
- !type:ContainerNotEmpty # TODO ShadowCommander: Remove when map gets updated
|
||||
container: board
|
||||
- !type:AllWiresCut
|
||||
ignoreTypes:
|
||||
- !type:DoorBoltWireAction
|
||||
completed:
|
||||
- !type:EmptyAllContainers {}
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user