]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Selectively revert gun penetration (#25551)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 25 Feb 2024 10:58:08 +0000 (21:58 +1100)
committerGitHub <noreply@github.com>
Sun, 25 Feb 2024 10:58:08 +0000 (21:58 +1100)
The collision layer check doesn't work and I don't have time to fix it.

Content.Shared/Projectiles/CanPenetrateComponent.cs [deleted file]
Content.Shared/Projectiles/SharedProjectileSystem.cs
Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/grenade.yml
Resources/Prototypes/Entities/Objects/Weapons/Guns/Projectiles/projectiles.yml
Resources/Prototypes/Entities/Structures/Power/Generation/PA/particles.yml

diff --git a/Content.Shared/Projectiles/CanPenetrateComponent.cs b/Content.Shared/Projectiles/CanPenetrateComponent.cs
deleted file mode 100644 (file)
index 6134978..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-using Content.Shared.FixedPoint;
-using Content.Shared.Physics;
-using Robust.Shared.GameStates;
-
-namespace Content.Shared.Projectiles;
-
-[RegisterComponent, NetworkedComponent]
-public sealed partial class CanPenetrateComponent : Component
-{
-    /// <summary>
-    ///     Should the projectile keep the ability to deal damage after colliding.
-    /// </summary>
-    [DataField]
-    public bool DamageAfterCollide = true;
-
-    /// <summary>
-    ///     The CollisionLayer, up to and including the one set, the projectile is allowed to penetrate.
-    /// </summary>
-    ///<remarks>
-    ///     Can penetrate everything if this value is not set.
-    /// </remarks>
-    [DataField]
-    public CollisionGroup? PenetrationLayer;
-
-    /// <summary>
-    ///     How many times the projectile is allowed to deal damage.
-    /// </summary>
-    /// <remarks>
-    ///     Can deal damage on every collision if this value is not set.
-    /// </remarks>
-    [DataField]
-    public float? PenetrationPower;
-
-    /// <summary>
-    ///     Modifies the damage of a projectile after it has penetrated an entity.
-    /// </summary>
-    /// <remarks>
-    ///     Won't modify the projectile's damage if this value is not set.
-    /// </remarks>
-    [DataField]
-    public FixedPoint2? DamageModifier;
-}
index 2fa5ee1c8c27600920c5ff9dd3ab6dc583c72aa1..f57e873653962b71dd6eb4a0959e2ef676984d52 100644 (file)
@@ -169,33 +169,6 @@ public abstract partial class SharedProjectileSystem : EntitySystem
     /// </summary>
     private void AfterProjectileHit(EntityUid uid, ProjectileComponent component, ref AfterProjectileHitEvent args)
     {
-        if (!TryComp<CanPenetrateComponent>(uid, out var damageAfterCollide))
-            return;
-
-        //Delete the projectile if it hits an entity with a CollisionLayer that has a higher value than it's PenetrationLayer.
-        //This allows a projectile to only penetrate a specific set of entities.
-        if (damageAfterCollide.PenetrationLayer != null)
-        {
-            if (args.Fixture.CollisionLayer > (int) damageAfterCollide.PenetrationLayer ||
-                damageAfterCollide.PenetrationPower == 0)
-            {
-                QueueDel(uid);
-                return;
-            }
-        }
-
-        //Allow the projectile to deal damage again.
-        if(damageAfterCollide.DamageAfterCollide)
-            component.DamagedEntity = false;
-
-        //If the projectile has a limit on the amount of penetrations, reduce it.
-        if (damageAfterCollide.PenetrationPower != null)
-            damageAfterCollide.PenetrationPower -= 1;
-
-        //Apply the penetration damage modifier if the projectile has one.
-        if (damageAfterCollide.DamageModifier != null)
-            component.Damage *= damageAfterCollide.DamageModifier.Value;
-
         //Overrides the original DeleteOnCollide if the projectile passes all penetration checks.
         //This is to prevent having to set DeleteOnCollide to false on every prototype
         //you want to give the ability to penetrate entities.
index ec62121c6b944e73197c7db39abdbd7e50348f8c..7f0507d686da63300f538723d71d120587984e64 100644 (file)
@@ -12,8 +12,6 @@
     damage:
       types:
         Blunt: 4
-  - type: CanPenetrate
-    penetrationLayer: MobLayer
   - type: StaminaDamageOnCollide
     damage: 55
   - type: TimedDespawn
@@ -33,8 +31,6 @@
     damage:
       types:
         Piercing: 45
-  - type: CanPenetrate
-    penetrationLayer: MobLayer
   - type: TimedDespawn
     lifetime: 0.25
 
@@ -53,8 +49,6 @@
       types:
         Blunt: 1
         Heat: 2
-  - type: CanPenetrate
-    penetrationLayer: MobLayer
   - type: IgniteOnCollide
     fireStacks: 3
     count: 10
index a5b0a8ffa3affbd5e127b61b8ac1bab61625ba74..9445a3cfe12fd54ac50aeef644401dcfef6c199e 100644 (file)
   - type: PointLight
     radius: 3.5
     color: blue
-    energy: 0.5 
+    energy: 0.5
 
 - type: entity
   id: BulletCap
         mask:
         - Impassable
         - BulletImpassable
-  - type: CanPenetrate
-    penetrationLayer: MobLayer
   - type: Vapor
     active: true
   - type: Appearance
index 8f89c900ca9ded0db51f94201d5c87e25b681874..8d889ee5cbb25833178103f5ac7d7c7baf5ce617 100644 (file)
@@ -19,7 +19,6 @@
       damage:
         types:
           Radiation: 25
-    - type: CanPenetrate
     - type: Physics
     - type: Fixtures
       fixtures: