Use AttackAttempt for pax (#11844)
This commit is contained in:
@@ -1,18 +1,26 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Interaction.Events;
|
||||
|
||||
namespace Content.Shared.CombatMode.Pacification
|
||||
{
|
||||
public sealed class PacificationSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<PacifiedComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<PacifiedComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<PacifiedComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<PacifiedComponent, AttackAttemptEvent>(OnAttackAttempt);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, PacifiedComponent component, ComponentInit args)
|
||||
private void OnAttackAttempt(EntityUid uid, PacifiedComponent component, AttackAttemptEvent args)
|
||||
{
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnStartup(EntityUid uid, PacifiedComponent component, ComponentStartup args)
|
||||
{
|
||||
if (!TryComp<SharedCombatModeComponent>(uid, out var combatMode))
|
||||
return;
|
||||
@@ -34,6 +42,7 @@ namespace Content.Shared.CombatMode.Pacification
|
||||
|
||||
if (combatMode.CanDisarm != null)
|
||||
combatMode.CanDisarm = true;
|
||||
|
||||
if (combatMode.CombatToggleAction != null)
|
||||
_actionsSystem.SetEnabled(combatMode.CombatToggleAction, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user