Enable verbs for items in storage and prevent orphaned nested UIs (#5512)

This commit is contained in:
Leon Friedrich
2021-11-29 12:25:22 +13:00
committed by GitHub
parent 3601416f72
commit 22ee9f5e83
9 changed files with 190 additions and 86 deletions

View File

@@ -26,8 +26,10 @@ namespace Content.Shared.Item
verb.Act = () => args.Hands.TryPutInActiveHandOrAny(args.Target);
verb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png";
// if the item already in the user's inventory, change the text
if (args.Target.TryGetContainer(out var container) && container.Owner == args.User)
// if the item already in a container (that is not the same as the user's), then change the text.
// this occurs when the item is in their inventory or in an open backpack
args.User.TryGetContainer(out var userContainer);
if (args.Target.TryGetContainer(out var container) && container != userContainer)
verb.Text = Loc.GetString("pick-up-verb-get-data-text-inventory");
else
verb.Text = Loc.GetString("pick-up-verb-get-data-text");