From e66de31dd291ce57f147d9dd6e92e0cbd2ed38ad Mon Sep 17 00:00:00 2001 From: Cojoke <83733158+Cojoke-dot@users.noreply.github.com> Date: Tue, 9 Jul 2024 08:46:21 -0500 Subject: [PATCH] Let Pacifists Use Certain Guns(Foam Weapons) (#29835) Let Pacifists Use Certain Guns(foam) --- .../CombatMode/Pacification/PacificationSystem.cs | 3 +++ .../Pacification/PacifismAllowedGunComponent.cs | 11 +++++++++++ Resources/Prototypes/Entities/Objects/Fun/toys.yml | 1 + .../Entities/Objects/Weapons/Guns/Rifles/rifles.yml | 3 ++- 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 Content.Shared/CombatMode/Pacification/PacifismAllowedGunComponent.cs diff --git a/Content.Shared/CombatMode/Pacification/PacificationSystem.cs b/Content.Shared/CombatMode/Pacification/PacificationSystem.cs index 14507ce1f5ce49..6bc32c5b96c688 100644 --- a/Content.Shared/CombatMode/Pacification/PacificationSystem.cs +++ b/Content.Shared/CombatMode/Pacification/PacificationSystem.cs @@ -62,6 +62,9 @@ private void ShowPopup(Entity user, EntityUid target, string private void OnShootAttempt(Entity ent, ref ShotAttemptedEvent args) { + if (HasComp(args.Used)) + return; + // Disallow firing guns in all cases. ShowPopup(ent, args.Used, "pacified-cannot-fire-gun"); args.Cancel(); diff --git a/Content.Shared/CombatMode/Pacification/PacifismAllowedGunComponent.cs b/Content.Shared/CombatMode/Pacification/PacifismAllowedGunComponent.cs new file mode 100644 index 00000000000000..7decbeb3bc6a6e --- /dev/null +++ b/Content.Shared/CombatMode/Pacification/PacifismAllowedGunComponent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.CombatMode.Pacification; + +/// +/// Guns with this component can be fired by pacifists +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class PacifismAllowedGunComponent : Component +{ +} diff --git a/Resources/Prototypes/Entities/Objects/Fun/toys.yml b/Resources/Prototypes/Entities/Objects/Fun/toys.yml index 1ac622db86c804..310f92e60c31c5 100644 --- a/Resources/Prototypes/Entities/Objects/Fun/toys.yml +++ b/Resources/Prototypes/Entities/Objects/Fun/toys.yml @@ -869,6 +869,7 @@ - type: Sprite - type: Item size: Normal + - type: PacifismAllowedGun - type: entity parent: FoamWeaponBase diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml index 9300367cdec3d3..fef793487c2d50 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml @@ -199,7 +199,7 @@ sprite: Objects/Weapons/Guns/Rifles/foam_rifle.rsi - type: Item sprite: Objects/Weapons/Guns/Rifles/foam_rifle_inhand_64x.rsi - - type: BallisticAmmoProvider + - type: BallisticAmmoProvider whitelist: tags: - BulletFoam @@ -216,3 +216,4 @@ soundEmpty: path: /Audio/Weapons/Guns/Empty/empty.ogg clumsyProof: true + - type: PacifismAllowedGun