]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Let Pacifists Use Certain Guns(Foam Weapons) (#29835)
authorCojoke <83733158+Cojoke-dot@users.noreply.github.com>
Tue, 9 Jul 2024 13:46:21 +0000 (08:46 -0500)
committerGitHub <noreply@github.com>
Tue, 9 Jul 2024 13:46:21 +0000 (23:46 +1000)
Let Pacifists Use Certain Guns(foam)

Content.Shared/CombatMode/Pacification/PacificationSystem.cs
Content.Shared/CombatMode/Pacification/PacifismAllowedGunComponent.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Objects/Fun/toys.yml
Resources/Prototypes/Entities/Objects/Weapons/Guns/Rifles/rifles.yml

index 14507ce1f5ce494ac5d79e2c595fa661c43492e2..6bc32c5b96c688dd3075b0af24e9b421b6b466e1 100644 (file)
@@ -62,6 +62,9 @@ public sealed class PacificationSystem : EntitySystem
 
     private void OnShootAttempt(Entity<PacifiedComponent> ent, ref ShotAttemptedEvent args)
     {
+        if (HasComp<PacifismAllowedGunComponent>(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 (file)
index 0000000..7decbeb
--- /dev/null
@@ -0,0 +1,11 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.CombatMode.Pacification;
+
+/// <summary>
+/// Guns with this component can be fired by pacifists
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class PacifismAllowedGunComponent : Component
+{
+}
index 1ac622db86c804402177e9927e86c7bb5310a333..310f92e60c31c56af39319b7e5476dc14ba730d6 100644 (file)
   - type: Sprite
   - type: Item
     size: Normal
+  - type: PacifismAllowedGun
 
 - type: entity
   parent: FoamWeaponBase
index 9300367cdec3d319b1857ea22eabac1d90b8bb44..fef793487c2d505621eb44fa839509a43d450a9e 100644 (file)
     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
     soundEmpty:
       path: /Audio/Weapons/Guns/Empty/empty.ogg
     clumsyProof: true
+  - type: PacifismAllowedGun