Fix the stripping menu being openable without StrippingComponent (#26908)

This commit is contained in:
DrSmugleaf
2024-04-12 16:22:07 -07:00
committed by GitHub
parent 998bf45368
commit 24b6456735
2 changed files with 6 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using Content.Server.Administration.Logs; using Content.Server.Administration.Logs;
using Content.Server.Ensnaring; using Content.Server.Ensnaring;
using Content.Shared.CombatMode; using Content.Shared.CombatMode;
@@ -20,7 +21,6 @@ using Content.Shared.Verbs;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.Player; using Robust.Shared.Player;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Linq;
namespace Content.Server.Strip namespace Content.Server.Strip
{ {
@@ -111,7 +111,7 @@ namespace Content.Server.Strip
if (TryComp<CombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat) if (TryComp<CombatModeComponent>(user, out var mode) && mode.IsInCombatMode && !openInCombat)
return; return;
if (TryComp<ActorComponent>(user, out var actor)) if (TryComp<ActorComponent>(user, out var actor) && HasComp<StrippingComponent>(user))
{ {
if (_userInterfaceSystem.SessionHasOpenUi(strippable, StrippingUiKey.Key, actor.PlayerSession)) if (_userInterfaceSystem.SessionHasOpenUi(strippable, StrippingUiKey.Key, actor.PlayerSession))
return; return;

View File

@@ -43,14 +43,16 @@ public abstract class SharedStrippableSystem : EntitySystem
args.Handled = true; args.Handled = true;
args.CanDrop |= uid == args.User && args.CanDrop |= uid == args.User &&
HasComp<StrippableComponent>(args.Dragged) && HasComp<StrippableComponent>(args.Dragged) &&
HasComp<HandsComponent>(args.User); HasComp<HandsComponent>(args.User) &&
HasComp<StrippingComponent>(args.User);
} }
private void OnCanDrop(EntityUid uid, StrippableComponent component, ref CanDropDraggedEvent args) private void OnCanDrop(EntityUid uid, StrippableComponent component, ref CanDropDraggedEvent args)
{ {
args.CanDrop |= args.Target == args.User && args.CanDrop |= args.Target == args.User &&
HasComp<StrippingComponent>(args.User) && HasComp<StrippingComponent>(args.User) &&
HasComp<HandsComponent>(args.User); HasComp<HandsComponent>(args.User) &&
HasComp<StrippingComponent>(args.User);
if (args.CanDrop) if (args.CanDrop)
args.Handled = true; args.Handled = true;