diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 4e7a68d20d..3b0c064360 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -7,6 +7,8 @@ using Content.Server.DoAfter; using Content.Server.Hands.Components; using Content.Server.Power.Components; using Content.Server.UserInterface; +using Content.Server.Storage.Components; +using Content.Server.Storage.EntitySystems; using Content.Shared.ActionBlocker; using Content.Shared.Atmos; using Content.Shared.Construction.Components; @@ -21,6 +23,7 @@ using Content.Shared.Movement; using Content.Shared.Movement.Events; using Content.Shared.Throwing; using Content.Shared.Verbs; +using Content.Shared.Storage.Components; using Robust.Server.GameObjects; using Robust.Shared.Audio; using Robust.Shared.Containers; @@ -38,6 +41,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems [Dependency] private readonly AtmosphereSystem _atmosSystem = default!; [Dependency] private readonly DoAfterSystem _doAfterSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!; + [Dependency] private readonly DumpableSystem _dumpableSystem = default!; private readonly List _activeDisposals = new(); @@ -65,7 +69,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems // Verbs SubscribeLocalEvent>(AddInsertVerb); - SubscribeLocalEvent>(AddFlushEjectVerbs); + SubscribeLocalEvent>(AddDisposalAltVerbs); SubscribeLocalEvent>(AddClimbInsideVerb); // Units @@ -75,25 +79,48 @@ namespace Content.Server.Disposal.Unit.EntitySystems SubscribeLocalEvent(OnUiButtonPressed); } - private void AddFlushEjectVerbs(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) + private void AddDisposalAltVerbs(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) { - if (!args.CanAccess || !args.CanInteract || component.Container.ContainedEntities.Count == 0) + if (!args.CanAccess || !args.CanInteract) return; - // Verbs to flush the unit - AlternativeVerb flushVerb = new(); - flushVerb.Act = () => Engage(component); - flushVerb.Text = Loc.GetString("disposal-flush-verb-get-data-text"); - flushVerb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"; - flushVerb.Priority = 1; - args.Verbs.Add(flushVerb); + // Behavior for if the disposals bin has items in it + if (component.Container.ContainedEntities.Count > 0) + { + // Verbs to flush the unit + AlternativeVerb flushVerb = new(); + flushVerb.Act = () => Engage(component); + flushVerb.Text = Loc.GetString("disposal-flush-verb-get-data-text"); + flushVerb.IconTexture = "/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"; + flushVerb.Priority = 1; + args.Verbs.Add(flushVerb); + + // Verb to eject the contents + AlternativeVerb ejectVerb = new() + { + Act = () => TryEjectContents(component), + Category = VerbCategory.Eject, + Text = Loc.GetString("disposal-eject-verb-contents") + }; + args.Verbs.Add(ejectVerb); + } + + // Behavior if using a trash bag & other dumpable containers + if (args.Using != null + && TryComp(args.Using.Value, out var dumpable) + && TryComp(args.Using.Value, out var storage) + && storage.StoredEntities is { Count: > 0 }) + { + // Verb to dump held container into disposal unit + AlternativeVerb dumpVerb = new() + { + Act = () => _dumpableSystem.StartDoAfter(args.Using.Value, args.Target, args.User, dumpable, storage), + Text = Loc.GetString("dump-disposal-verb-name", ("unit", args.Target)), + Priority = 2 + }; + args.Verbs.Add(dumpVerb); + } - // Verb to eject the contents - AlternativeVerb ejectVerb = new(); - ejectVerb.Act = () => TryEjectContents(component); - ejectVerb.Category = VerbCategory.Eject; - ejectVerb.Text = Loc.GetString("disposal-eject-verb-contents"); - args.Verbs.Add(ejectVerb); } private void AddClimbInsideVerb(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent args) diff --git a/Content.Server/Storage/EntitySystems/DumpableSystem.cs b/Content.Server/Storage/EntitySystems/DumpableSystem.cs index 5390322efb..9e9b4d9b05 100644 --- a/Content.Server/Storage/EntitySystems/DumpableSystem.cs +++ b/Content.Server/Storage/EntitySystems/DumpableSystem.cs @@ -102,7 +102,7 @@ namespace Content.Server.Storage.EntitySystems } } - private void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable, ServerStorageComponent storage, float multiplier = 1) + public void StartDoAfter(EntityUid storageUid, EntityUid? targetUid, EntityUid userUid, DumpableComponent dumpable, ServerStorageComponent storage, float multiplier = 1) { if (dumpable.CancelToken != null) { diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/cigar.yml b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/cigar.yml index d88cb2e330..feda9610d7 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/cigar.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/Cigars/cigar.yml @@ -14,6 +14,7 @@ - type: Tag tags: - Cigar + - Trash - type: Clothing sprite: Objects/Consumable/Smokeables/Cigars/cigar.rsi Slots: [ mask ] diff --git a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml index b2762653ae..a85a26d524 100644 --- a/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml +++ b/Resources/Prototypes/Entities/Objects/Consumable/Smokeables/base_smokeables.yml @@ -25,6 +25,9 @@ - type: Smokable exposeTemperature: 1173.15 - type: Cigar + - type: Tag + tags: + - Trash - type: InjectableSolution solution: smokable - type: SolutionContainerManager