Make InteractionActivate check for hands like UserInteraction (#7277)

This commit is contained in:
DrSmugleaf
2022-03-25 22:10:50 +01:00
committed by GitHub
parent e563b0b7e1
commit e8025a6e17

View File

@@ -7,24 +7,24 @@ using Content.Shared.Database;
using Content.Shared.Hands.Components; using Content.Shared.Hands.Components;
using Content.Shared.Input; using Content.Shared.Input;
using Content.Shared.Interaction.Components; using Content.Shared.Interaction.Components;
using Content.Shared.Interaction.Events;
using Content.Shared.Item;
using Content.Shared.Physics; using Content.Shared.Physics;
using Content.Shared.Popups; using Content.Shared.Popups;
using Content.Shared.Throwing; using Content.Shared.Throwing;
using Content.Shared.Timing; using Content.Shared.Timing;
using Content.Shared.Verbs; using Content.Shared.Verbs;
using Content.Shared.Wall;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding; using Robust.Shared.Input.Binding;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Physics; using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Players; using Robust.Shared.Players;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Content.Shared.Wall;
using Content.Shared.Item;
using Robust.Shared.Player;
using Robust.Shared.Input;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.Interaction.Events;
#pragma warning disable 618 #pragma warning disable 618
@@ -215,7 +215,6 @@ namespace Content.Shared.Interaction
return; return;
// Does the user have hands? // Does the user have hands?
Hand? hand;
if (!TryComp(user, out SharedHandsComponent? hands) || hands.ActiveHand == null) if (!TryComp(user, out SharedHandsComponent? hands) || hands.ActiveHand == null)
return; return;
@@ -736,6 +735,10 @@ namespace Content.Shared.Interaction
if (checkAccess && !ContainerSystem.IsInSameOrParentContainer(user, used) && !CanAccessViaStorage(user, used)) if (checkAccess && !ContainerSystem.IsInSameOrParentContainer(user, used) && !CanAccessViaStorage(user, used))
return false; return false;
// Does the user have hands?
if (!HasComp<SharedHandsComponent>(user))
return false;
var activateMsg = new ActivateInWorldEvent(user, used); var activateMsg = new ActivateInWorldEvent(user, used);
RaiseLocalEvent(used, activateMsg); RaiseLocalEvent(used, activateMsg);
if (activateMsg.Handled) if (activateMsg.Handled)
@@ -744,7 +747,7 @@ namespace Content.Shared.Interaction
_adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}"); _adminLogSystem.Add(LogType.InteractActivate, LogImpact.Low, $"{ToPrettyString(user):user} activated {ToPrettyString(used):used}");
return true; return true;
} }
var activatable = AllComps<IActivate>(used).FirstOrDefault(); var activatable = AllComps<IActivate>(used).FirstOrDefault();
if (activatable == null) if (activatable == null)
return false; return false;