Trashbag Alt Verb to dump into disposals + Cigars are tagged as trash (#9203)
* cigars are marked as trash * alt click added to trashbag disposals interaction * request changes * remove redundant check and auto refactor Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
parent
c0216e5caf
commit
a73a6042d7
|
|
@ -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<DisposalUnitComponent> _activeDisposals = new();
|
||||
|
||||
|
|
@ -65,7 +69,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||
|
||||
// Verbs
|
||||
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<InteractionVerb>>(AddInsertVerb);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<AlternativeVerb>>(AddFlushEjectVerbs);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<AlternativeVerb>>(AddDisposalAltVerbs);
|
||||
SubscribeLocalEvent<DisposalUnitComponent, GetVerbsEvent<Verb>>(AddClimbInsideVerb);
|
||||
|
||||
// Units
|
||||
|
|
@ -75,25 +79,48 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
|||
SubscribeLocalEvent<DisposalUnitComponent, SharedDisposalUnitComponent.UiButtonPressedMessage>(OnUiButtonPressed);
|
||||
}
|
||||
|
||||
private void AddFlushEjectVerbs(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent<AlternativeVerb> args)
|
||||
private void AddDisposalAltVerbs(EntityUid uid, DisposalUnitComponent component, GetVerbsEvent<AlternativeVerb> 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<DumpableComponent>(args.Using.Value, out var dumpable)
|
||||
&& TryComp<ServerStorageComponent>(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<Verb> args)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
- type: Tag
|
||||
tags:
|
||||
- Cigar
|
||||
- Trash
|
||||
- type: Clothing
|
||||
sprite: Objects/Consumable/Smokeables/Cigars/cigar.rsi
|
||||
Slots: [ mask ]
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
- type: Smokable
|
||||
exposeTemperature: 1173.15
|
||||
- type: Cigar
|
||||
- type: Tag
|
||||
tags:
|
||||
- Trash
|
||||
- type: InjectableSolution
|
||||
solution: smokable
|
||||
- type: SolutionContainerManager
|
||||
|
|
|
|||
Loading…
Reference in New Issue