* Fix firelock prediction issues with periodic pulses of closing lights
For some reason this function was setting a time for the next state
which was triggering the door system to try to close the firelock.
This does not happen serverside because the function only fires from an
event called clientside apparently.
It appears to be an attempt to stop firelocks from closing instantly
that did not function properly, and I cannot discern any other purpose.
As such I have removed it.
* Remove redundant serverside check
This became redundant with commit
439a87f2
{
base.Initialize();
-
- SubscribeLocalEvent<FirelockComponent, BeforeDoorAutoCloseEvent>(OnBeforeDoorAutoclose);
SubscribeLocalEvent<FirelockComponent, AtmosAlarmEvent>(OnAtmosAlarm);
SubscribeLocalEvent<FirelockComponent, PowerChangedEvent>(PowerChanged);
}
}
- private void OnBeforeDoorAutoclose(EntityUid uid, FirelockComponent component, BeforeDoorAutoCloseEvent args)
- {
- if (!this.IsPowered(uid, EntityManager))
- args.Cancel();
-
- // Make firelocks autoclose, but only if the last alarm type it
- // remembers was a danger. This is to prevent people from
- // flooding hallways with endless bad air/fire.
- if (component.AlarmAutoClose &&
- (_atmosAlarmable.TryGetHighestAlert(uid, out var alarm) && alarm != AtmosAlarmType.Danger || alarm == null))
- args.Cancel();
- }
-
private void OnAtmosAlarm(EntityUid uid, FirelockComponent component, AtmosAlarmEvent args)
{
if (!this.IsPowered(uid, EntityManager))
[DataField("lockedPryTimeModifier"), ViewVariables(VVAccess.ReadWrite)]
public float LockedPryTimeModifier = 1.5f;
- [DataField("autocloseDelay")] public TimeSpan AutocloseDelay = TimeSpan.FromSeconds(3f);
-
/// <summary>
/// Maximum pressure difference before the firelock will refuse to open, in kPa.
/// </summary>
{
base.Initialize();
- SubscribeLocalEvent<FirelockComponent, DoorStateChangedEvent>(OnUpdateState);
-
// Access/Prying
SubscribeLocalEvent<FirelockComponent, BeforeDoorOpenedEvent>(OnBeforeDoorOpened);
SubscribeLocalEvent<FirelockComponent, GetPryTimeModifierEvent>(OnDoorGetPryTimeModifier);
return _doorSystem.OnPartialClose(uid, door);
}
- private void OnUpdateState(EntityUid uid, FirelockComponent component, DoorStateChangedEvent args)
- {
- var ev = new BeforeDoorAutoCloseEvent();
- RaiseLocalEvent(uid, ev);
- UpdateVisuals(uid, component, args);
- if (ev.Cancelled)
- {
- return;
- }
-
- _doorSystem.SetNextStateChange(uid, component.AutocloseDelay);
- }
-
#region Access/Prying
private void OnBeforeDoorOpened(EntityUid uid, FirelockComponent component, BeforeDoorOpenedEvent args)