Fix dumping into disposals (#19736)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using Content.Shared.Disposal;
|
using Content.Shared.Disposal;
|
||||||
using Content.Shared.Disposal.Components;
|
using Content.Shared.Disposal.Components;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
@@ -53,6 +54,16 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||||||
return HasComp<DisposalUnitComponent>(uid);
|
return HasComp<DisposalUnitComponent>(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool ResolveDisposals(EntityUid uid, [NotNullWhen(true)] ref SharedDisposalUnitComponent? component)
|
||||||
|
{
|
||||||
|
if (component != null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
TryComp<DisposalUnitComponent>(uid, out var storage);
|
||||||
|
component = storage;
|
||||||
|
return component != null;
|
||||||
|
}
|
||||||
|
|
||||||
public override void DoInsertDisposalUnit(EntityUid uid, EntityUid toInsert, EntityUid user, SharedDisposalUnitComponent? disposal = null)
|
public override void DoInsertDisposalUnit(EntityUid uid, EntityUid toInsert, EntityUid user, SharedDisposalUnitComponent? disposal = null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration.Logs;
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Server.Atmos.EntitySystems;
|
using Content.Server.Atmos.EntitySystems;
|
||||||
@@ -200,7 +201,7 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||||||
|
|
||||||
public override void DoInsertDisposalUnit(EntityUid uid, EntityUid toInsert, EntityUid user, SharedDisposalUnitComponent? disposal = null)
|
public override void DoInsertDisposalUnit(EntityUid uid, EntityUid toInsert, EntityUid user, SharedDisposalUnitComponent? disposal = null)
|
||||||
{
|
{
|
||||||
if (!Resolve(uid, ref disposal))
|
if (!ResolveDisposals(uid, ref disposal))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!disposal.Container.Insert(toInsert))
|
if (!disposal.Container.Insert(toInsert))
|
||||||
@@ -737,6 +738,16 @@ public sealed class DisposalUnitSystem : SharedDisposalUnitSystem
|
|||||||
return HasComp<DisposalUnitComponent>(uid);
|
return HasComp<DisposalUnitComponent>(uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool ResolveDisposals(EntityUid uid, [NotNullWhen(true)] ref SharedDisposalUnitComponent? component)
|
||||||
|
{
|
||||||
|
if (component != null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
TryComp<DisposalUnitComponent>(uid, out var storage);
|
||||||
|
component = storage;
|
||||||
|
return component != null;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool CanInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid entity)
|
public override bool CanInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid entity)
|
||||||
{
|
{
|
||||||
if (!base.CanInsert(uid, component, entity) || component is not SharedDisposalUnitComponent serverComp)
|
if (!base.CanInsert(uid, component, entity) || component is not SharedDisposalUnitComponent serverComp)
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using Content.Shared.Item;
|
|||||||
using Content.Shared.Mobs.Components;
|
using Content.Shared.Mobs.Components;
|
||||||
using Content.Shared.Mobs.Systems;
|
using Content.Shared.Mobs.Systems;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Robust.Shared.Audio;
|
using Robust.Shared.Audio;
|
||||||
using Robust.Shared.Physics.Components;
|
using Robust.Shared.Physics.Components;
|
||||||
using Robust.Shared.Physics.Events;
|
using Robust.Shared.Physics.Events;
|
||||||
@@ -37,6 +36,8 @@ public abstract class SharedDisposalUnitSystem : EntitySystem
|
|||||||
|
|
||||||
public abstract bool HasDisposals([NotNullWhen(true)] EntityUid? uid);
|
public abstract bool HasDisposals([NotNullWhen(true)] EntityUid? uid);
|
||||||
|
|
||||||
|
public abstract bool ResolveDisposals(EntityUid uid, [NotNullWhen(true)] ref SharedDisposalUnitComponent? component);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current pressure state of a disposals unit.
|
/// Gets the current pressure state of a disposals unit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user