Adds emergency access to airlocks (#6500)

This commit is contained in:
WlarusFromDaSpace
2022-02-09 03:13:35 +00:00
committed by GitHub
parent 21e0cd4256
commit 50b1af08a2
57 changed files with 288 additions and 27 deletions

View File

@@ -5,6 +5,7 @@ using Content.Server.Construction;
using Content.Server.Construction.Components;
using Content.Server.Tools;
using Content.Server.Tools.Components;
using Content.Server.Doors.Components;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Doors;
@@ -48,8 +49,8 @@ public sealed class DoorSystem : SharedDoorSystem
base.OnInit(uid, door, args);
if (door.State == DoorState.Open
&& door.ChangeAirtight
&& TryComp(uid, out AirtightComponent? airtight))
&& door.ChangeAirtight
&& TryComp(uid, out AirtightComponent? airtight))
{
_airtightSystem.SetAirblocked(airtight, false);
}
@@ -96,7 +97,7 @@ public sealed class DoorSystem : SharedDoorSystem
SoundSystem.Play(filter, sound, uid, audioParams);
}
#region DoAfters
#region DoAfters
/// <summary>
/// Weld or pry open a door.
/// </summary>
@@ -136,7 +137,7 @@ public sealed class DoorSystem : SharedDoorSystem
// perform a do-after delay
door.BeingWelded = true;
_toolSystem.UseTool(used, user, target, 3f, 3f, door.WeldingQuality,
new WeldFinishedEvent(), new WeldCancelledEvent(), target);
new WeldFinishedEvent(), new WeldCancelledEvent(), target);
return true; // we might not actually succeeded, but a do-after has started
}
@@ -196,7 +197,7 @@ public sealed class DoorSystem : SharedDoorSystem
else if (door.State == DoorState.Open)
StartClosing(uid, door);
}
#endregion
#endregion
/// <summary>
/// Does the user have the permissions required to open this door?
@@ -209,6 +210,10 @@ public sealed class DoorSystem : SharedDoorSystem
if (user == null || AccessType == AccessTypes.AllowAll)
return true;
// If the door is on emergency access we skip the checks.
if (TryComp<SharedAirlockComponent>(uid, out var airlock) && airlock.EmergencyAccess)
return true;
if (!Resolve(uid, ref access, false))
return true;
@@ -289,17 +294,17 @@ public sealed class DoorSystem : SharedDoorSystem
var container = uid.EnsureContainer<Container>("board", out var existed);
/* // TODO ShadowCommander: Re-enable when access is added to boards. Requires map update.
if (existed)
{
// We already contain a board. Note: We don't check if it's the right one!
if (container.ContainedEntities.Count != 0)
return;
if (existed)
{
// We already contain a board. Note: We don't check if it's the right one!
if (container.ContainedEntities.Count != 0)
return;
}
var board = Owner.EntityManager.SpawnEntity(_boardPrototype, Owner.Transform.Coordinates);
if(!container.Insert(board))
Logger.Warning($"Couldn't insert board {board} into door {Owner}!");
Logger.Warning($"Couldn't insert board {board} into door {Owner}!");
*/
}
}