Reduce action blocker uses and add target entity to CanInteract (#6655)

This commit is contained in:
Leon Friedrich
2022-02-15 17:06:52 +13:00
committed by GitHub
parent 334568dad2
commit ad9ddf1552
60 changed files with 286 additions and 402 deletions

View File

@@ -6,6 +6,7 @@ using Content.Shared.Body.Components;
using Content.Shared.Body.Part;
using Content.Shared.Climbing;
using Content.Shared.DragDrop;
using Content.Shared.Interaction.Events;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Popups;
using Robust.Shared.GameObjects;
@@ -70,7 +71,7 @@ namespace Content.Server.Climbing.Components
/// <returns></returns>
private bool CanVault(EntityUid user, EntityUid target, out string reason)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user, target))
{
reason = Loc.GetString("comp-climbable-cant-interact");
return false;
@@ -110,7 +111,17 @@ namespace Content.Server.Climbing.Components
/// <returns></returns>
private bool CanVault(EntityUid user, EntityUid dragged, EntityUid target, out string reason)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user))
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(user, dragged))
{
reason = Loc.GetString("comp-climbable-cant-interact");
return false;
}
// CanInteract() doesn't support checking a second "target" entity.
// Doing so manually:
var ev = new GettingInteractedWithAttemptEvent(user, target);
_entities.EventBus.RaiseLocalEvent(target, ev);
if (ev.Cancelled)
{
reason = Loc.GetString("comp-climbable-cant-interact");
return false;