Fixes disposals not flushing down humans.

- Also works around https://github.com/space-wizards/RobustToolbox/issues/1646
This commit is contained in:
Vera Aguilera Puerto
2021-03-19 19:11:22 +01:00
parent bd150ca02f
commit 2e65aaf1b2
2 changed files with 14 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
#nullable enable #nullable enable
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Server.Atmos; using Content.Server.Atmos;
@@ -6,8 +7,10 @@ using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.Interfaces; using Content.Server.Interfaces;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.GameObjects.Components.Body; using Content.Shared.GameObjects.Components.Body;
using Robust.Shared.Asynchronous;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Physics; using Robust.Shared.Physics;
@@ -23,6 +26,7 @@ namespace Content.Server.GameObjects.Components.Disposal
{ {
public override string Name => "DisposalHolder"; public override string Name => "DisposalHolder";
private bool _deletionRequested = false;
private Container _contents = null!; private Container _contents = null!;
/// <summary> /// <summary>
@@ -77,12 +81,6 @@ namespace Content.Server.GameObjects.Components.Disposal
return false; return false;
} }
if (!entity.TryGetComponent(out IPhysBody? physics) ||
!physics.CanCollide)
{
return false;
}
return entity.HasComponent<ItemComponent>() || return entity.HasComponent<ItemComponent>() ||
entity.HasComponent<IBody>(); entity.HasComponent<IBody>();
} }
@@ -118,6 +116,9 @@ namespace Content.Server.GameObjects.Components.Disposal
public void ExitDisposals() public void ExitDisposals()
{ {
if (_deletionRequested || Deleted)
return;
PreviousTube = null; PreviousTube = null;
CurrentTube = null; CurrentTube = null;
NextTube = null; NextTube = null;
@@ -146,8 +147,9 @@ namespace Content.Server.GameObjects.Components.Disposal
Air.Clear(); Air.Clear();
} }
if (!Deleted) // FIXME: This is a workaround for https://github.com/space-wizards/RobustToolbox/issues/1646
Owner.Delete(); Owner.SpawnTimer(TimeSpan.Zero, () => Owner.Delete());
_deletionRequested = true;
} }
public void Update(float frameTime) public void Update(float frameTime)

View File

@@ -0,0 +1,4 @@
author: Zumorica
changes:
- type: Fix
message: Fixes not being able to flush humans down disposal units.