| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using Content.Server.Access;
- using Content.Server.Atmos.Components;
- using Content.Server.Atmos.EntitySystems;
- using Content.Shared.Doors.Components;
- using Content.Shared.Doors.Systems;
- using Content.Shared.Power;
- using Robust.Shared.Physics.Components;
- namespace Content.Server.Doors.Systems;
- public sealed class DoorSystem : SharedDoorSystem
- {
- [Dependency] private readonly AirtightSystem _airtightSystem = default!;
- public override void Initialize()
- {
- base.Initialize();
- SubscribeLocalEvent<DoorBoltComponent, PowerChangedEvent>(OnBoltPowerChanged);
- }
- protected override void SetCollidable(
- EntityUid uid,
- bool collidable,
- DoorComponent? door = null,
- PhysicsComponent? physics = null,
- OccluderComponent? occluder = null)
- {
- if (!Resolve(uid, ref door))
- return;
- if (door.ChangeAirtight && TryComp(uid, out AirtightComponent? airtight))
- _airtightSystem.SetAirblocked((uid, airtight), collidable);
- // Pathfinding / AI stuff.
- RaiseLocalEvent(new AccessReaderChangeEvent(uid, collidable));
- base.SetCollidable(uid, collidable, door, physics, occluder);
- }
- private void OnBoltPowerChanged(Entity<DoorBoltComponent> ent, ref PowerChangedEvent args)
- {
- if (args.Powered)
- {
- if (ent.Comp.BoltWireCut)
- SetBoltsDown(ent, true);
- }
- ent.Comp.Powered = args.Powered;
- Dirty(ent, ent.Comp);
- UpdateBoltLightStatus(ent);
- }
- }
|