From 133134d9ccaa90d2a6b47b06064b6be205d44460 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 7 Feb 2022 14:54:54 +1300 Subject: [PATCH] Add insert verb to disposal units (#6463) --- .../Unit/EntitySystems/DisposalUnitSystem.cs | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs index 0fc72fe65b..7da3f24cfe 100644 --- a/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs +++ b/Content.Server/Disposal/Unit/EntitySystems/DisposalUnitSystem.cs @@ -68,6 +68,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems SubscribeLocalEvent(HandleDestruction); // Verbs + SubscribeLocalEvent(AddInsertVerb); SubscribeLocalEvent(AddFlushEjectVerbs); SubscribeLocalEvent(AddClimbInsideVerb); @@ -122,6 +123,31 @@ namespace Content.Server.Disposal.Unit.EntitySystems args.Verbs.Add(verb); } + private void AddInsertVerb(EntityUid uid, DisposalUnitComponent component, GetInteractionVerbsEvent args) + { + if (!args.CanAccess || !args.CanInteract || args.Hands == null || args.Using == null) + return; + + if (!_actionBlockerSystem.CanDrop(args.User)) + return; + + if (!CanInsert(component, args.Using.Value)) + return; + + Verb insertVerb = new() + { + Text = Name(args.Using.Value), + Category = VerbCategory.Insert, + Act = () => + { + args.Hands.Drop(args.Using.Value, component.Container); + AfterInsert(component, args.Using.Value); + } + }; + + args.Verbs.Add(insertVerb); + } + private void DoInsertDisposalUnit(DoInsertDisposalUnitEvent ev) { var toInsert = ev.ToInsert;