fix airlocks inconsistently auto-closing after unbolting (#33524)
fix door auto close timer
This commit is contained in:
@@ -22,6 +22,7 @@ public abstract class SharedAirlockSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorClosedEvent>(OnBeforeDoorClosed);
|
||||
SubscribeLocalEvent<AirlockComponent, DoorStateChangedEvent>(OnStateChanged);
|
||||
SubscribeLocalEvent<AirlockComponent, DoorBoltsChangedEvent>(OnBoltsChanged);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
|
||||
SubscribeLocalEvent<AirlockComponent, BeforeDoorDeniedEvent>(OnBeforeDoorDenied);
|
||||
SubscribeLocalEvent<AirlockComponent, GetPryTimeModifierEvent>(OnGetPryMod);
|
||||
@@ -70,6 +71,13 @@ public abstract class SharedAirlockSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
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))
|
||||
@@ -145,7 +153,7 @@ public abstract class SharedAirlockSystem : EntitySystem
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user