Refactor IDoorCheck into entity events (#4366)
* IDoorCheck refactored to events # Conflicts: # Content.Server/Atmos/TileAtmosphere.cs # Content.Server/Doors/Components/AirlockComponent.cs # Content.Server/Doors/Components/FirelockComponent.cs # Content.Server/Doors/Components/ServerDoorComponent.cs # Content.Server/Doors/IDoorCheck.cs * namespaces * Fix mapinit bug with refreshautoclose * ok i guess these just didnt feel like staging today
This commit is contained in:
63
Content.Server/Doors/Systems/DoorSystem.cs
Normal file
63
Content.Server/Doors/Systems/DoorSystem.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using Content.Server.Doors.Components;
|
||||
using Content.Shared.Doors;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Content.Server.Doors
|
||||
{
|
||||
/// <summary>
|
||||
/// Used on the server side to manage global access level overrides.
|
||||
/// </summary>
|
||||
internal sealed class DoorSystem : SharedDoorSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// Determines the base access behavior of all doors on the station.
|
||||
/// </summary>
|
||||
public AccessTypes AccessType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// How door access should be handled.
|
||||
/// </summary>
|
||||
public enum AccessTypes
|
||||
{
|
||||
/// <summary> ID based door access. </summary>
|
||||
Id,
|
||||
/// <summary>
|
||||
/// Allows everyone to open doors, except external which airlocks are still handled with ID's
|
||||
/// </summary>
|
||||
AllowAllIdExternal,
|
||||
/// <summary>
|
||||
/// Allows everyone to open doors, except external airlocks which are never allowed, even if the user has
|
||||
/// ID access.
|
||||
/// </summary>
|
||||
AllowAllNoExternal,
|
||||
/// <summary> Allows everyone to open all doors. </summary>
|
||||
AllowAll
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
AccessType = AccessTypes.Id;
|
||||
SubscribeLocalEvent<ServerDoorComponent, StartCollideEvent>(HandleCollide);
|
||||
}
|
||||
|
||||
private void HandleCollide(EntityUid uid, ServerDoorComponent component, StartCollideEvent args)
|
||||
{
|
||||
if (component.State != SharedDoorComponent.DoorState.Closed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!component.BumpOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Disabled because it makes it suck hard to walk through double doors.
|
||||
|
||||
component.TryOpen(args.OtherFixture.Body.Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user