Hotfix door bumps (#8665)
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
@@ -25,11 +25,10 @@ namespace Content.Server.Doors.Systems;
|
||||
|
||||
public sealed class DoorSystem : SharedDoorSystem
|
||||
{
|
||||
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
|
||||
[Dependency] private readonly AirtightSystem _airtightSystem = default!;
|
||||
[Dependency] private readonly ConstructionSystem _constructionSystem = default!;
|
||||
[Dependency] private readonly ToolSystem _toolSystem = default!;
|
||||
[Dependency] private readonly AirtightSystem _airtightSystem = default!;
|
||||
[Dependency] private readonly AccessReaderSystem _accessReaderSystem = default!;
|
||||
[Dependency] private readonly TagSystem _tagSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -239,7 +238,7 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
|
||||
var otherUid = args.OtherFixture.Body.Owner;
|
||||
|
||||
if (_tagSystem.HasTag(otherUid, "DoorBumpOpener"))
|
||||
if (Tags.HasTag(otherUid, "DoorBumpOpener"))
|
||||
TryOpen(uid, door, otherUid);
|
||||
}
|
||||
|
||||
@@ -298,6 +297,18 @@ public sealed class DoorSystem : SharedDoorSystem
|
||||
if(lastState == DoorState.Emagging && TryComp<AirlockComponent>(door.Owner, out var airlockComponent))
|
||||
airlockComponent?.SetBoltsWithAudio(!airlockComponent.IsBolted());
|
||||
}
|
||||
|
||||
protected override void CheckDoorBump(DoorComponent component, PhysicsComponent body)
|
||||
{
|
||||
if (component.BumpOpen)
|
||||
{
|
||||
foreach (var other in PhysicsSystem.GetCollidingEntities(body))
|
||||
{
|
||||
if (Tags.HasTag(other.Owner, "DoorBumpOpener") &&
|
||||
TryOpen(component.Owner, component, other.Owner)) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PryFinishedEvent : EntityEventArgs { }
|
||||
|
||||
@@ -10,14 +10,16 @@ using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Timing;
|
||||
using System.Linq;
|
||||
using Content.Shared.Tag;
|
||||
|
||||
namespace Content.Shared.Doors.Systems;
|
||||
|
||||
public abstract class SharedDoorSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||
[Dependency] protected readonly SharedPhysicsSystem PhysicsSystem = default!;
|
||||
[Dependency] private readonly DamageableSystem _damageableSystem = default!;
|
||||
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
|
||||
[Dependency] protected readonly TagSystem Tags = default!;
|
||||
[Dependency] protected readonly IGameTiming GameTiming = default!;
|
||||
|
||||
/// <summary>
|
||||
@@ -139,15 +141,18 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
break;
|
||||
|
||||
case DoorState.Open:
|
||||
case DoorState.Closed:
|
||||
door.Partial = false;
|
||||
if (door.NextStateChange == null)
|
||||
_activeDoors.Remove(door);
|
||||
break;
|
||||
case DoorState.Closed:
|
||||
// May want to keep the door around to re-check for opening if we got a contact during closing.
|
||||
door.Partial = false;
|
||||
break;
|
||||
}
|
||||
|
||||
door.State = state;
|
||||
door.Dirty();
|
||||
Dirty(door);
|
||||
RaiseLocalEvent(uid, new DoorStateChangedEvent(state), false);
|
||||
UpdateAppearance(uid, door);
|
||||
}
|
||||
@@ -280,7 +285,7 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
door.Partial = true;
|
||||
door.NextStateChange = GameTiming.CurTime + door.CloseTimeTwo;
|
||||
_activeDoors.Add(door);
|
||||
door.Dirty();
|
||||
Dirty(door);
|
||||
|
||||
}
|
||||
#endregion
|
||||
@@ -335,7 +340,7 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
return false;
|
||||
|
||||
door.Partial = true;
|
||||
door.Dirty();
|
||||
Dirty(door);
|
||||
|
||||
// Make sure no entity waled into the airlock when it started closing.
|
||||
if (!CanClose(uid, door))
|
||||
@@ -417,7 +422,7 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
// TODO SLOTH fix electro's code.
|
||||
var doorAABB = physics.GetWorldAABB();
|
||||
|
||||
foreach (var otherPhysics in _physicsSystem.GetCollidingEntities(Transform(uid).MapID, doorAABB))
|
||||
foreach (var otherPhysics in PhysicsSystem.GetCollidingEntities(Transform(uid).MapID, doorAABB))
|
||||
{
|
||||
if (otherPhysics == physics)
|
||||
continue;
|
||||
@@ -536,9 +541,19 @@ public abstract class SharedDoorSystem : EntitySystem
|
||||
|
||||
if (door.NextStateChange.Value < time)
|
||||
NextState(door, time);
|
||||
|
||||
if (door.State == DoorState.Closed &&
|
||||
TryComp<PhysicsComponent>(door.Owner, out var doorBody))
|
||||
{
|
||||
// If something bumped into us during closing then start to re-open, otherwise, remove it from active.
|
||||
_activeDoors.Remove(door);
|
||||
CheckDoorBump(door, doorBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void CheckDoorBump(DoorComponent component, PhysicsComponent body) {}
|
||||
|
||||
/// <summary>
|
||||
/// Makes a door proceed to the next state (if applicable).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user