Hotfix door bumps (#8665)
Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
@@ -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