2022-01-30 13:49:56 +13:00
|
|
|
using Content.Server.Access;
|
|
|
|
|
using Content.Server.Atmos.Components;
|
|
|
|
|
using Content.Server.Atmos.EntitySystems;
|
2024-02-22 18:01:31 -05:00
|
|
|
using Content.Server.Power.Components;
|
2022-01-30 13:49:56 +13:00
|
|
|
using Content.Shared.Doors.Components;
|
|
|
|
|
using Content.Shared.Doors.Systems;
|
2022-09-14 17:26:26 +10:00
|
|
|
using Robust.Shared.Physics.Components;
|
2021-02-12 07:02:14 -08:00
|
|
|
|
2022-01-30 13:49:56 +13:00
|
|
|
namespace Content.Server.Doors.Systems;
|
|
|
|
|
|
|
|
|
|
public sealed class DoorSystem : SharedDoorSystem
|
2021-02-12 07:02:14 -08:00
|
|
|
{
|
2022-06-12 11:15:53 +10:00
|
|
|
[Dependency] private readonly AirtightSystem _airtightSystem = default!;
|
2022-01-30 13:49:56 +13:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
|
2024-02-22 18:01:31 -05:00
|
|
|
SubscribeLocalEvent<DoorBoltComponent, PowerChangedEvent>(OnBoltPowerChanged);
|
2023-06-17 12:09:49 +10:00
|
|
|
}
|
|
|
|
|
|
2023-01-15 15:38:59 +11:00
|
|
|
protected override void SetCollidable(
|
|
|
|
|
EntityUid uid,
|
|
|
|
|
bool collidable,
|
2022-02-20 08:34:01 +13:00
|
|
|
DoorComponent? door = null,
|
|
|
|
|
PhysicsComponent? physics = null,
|
|
|
|
|
OccluderComponent? occluder = null)
|
2022-01-30 20:30:24 +13:00
|
|
|
{
|
2022-02-20 08:34:01 +13:00
|
|
|
if (!Resolve(uid, ref door))
|
|
|
|
|
return;
|
2022-01-30 20:30:24 +13:00
|
|
|
|
2022-02-20 08:34:01 +13:00
|
|
|
if (door.ChangeAirtight && TryComp(uid, out AirtightComponent? airtight))
|
2023-10-19 12:34:31 -07:00
|
|
|
_airtightSystem.SetAirblocked((uid, airtight), collidable);
|
2022-02-20 08:34:01 +13:00
|
|
|
|
|
|
|
|
// Pathfinding / AI stuff.
|
2022-05-16 13:21:00 +10:00
|
|
|
RaiseLocalEvent(new AccessReaderChangeEvent(uid, collidable));
|
2022-02-20 08:34:01 +13:00
|
|
|
|
|
|
|
|
base.SetCollidable(uid, collidable, door, physics, occluder);
|
2022-01-30 20:30:24 +13:00
|
|
|
}
|
|
|
|
|
|
2024-02-22 18:01:31 -05:00
|
|
|
private void OnBoltPowerChanged(Entity<DoorBoltComponent> ent, ref PowerChangedEvent args)
|
2023-09-28 11:34:21 +00:00
|
|
|
{
|
2024-02-22 18:01:31 -05:00
|
|
|
if (args.Powered)
|
2023-09-28 11:34:21 +00:00
|
|
|
{
|
2024-02-22 18:01:31 -05:00
|
|
|
if (ent.Comp.BoltWireCut)
|
|
|
|
|
SetBoltsDown(ent, true);
|
2023-09-28 11:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
2024-02-22 18:01:31 -05:00
|
|
|
UpdateBoltLightStatus(ent);
|
|
|
|
|
ent.Comp.Powered = args.Powered;
|
|
|
|
|
Dirty(ent, ent.Comp);
|
2022-06-12 11:15:53 +10:00
|
|
|
}
|
2021-02-12 07:02:14 -08:00
|
|
|
}
|