Keep windoors open if they are clicked (#11180)
This commit is contained in:
@@ -50,6 +50,13 @@ namespace Content.Server.Doors.Components
|
|||||||
[DataField("openPanelVisible")]
|
[DataField("openPanelVisible")]
|
||||||
public bool OpenPanelVisible = false;
|
public bool OpenPanelVisible = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the airlock should stay open if the airlock was clicked.
|
||||||
|
/// If the airlock was bumped into it will still auto close.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("keepOpenIfClicked")]
|
||||||
|
public bool KeepOpenIfClicked = false;
|
||||||
|
|
||||||
private CancellationTokenSource _powerWiresPulsedTimerCancel = new();
|
private CancellationTokenSource _powerWiresPulsedTimerCancel = new();
|
||||||
private bool _powerWiresPulsed;
|
private bool _powerWiresPulsed;
|
||||||
|
|
||||||
@@ -105,6 +112,12 @@ namespace Content.Server.Doors.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the airlock should auto close. This value is reset every time the airlock closes.
|
||||||
|
/// </summary>
|
||||||
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
public bool AutoClose = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delay until an open door automatically closes.
|
/// Delay until an open door automatically closes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ namespace Content.Server.Doors.Systems
|
|||||||
component.UpdateBoltLightStatus();
|
component.UpdateBoltLightStatus();
|
||||||
|
|
||||||
UpdateAutoClose(uid, component);
|
UpdateAutoClose(uid, component);
|
||||||
|
|
||||||
|
// Make sure the airlock auto closes again next time it is opened
|
||||||
|
if (args.State == DoorState.Closed)
|
||||||
|
component.AutoClose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -84,6 +88,9 @@ namespace Content.Server.Doors.Systems
|
|||||||
if (door.State != DoorState.Open)
|
if (door.State != DoorState.Open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!airlock.AutoClose)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!airlock.CanChangeState())
|
if (!airlock.CanChangeState())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -133,6 +140,13 @@ namespace Content.Server.Doors.Systems
|
|||||||
{
|
{
|
||||||
_wiresSystem.OpenUserInterface(uid, actor.PlayerSession);
|
_wiresSystem.OpenUserInterface(uid, actor.PlayerSession);
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component.KeepOpenIfClicked)
|
||||||
|
{
|
||||||
|
// Disable auto close
|
||||||
|
component.AutoClose = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
acts: [ "Destruction" ]
|
acts: [ "Destruction" ]
|
||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
- type: Airlock
|
- type: Airlock
|
||||||
|
keepOpenIfClicked: true
|
||||||
openPanelVisible: true
|
openPanelVisible: true
|
||||||
# needed so that windoors will close regardless of whether there are people in it; it doesn't crush after all
|
# needed so that windoors will close regardless of whether there are people in it; it doesn't crush after all
|
||||||
safety: false
|
safety: false
|
||||||
|
|||||||
Reference in New Issue
Block a user