network airlock AutoClose (#32124)

* network airlock AutoClose

* least stupid language

* great language

---------

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2024-09-14 00:51:51 +00:00
committed by GitHub
parent beced35e17
commit b11fdd5f0b
3 changed files with 8 additions and 3 deletions

View File

@@ -35,9 +35,10 @@ public sealed class AirlockSystem : SharedAirlockSystem
private void OnSignalReceived(EntityUid uid, AirlockComponent component, ref SignalReceivedEvent args) private void OnSignalReceived(EntityUid uid, AirlockComponent component, ref SignalReceivedEvent args)
{ {
if (args.Port == component.AutoClosePort) if (args.Port == component.AutoClosePort && component.AutoClose)
{ {
component.AutoClose = false; component.AutoClose = false;
Dirty(uid, component);
} }
} }
@@ -84,10 +85,11 @@ public sealed class AirlockSystem : SharedAirlockSystem
return; return;
} }
if (component.KeepOpenIfClicked) if (component.KeepOpenIfClicked && component.AutoClose)
{ {
// Disable auto close // Disable auto close
component.AutoClose = false; component.AutoClose = false;
Dirty(uid, component);
} }
} }
} }

View File

@@ -48,7 +48,7 @@ public sealed partial class AirlockComponent : Component
/// <summary> /// <summary>
/// Whether the airlock should auto close. This value is reset every time the airlock closes. /// Whether the airlock should auto close. This value is reset every time the airlock closes.
/// </summary> /// </summary>
[ViewVariables(VVAccess.ReadWrite)] [DataField, AutoNetworkedField]
public bool AutoClose = true; public bool AutoClose = true;
/// <summary> /// <summary>

View File

@@ -56,7 +56,10 @@ public abstract class SharedAirlockSystem : EntitySystem
// Make sure the airlock auto closes again next time it is opened // Make sure the airlock auto closes again next time it is opened
if (args.State == DoorState.Closed) if (args.State == DoorState.Closed)
{
component.AutoClose = true; component.AutoClose = true;
Dirty(uid, component);
}
} }
private void OnBeforeDoorOpened(EntityUid uid, AirlockComponent component, BeforeDoorOpenedEvent args) private void OnBeforeDoorOpened(EntityUid uid, AirlockComponent component, BeforeDoorOpenedEvent args)