Pacification Prevents Throwing Weapons (#1433)

# Description

Prevents entities who are Pacified (through the Pacifist trait or being
a thief) from throwing items that deal damage on hit or embed.

## Technical Details

Two components will prevent throwing if they deal any damage:
`DamageOtherOnHitComponent` and `EmbedPassiveComponent`.

The pacifist check on `EmbeddableProjectileComponent` has been removed,
because just because an item is embeddable does not mean they deal
damage.

## Media

**Throw attempt with the Pacifist trait**

![image](https://github.com/user-attachments/assets/6c439bb3-b41b-4f30-975d-4fa15c2cfa6d)

# Changelog

🆑 Skubman
- fix: Pacified characters (Pacifist trait and thieves) can no longer
throw items that deal throwing damage.

---------

Signed-off-by: VMSolidus <evilexecutive@gmail.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>
(cherry picked from commit 71e3c031750db523f8fcccc4a36a61200b1028f2)
This commit is contained in:
Skubman
2025-01-06 02:30:14 +08:00
committed by Spatison
parent 9ff281a14e
commit b63a41d6e9
4 changed files with 27 additions and 12 deletions

View File

@@ -3,7 +3,6 @@ using System.Numerics;
using Content.Shared._White.Penetrated;
using Content.Shared._White.Projectile;
using Content.Shared.Body.Systems;
using Content.Shared.CombatMode.Pacification;
using Content.Shared.Damage;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
@@ -52,7 +51,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
SubscribeLocalEvent<EmbeddableProjectileComponent, ThrowDoHitEvent>(OnEmbedThrowDoHit);
SubscribeLocalEvent<EmbeddableProjectileComponent, ActivateInWorldEvent>(OnEmbedActivate, before: new[] {typeof(ActivatableUISystem)}); // WD EDIT
SubscribeLocalEvent<EmbeddableProjectileComponent, RemoveEmbeddedProjectileEvent>(OnEmbedRemove);
SubscribeLocalEvent<EmbeddableProjectileComponent, AttemptPacifiedThrowEvent>(OnAttemptPacifiedThrow);
SubscribeLocalEvent<EmbeddableProjectileComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<EmbeddableProjectileComponent, PreventCollideEvent>(OnPreventCollision); // WD EDIT
}
@@ -217,14 +215,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
Dirty(id, component);
}
/// <summary>
/// Prevent players with the Pacified status effect from throwing embeddable projectiles.
/// </summary>
private void OnAttemptPacifiedThrow(Entity<EmbeddableProjectileComponent> ent, ref AttemptPacifiedThrowEvent args)
{
args.Cancel("pacified-cannot-throw-embed");
}
private void OnExamined(EntityUid uid, EmbeddableProjectileComponent component, ExaminedEvent args)
{
if (!(component.Target is {} target))