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

@@ -561,7 +561,7 @@ namespace Content.Shared.Hands.Components
/// <summary>
/// Attempts to interact with the item in a hand using the active held item.
/// </summary>
public async void InteractHandWithActiveHand(string handName)
public void InteractHandWithActiveHand(string handName)
{
if (!TryGetActiveHeldEntity(out var activeHeldEntity))
return;
@@ -572,7 +572,7 @@ namespace Content.Shared.Hands.Components
if (activeHeldEntity == heldEntity)
return;
await EntitySystem.Get<SharedInteractionSystem>()
EntitySystem.Get<SharedInteractionSystem>()
.InteractUsing(Owner, activeHeldEntity.Value, heldEntity.Value, EntityCoordinates.Invalid);
}
@@ -585,7 +585,7 @@ namespace Content.Shared.Hands.Components
if (altInteract)
sys.AltInteract(Owner, heldEntity.Value);
else
sys.TryUseInteraction(Owner, heldEntity.Value);
sys.UseInHandInteraction(Owner, heldEntity.Value);
}
public void ActivateHeldEntity(string handName)
@@ -594,7 +594,7 @@ namespace Content.Shared.Hands.Components
return;
EntitySystem.Get<SharedInteractionSystem>()
.TryInteractionActivate(Owner, heldEntity);
.InteractionActivate(Owner, heldEntity.Value);
}
/// <summary>

View File

@@ -12,7 +12,7 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
base.Initialize();
SubscribeLocalEvent<HandVirtualItemComponent, BeingEquippedAttemptEvent>(OnBeingEquippedAttempt);
SubscribeLocalEvent<HandVirtualItemComponent, BeforeInteractEvent>(HandleBeforeInteract);
SubscribeLocalEvent<HandVirtualItemComponent, BeforeRangedInteractEvent>(HandleBeforeInteract);
}
private void OnBeingEquippedAttempt(EntityUid uid, HandVirtualItemComponent component, BeingEquippedAttemptEvent args)
@@ -23,7 +23,7 @@ public abstract class SharedHandVirtualItemSystem : EntitySystem
private static void HandleBeforeInteract(
EntityUid uid,
HandVirtualItemComponent component,
BeforeInteractEvent args)
BeforeRangedInteractEvent args)
{
// No interactions with a virtual item, please.
args.Handled = true;