Make combat check CanInteract (#7046)
This commit is contained in:
@@ -298,6 +298,11 @@ namespace Content.Server.Interaction
|
|||||||
if (!ValidateInteractAndFace(user, coordinates))
|
if (!ValidateInteractAndFace(user, coordinates))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Check general interaction blocking.
|
||||||
|
if (!_actionBlockerSystem.CanInteract(user, target))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Check combat-specific action blocking.
|
||||||
if (!_actionBlockerSystem.CanAttack(user, target))
|
if (!_actionBlockerSystem.CanAttack(user, target))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Content.Shared.Interaction.Events;
|
using Content.Shared.Interaction.Events;
|
||||||
using Content.Shared.Item;
|
using Content.Shared.Item;
|
||||||
using Content.Shared.Movement;
|
using Content.Shared.Movement;
|
||||||
using Content.Shared.Throwing;
|
using Content.Shared.Throwing;
|
||||||
@@ -14,7 +14,6 @@ public sealed class AdminFrozenSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<AdminFrozenComponent, UseAttemptEvent>((_, _, args) => args.Cancel());
|
SubscribeLocalEvent<AdminFrozenComponent, UseAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
SubscribeLocalEvent<AdminFrozenComponent, PickupAttemptEvent>((_, _, args) => args.Cancel());
|
SubscribeLocalEvent<AdminFrozenComponent, PickupAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
SubscribeLocalEvent<AdminFrozenComponent, ThrowAttemptEvent>((_, _, args) => args.Cancel());
|
SubscribeLocalEvent<AdminFrozenComponent, ThrowAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>((_, _, args) => args.Cancel());
|
|
||||||
SubscribeLocalEvent<AdminFrozenComponent, MovementAttemptEvent>((_, _, args) => args.Cancel());
|
SubscribeLocalEvent<AdminFrozenComponent, MovementAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
SubscribeLocalEvent<AdminFrozenComponent, InteractionAttemptEvent>((_, _, args) => args.Cancel());
|
SubscribeLocalEvent<AdminFrozenComponent, InteractionAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ namespace Content.Shared.Cuffs
|
|||||||
SubscribeLocalEvent<SharedCuffableComponent, InteractionAttemptEvent>(OnInteractAttempt);
|
SubscribeLocalEvent<SharedCuffableComponent, InteractionAttemptEvent>(OnInteractAttempt);
|
||||||
SubscribeLocalEvent<SharedCuffableComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
SubscribeLocalEvent<SharedCuffableComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
||||||
SubscribeLocalEvent<SharedCuffableComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
SubscribeLocalEvent<SharedCuffableComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
||||||
SubscribeLocalEvent<SharedCuffableComponent, AttackAttemptEvent>(OnAttackAttempt);
|
|
||||||
SubscribeLocalEvent<SharedCuffableComponent, DropAttemptEvent>(OnDropAttempt);
|
SubscribeLocalEvent<SharedCuffableComponent, DropAttemptEvent>(OnDropAttempt);
|
||||||
SubscribeLocalEvent<SharedCuffableComponent, PickupAttemptEvent>(OnPickupAttempt);
|
SubscribeLocalEvent<SharedCuffableComponent, PickupAttemptEvent>(OnPickupAttempt);
|
||||||
}
|
}
|
||||||
@@ -75,11 +74,6 @@ namespace Content.Shared.Cuffs
|
|||||||
CheckAct(uid, component, args);
|
CheckAct(uid, component, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttackAttempt(EntityUid uid, SharedCuffableComponent component, AttackAttemptEvent args)
|
|
||||||
{
|
|
||||||
CheckAct(uid, component, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDropAttempt(EntityUid uid, SharedCuffableComponent component, DropAttemptEvent args)
|
private void OnDropAttempt(EntityUid uid, SharedCuffableComponent component, DropAttemptEvent args)
|
||||||
{
|
{
|
||||||
CheckAct(uid, component, args);
|
CheckAct(uid, component, args);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.DragDrop;
|
using Content.Shared.DragDrop;
|
||||||
using Content.Shared.Emoting;
|
using Content.Shared.Emoting;
|
||||||
@@ -21,7 +21,6 @@ namespace Content.Shared.Ghost
|
|||||||
SubscribeLocalEvent<SharedGhostComponent, UseAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<SharedGhostComponent, UseAttemptEvent>(OnAttempt);
|
||||||
SubscribeLocalEvent<SharedGhostComponent, InteractionAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<SharedGhostComponent, InteractionAttemptEvent>(OnAttempt);
|
||||||
SubscribeLocalEvent<SharedGhostComponent, EmoteAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<SharedGhostComponent, EmoteAttemptEvent>(OnAttempt);
|
||||||
SubscribeLocalEvent<SharedGhostComponent, AttackAttemptEvent>(OnAttempt);
|
|
||||||
SubscribeLocalEvent<SharedGhostComponent, DropAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<SharedGhostComponent, DropAttemptEvent>(OnAttempt);
|
||||||
SubscribeLocalEvent<SharedGhostComponent, PickupAttemptEvent>(OnAttempt);
|
SubscribeLocalEvent<SharedGhostComponent, PickupAttemptEvent>(OnAttempt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Shared.Interaction.Events
|
namespace Content.Shared.Interaction.Events
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Raised Directed at a user to check whether they are allowed to attack a target.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Combat will also check the general interaction blockers, so this event should only be used for combat-specific
|
||||||
|
/// action blocking.
|
||||||
|
/// </remarks>
|
||||||
public sealed class AttackAttemptEvent : CancellableEntityEventArgs
|
public sealed class AttackAttemptEvent : CancellableEntityEventArgs
|
||||||
{
|
{
|
||||||
public EntityUid Uid { get; }
|
public EntityUid Uid { get; }
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace Content.Shared.MobState.EntitySystems
|
|||||||
SubscribeLocalEvent<MobStateComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
SubscribeLocalEvent<MobStateComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
||||||
SubscribeLocalEvent<MobStateComponent, EmoteAttemptEvent>(OnEmoteAttempt);
|
SubscribeLocalEvent<MobStateComponent, EmoteAttemptEvent>(OnEmoteAttempt);
|
||||||
SubscribeLocalEvent<MobStateComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
SubscribeLocalEvent<MobStateComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
||||||
SubscribeLocalEvent<MobStateComponent, AttackAttemptEvent>(OnAttackAttempt);
|
|
||||||
SubscribeLocalEvent<MobStateComponent, DropAttemptEvent>(OnDropAttempt);
|
SubscribeLocalEvent<MobStateComponent, DropAttemptEvent>(OnDropAttempt);
|
||||||
SubscribeLocalEvent<MobStateComponent, PickupAttemptEvent>(OnPickupAttempt);
|
SubscribeLocalEvent<MobStateComponent, PickupAttemptEvent>(OnPickupAttempt);
|
||||||
SubscribeLocalEvent<MobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
|
SubscribeLocalEvent<MobStateComponent, StartPullAttemptEvent>(OnStartPullAttempt);
|
||||||
@@ -96,11 +95,6 @@ namespace Content.Shared.MobState.EntitySystems
|
|||||||
CheckAct(uid, component, args);
|
CheckAct(uid, component, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttackAttempt(EntityUid uid, MobStateComponent component, AttackAttemptEvent args)
|
|
||||||
{
|
|
||||||
CheckAct(uid, component, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDropAttempt(EntityUid uid, MobStateComponent component, DropAttemptEvent args)
|
private void OnDropAttempt(EntityUid uid, MobStateComponent component, DropAttemptEvent args)
|
||||||
{
|
{
|
||||||
CheckAct(uid, component, args);
|
CheckAct(uid, component, args);
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace Content.Shared.PAI
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<PAIComponent, UseAttemptEvent>(OnUseAttempt);
|
SubscribeLocalEvent<PAIComponent, UseAttemptEvent>(OnUseAttempt);
|
||||||
SubscribeLocalEvent<PAIComponent, InteractionAttemptEvent>(OnInteractAttempt);
|
SubscribeLocalEvent<PAIComponent, InteractionAttemptEvent>(OnInteractAttempt);
|
||||||
SubscribeLocalEvent<PAIComponent, AttackAttemptEvent>(OnAttackAttempt);
|
|
||||||
SubscribeLocalEvent<PAIComponent, DropAttemptEvent>(OnDropAttempt);
|
SubscribeLocalEvent<PAIComponent, DropAttemptEvent>(OnDropAttempt);
|
||||||
SubscribeLocalEvent<PAIComponent, PickupAttemptEvent>(OnPickupAttempt);
|
SubscribeLocalEvent<PAIComponent, PickupAttemptEvent>(OnPickupAttempt);
|
||||||
SubscribeLocalEvent<PAIComponent, MovementAttemptEvent>(OnMoveAttempt);
|
SubscribeLocalEvent<PAIComponent, MovementAttemptEvent>(OnMoveAttempt);
|
||||||
@@ -54,11 +53,6 @@ namespace Content.Shared.PAI
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttackAttempt(EntityUid uid, PAIComponent component, AttackAttemptEvent args)
|
|
||||||
{
|
|
||||||
args.Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDropAttempt(EntityUid uid, PAIComponent component, DropAttemptEvent args)
|
private void OnDropAttempt(EntityUid uid, PAIComponent component, DropAttemptEvent args)
|
||||||
{
|
{
|
||||||
args.Cancel();
|
args.Cancel();
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ namespace Content.Shared.Stunnable
|
|||||||
SubscribeLocalEvent<StunnedComponent, ThrowAttemptEvent>(OnThrowAttempt);
|
SubscribeLocalEvent<StunnedComponent, ThrowAttemptEvent>(OnThrowAttempt);
|
||||||
SubscribeLocalEvent<StunnedComponent, DropAttemptEvent>(OnDropAttempt);
|
SubscribeLocalEvent<StunnedComponent, DropAttemptEvent>(OnDropAttempt);
|
||||||
SubscribeLocalEvent<StunnedComponent, PickupAttemptEvent>(OnPickupAttempt);
|
SubscribeLocalEvent<StunnedComponent, PickupAttemptEvent>(OnPickupAttempt);
|
||||||
SubscribeLocalEvent<StunnedComponent, AttackAttemptEvent>(OnAttackAttempt);
|
|
||||||
SubscribeLocalEvent<StunnedComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
SubscribeLocalEvent<StunnedComponent, IsEquippingAttemptEvent>(OnEquipAttempt);
|
||||||
SubscribeLocalEvent<StunnedComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
SubscribeLocalEvent<StunnedComponent, IsUnequippingAttemptEvent>(OnUnequipAttempt);
|
||||||
}
|
}
|
||||||
@@ -236,11 +235,6 @@ namespace Content.Shared.Stunnable
|
|||||||
args.Cancel();
|
args.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAttackAttempt(EntityUid uid, StunnedComponent stunned, AttackAttemptEvent args)
|
|
||||||
{
|
|
||||||
args.Cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnEquipAttempt(EntityUid uid, StunnedComponent stunned, IsEquippingAttemptEvent args)
|
private void OnEquipAttempt(EntityUid uid, StunnedComponent stunned, IsEquippingAttemptEvent args)
|
||||||
{
|
{
|
||||||
// is this a self-equip, or are they being stripped?
|
// is this a self-equip, or are they being stripped?
|
||||||
|
|||||||
Reference in New Issue
Block a user