}
}
+ /// <summary>
+ /// Raised when the door's bolt status was changed.
+ /// </summary>
+ public sealed class DoorBoltsChangedEvent : EntityEventArgs
+ {
+ public readonly bool BoltsDown;
+
+ public DoorBoltsChangedEvent(bool boltsDown)
+ {
+ BoltsDown = boltsDown;
+ }
+ }
+
/// <summary>
/// Raised when the door is determining whether it is able to open.
/// Cancel to stop the door from being opened.
SubscribeLocalEvent<AirlockComponent, BeforeDoorClosedEvent>(OnBeforeDoorClosed);
SubscribeLocalEvent<AirlockComponent, DoorStateChangedEvent>(OnStateChanged);
+ SubscribeLocalEvent<AirlockComponent, DoorBoltsChangedEvent>(OnBoltsChanged);
SubscribeLocalEvent<AirlockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
SubscribeLocalEvent<AirlockComponent, BeforeDoorDeniedEvent>(OnBeforeDoorDenied);
SubscribeLocalEvent<AirlockComponent, GetPryTimeModifierEvent>(OnGetPryMod);
}
}
+ private void OnBoltsChanged(EntityUid uid, AirlockComponent component, DoorBoltsChangedEvent args)
+ {
+ // If unbolted, reset the auto close timer
+ if (!args.BoltsDown)
+ UpdateAutoClose(uid, component);
+ }
+
private void OnBeforeDoorOpened(EntityUid uid, AirlockComponent component, BeforeDoorOpenedEvent args)
{
if (!CanChangeState(uid, component))
ent.Comp.EmergencyAccess = value;
Dirty(ent, ent.Comp); // This only runs on the server apparently so we need this.
UpdateEmergencyLightStatus(ent, ent.Comp);
-
+
var sound = ent.Comp.EmergencyAccess ? ent.Comp.EmergencyOnSound : ent.Comp.EmergencyOffSound;
if (predicted)
Audio.PlayPredicted(sound, ent, user: user);
Dirty(ent, ent.Comp);
UpdateBoltLightStatus(ent);
+ // used to reset the auto-close timer after unbolting
+ var ev = new DoorBoltsChangedEvent(value);
+ RaiseLocalEvent(ent.Owner, ev);
+
var sound = value ? ent.Comp.BoltDownSound : ent.Comp.BoltUpSound;
if (predicted)
Audio.PlayPredicted(sound, ent, user: user);