Predict doors and airlocks (#25419)

* predict doors and airlocks

* prying, too

* ack

* eek
This commit is contained in:
Nemanja
2024-02-22 18:01:31 -05:00
committed by GitHub
parent b7747596f1
commit ce0a51fc29
25 changed files with 444 additions and 559 deletions

View File

@@ -12,6 +12,9 @@ namespace Content.Shared.Doors.Components;
[Access(typeof(SharedAirlockSystem), Friend = AccessPermissions.ReadWriteExecute, Other = AccessPermissions.Read)]
public sealed partial class AirlockComponent : Component
{
[DataField, AutoNetworkedField]
public bool Powered;
// Need to network airlock safety state to avoid mis-predicts when a door auto-closes as the client walks through the door.
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]

View File

@@ -8,36 +8,43 @@ namespace Content.Shared.Doors.Components;
/// Companion component to DoorComponent that handles bolt-specific behavior.
/// </summary>
[RegisterComponent, NetworkedComponent]
[Access(typeof(SharedDoorBoltSystem))]
[Access(typeof(SharedDoorSystem))]
[AutoGenerateComponentState]
public sealed partial class DoorBoltComponent : Component
{
/// <summary>
/// Sound to play when the bolts on the airlock go up.
/// </summary>
[DataField("boltUpSound"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier BoltUpSound = new SoundPathSpecifier("/Audio/Machines/boltsup.ogg");
/// <summary>
/// Sound to play when the bolts on the airlock go down.
/// </summary>
[DataField("boltDownSound"), ViewVariables(VVAccess.ReadWrite)]
[DataField, ViewVariables(VVAccess.ReadWrite)]
public SoundSpecifier BoltDownSound = new SoundPathSpecifier("/Audio/Machines/boltsdown.ogg");
/// <summary>
/// Whether the door bolts are currently deployed.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public bool BoltsDown;
/// <summary>
/// Whether the bolt lights are currently enabled.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public bool BoltLightsEnabled = true;
/// <summary>
/// True if the bolt wire is cut, which will force the airlock to always be bolted as long as it has power.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public bool BoltWireCut;
/// <summary>
/// Used for prediction. true if the door has power.
/// </summary>
[DataField, AutoNetworkedField]
public bool Powered;
}

View File

@@ -124,14 +124,14 @@ public sealed partial class DoorComponent : Component
/// If false, this door is incapable of crushing entities. This just determines whether it will apply damage and
/// stun, not whether it can close despite entities being in the way.
/// </summary>
[DataField]
[DataField, AutoNetworkedField]
public bool CanCrush = true;
/// <summary>
/// Whether to check for colliding entities before closing. This may be overridden by other system by subscribing to
/// <see cref="BeforeDoorClosedEvent"/>. For example, hacked airlocks will set this to false.
/// </summary>
[DataField]
[DataField, AutoNetworkedField]
public bool PerformCollisionCheck = true;
/// <summary>
@@ -190,7 +190,7 @@ public sealed partial class DoorComponent : Component
/// The sprite state used for the door when it's being emagged.
/// </summary>
[DataField]
public string EmaggingSpriteState = "emagging";
public string EmaggingSpriteState = "sparks";
/// <summary>
/// The sprite state used for the door when it's open.