Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Content.Server/Disposal/Unit/DisposalUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected override void HandleAir(EntityUid uid, DisposalUnitComponent component

private void OnDestruction(EntityUid uid, DisposalUnitComponent component, DestructionEventArgs args)
{
component.IsDestroyed = true;
TryEjectContents(uid, component);
}

Expand Down
5 changes: 5 additions & 0 deletions Content.Shared/Disposal/Unit/DisposalUnitComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ public sealed partial class DisposalUnitComponent : Component
[DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoNetworkedField]
public TimeSpan? NextFlush;

/// <summary>
/// Destroyed flag for escaping race conditions
/// </summary>
public bool IsDestroyed = false;

[Serializable, NetSerializable]
public enum Visuals : byte
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Shared/Disposal/Unit/SharedDisposalUnitSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void AddInsertVerb(EntityUid uid, DisposalUnitComponent component, GetVe

private void OnDoAfter(EntityUid uid, DisposalUnitComponent component, DoAfterEvent args)
{
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null)
if (args.Handled || args.Cancelled || args.Args.Target == null || args.Args.Used == null || component.IsDestroyed)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would TerminatingOrDeleted work instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked TerminatingOrDeleted and it does not work.

return;

AfterInsert(uid, component, args.Args.Target.Value, args.Args.User, doInsert: true);
Expand Down
Loading