using Content.Shared.Strip.Components;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
+using Robust.Client.Player;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input;
[UsedImplicitly]
public sealed class StrippableBoundUserInterface : BoundUserInterface
{
+ [Dependency] private readonly IPlayerManager _player = default!;
[Dependency] private readonly IUserInterfaceManager _ui = default!;
+
private readonly ExamineSystem _examine;
private readonly InventorySystem _inv;
private readonly SharedCuffableSystem _cuffable;
+ private readonly StrippableSystem _strippable;
[ViewVariables]
private const int ButtonSeparation = 4;
_examine = EntMan.System<ExamineSystem>();
_inv = EntMan.System<InventorySystem>();
_cuffable = EntMan.System<SharedCuffableSystem>();
+ _strippable = EntMan.System<StrippableSystem>();
+
_virtualHiddenEntity = EntMan.SpawnEntity(HiddenPocketEntityId, MapCoordinates.Nullspace);
}
var entity = container.ContainedEntity;
// If this is a full pocket, obscure the real entity
- if (entity != null && slotDef.StripHidden)
+ // this does not work for modified clients because they are still sent the real entity
+ if (entity != null && _strippable.IsStripHidden(slotDef, _player.LocalEntity))
entity = _virtualHiddenEntity;
var button = new SlotButton(new SlotData(slotDef, container));
using Content.Shared.Players.RateLimiting;
using Content.Shared.Popups;
using Content.Shared.Storage;
+using Content.Shared.Strip;
using Content.Shared.Tag;
using Content.Shared.Timing;
using Content.Shared.UserInterface;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly TagSystem _tagSystem = default!;
[Dependency] private readonly SharedUserInterfaceSystem _ui = default!;
+ [Dependency] private readonly SharedStrippableSystem _strippable = default!;
[Dependency] private readonly SharedPlayerRateLimitManager _rateLimit = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly ISharedChatManager _chat = default!;
if (wearer == user)
return true;
- if (slotDef.StripHidden)
+ if (_strippable.IsStripHidden(slotDef, user))
return false;
return InRangeUnobstructed(user, wearer) && _containerSystem.IsInSameOrParentContainer(user, wearer);
using Content.Shared.Item;
using Content.Shared.Movement.Systems;
using Content.Shared.Popups;
+using Content.Shared.Strip;
using Content.Shared.Strip.Components;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems;
[Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
+ [Dependency] private readonly SharedStrippableSystem _strippable = default!;
[ValidatePrototypeId<ItemSizePrototype>]
private const string PocketableItemSize = "Small";
var enumerator = new InventorySlotEnumerator(component);
while (enumerator.NextItem(out var item, out var slotDef))
{
- if (!slotDef.StripHidden || args.User == uid)
+ if (!_strippable.IsStripHidden(slotDef, args.User) || args.User == uid)
RaiseLocalEvent(item, ev);
}
}
using System.Numerics;
+using Content.Shared.Strip;
using Content.Shared.Whitelist;
using Robust.Shared.Prototypes;
[DataField("displayName", required: true)]
public string DisplayName { get; private set; } = string.Empty;
+ /// <summary>
+ /// Whether or not this slot will have its item hidden in the strip menu, and block interactions.
+ /// <seealso cref="SharedStrippableSystem.IsStripHidden"/>
+ /// </summary>
[DataField("stripHidden")] public bool StripHidden { get; private set; }
/// <summary>
using Content.Shared.Hands.EntitySystems;
using Content.Shared.IdentityManagement;
using Content.Shared.Interaction;
+using Content.Shared.Interaction.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Inventory;
using Content.Shared.Inventory.VirtualItem;
if (!stealth)
{
- if (slotDef.StripHidden)
+ if (IsStripHidden(slotDef, user))
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner-hidden", ("slot", slot)), target, target, PopupType.Large);
else
_popupSystem.PopupEntity(Loc.GetString("strippable-component-alert-owner", ("user", Identity.Entity(user, EntityManager)), ("item", item)), target, target, PopupType.Large);
if (args.CanDrop)
args.Handled = true;
}
+
+ public bool IsStripHidden(SlotDefinition definition, EntityUid? viewer)
+ {
+ if (!definition.StripHidden)
+ return false;
+
+ if (viewer == null)
+ return true;
+
+ return !HasComp<BypassInteractionChecksComponent>(viewer);
+ }
}