Conveyor belt fix (#12713)

Fixes https://github.com/space-wizards/space-station-14/issues/12704
This commit is contained in:
Mervill
2022-11-22 23:38:39 -08:00
committed by GitHub
parent 57754cb8b3
commit ac588ab15c

View File

@@ -7,6 +7,8 @@ using JetBrains.Annotations;
using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Physics;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Physics.Components;
namespace Content.Server.Disposal.Unit.EntitySystems
{
@@ -17,6 +19,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
[Dependency] private readonly DisposalUnitSystem _disposalUnitSystem = default!;
[Dependency] private readonly DisposalTubeSystem _disposalTubeSystem = default!;
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
public void ExitDisposals(EntityUid uid, DisposalHolderComponent? holder = null, TransformComponent? holderTransform = null)
{
@@ -50,13 +53,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems
{
RemComp<BeingDisposedComponent>(entity);
if (EntityManager.TryGetComponent(entity, out IPhysBody? physics))
{
physics.CanCollide = true;
}
var meta = MetaData(entity);
holder.Container.ForceRemove(entity, EntityManager, meta);
holder.Container.Remove(entity, EntityManager, meta: meta, reparent: false, force: true);
var xform = Transform(entity);
if (xform.ParentUid != uid)
@@ -66,6 +64,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems
duc.Container.Insert(entity, EntityManager, xform, meta: meta);
else
xform.AttachToGridOrMap();
if (EntityManager.TryGetComponent(entity, out PhysicsComponent? physics))
{
_physicsSystem.WakeBody(entity, physics);
}
}
if (duc != null)
@@ -174,7 +177,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
// Past this point, we are performing inter-tube transfer!
// Remove current tube content
currentTube.Contents.ForceRemove(holder.Owner);
currentTube.Contents.Remove(holder.Owner, reparent: false, force: true);
// Find next tube
var nextTube = _disposalTubeSystem.NextTubeFor(currentTube.Owner, holder.CurrentDirection);