* XAML verb menu * fix ghost FOV * spacing * rename missed "ContextMenu"->"EntityMenu" instances * move visibility checks to verb system * update comment * Remove CanSeeContainerCheck * use ScrollContainer measure option * MaxWidth / texxt line wrapping * verb category default Now when you click on a verb category, it should default to running the first member of that category. This makes it much more convenient to eject/insert when there is only a single option * only apply style to first verb category entry * Use new visibility flags * FoV -> Fov * Revert "only apply style to first verb category entry" This reverts commit 9a6a17dba600e3ae0421caed59fcab145c260c99. * make all entity menu visibility checks clientside * Fix empty unbuckle category * fix merge
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using Content.Shared.Verbs;
|
|
using Robust.Shared.Containers;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Localization;
|
|
|
|
namespace Content.Shared.Item
|
|
{
|
|
public class ItemSystem : EntitySystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<SharedItemComponent, GetInteractionVerbsEvent>(AddPickupVerb);
|
|
}
|
|
|
|
private void AddPickupVerb(EntityUid uid, SharedItemComponent component, GetInteractionVerbsEvent args)
|
|
{
|
|
if (args.Hands == null ||
|
|
args.Using != null ||
|
|
!args.CanAccess ||
|
|
!args.CanInteract ||
|
|
!component.CanPickup(args.User, popup: false))
|
|
return;
|
|
|
|
Verb verb = new();
|
|
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)
|
|
verb.Text = Loc.GetString("pick-up-verb-get-data-text-inventory");
|
|
else
|
|
verb.Text = Loc.GetString("pick-up-verb-get-data-text");
|
|
|
|
args.Verbs.Add(verb);
|
|
}
|
|
}
|
|
}
|