diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 0061b16e47c..c26f2447467 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -2,6 +2,7 @@ using Content.Server.Effects; using Content.Server.Weapons.Ranged.Systems; using Content.Shared.Camera; +using Content.Shared.Corvax.Penetration; using Content.Shared.Damage; using Content.Shared.Database; using Content.Shared.Projectiles; @@ -18,9 +19,12 @@ public sealed class ProjectileSystem : SharedProjectileSystem [Dependency] private readonly GunSystem _guns = default!; [Dependency] private readonly SharedCameraRecoilSystem _sharedCameraRecoil = default!; + private EntityQuery _penetratableQuery; + public override void Initialize() { base.Initialize(); + _penetratableQuery = GetEntityQuery(); SubscribeLocalEvent(OnStartCollide); } @@ -67,9 +71,16 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St _sharedCameraRecoil.KickCamera(target, direction); } - component.DamagedEntity = true; + if (component.PenetrationScore > 0 && _penetratableQuery.TryGetComponent(target, out var penetratable)) + { + component.DamagedEntity = component.PenetrationScore < penetratable.StoppingPower; + + component.PenetrationScore -= penetratable.StoppingPower; + } + else + component.DamagedEntity = true; - if (component.DeleteOnCollide) + if (component.DeleteOnCollide && component.DamagedEntity) QueueDel(uid); if (component.ImpactEffect != null && TryComp(uid, out var xform)) diff --git a/Content.Shared/Corvax/Penetration/PenetratableComponent.cs b/Content.Shared/Corvax/Penetration/PenetratableComponent.cs new file mode 100644 index 00000000000..72d275050a7 --- /dev/null +++ b/Content.Shared/Corvax/Penetration/PenetratableComponent.cs @@ -0,0 +1,10 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Corvax.Penetration; + +[RegisterComponent, NetworkedComponent] +public sealed partial class PenetratableComponent : Component +{ + [DataField, ViewVariables(VVAccess.ReadWrite)] + public int StoppingPower; +} diff --git a/Content.Shared/Projectiles/ProjectileComponent.cs b/Content.Shared/Projectiles/ProjectileComponent.cs index c24cf2b5ee5..8cbe54fce3e 100644 --- a/Content.Shared/Projectiles/ProjectileComponent.cs +++ b/Content.Shared/Projectiles/ProjectileComponent.cs @@ -73,4 +73,7 @@ public sealed partial class ProjectileComponent : Component /// [DataField] public bool DamagedEntity; + + [DataField] + public int PenetrationScore; } diff --git a/Resources/Prototypes/Entities/Mobs/base.yml b/Resources/Prototypes/Entities/Mobs/base.yml index 065d62c748d..ce4328c0087 100644 --- a/Resources/Prototypes/Entities/Mobs/base.yml +++ b/Resources/Prototypes/Entities/Mobs/base.yml @@ -52,6 +52,8 @@ components: - type: Damageable damageContainer: Biological + - type: Penetratable + stoppingPower: 1 - type: Destructible thresholds: - trigger: diff --git a/Resources/Prototypes/Entities/Objects/Specific/Security/target.yml b/Resources/Prototypes/Entities/Objects/Specific/Security/target.yml index a17c892169d..3938ea96b53 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Security/target.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Security/target.yml @@ -26,6 +26,8 @@ - type: Physics - type: Damageable damageContainer: Inorganic + - type: Penetratable + stoppingPower: 1 - type: Destructible thresholds: - trigger: diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/antimateriel.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/antimateriel.yml index 31d7b65fe8b..be73011e777 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/antimateriel.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/antimateriel.yml @@ -9,5 +9,6 @@ types: Piercing: 40 Structural: 30 + penetrationScore: 3 - type: StaminaDamageOnCollide damage: 35 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/heavy_rifle.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/heavy_rifle.yml index be6a07e486d..921cbc8d4ad 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/heavy_rifle.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/heavy_rifle.yml @@ -8,6 +8,7 @@ damage: types: Piercing: 19 + penetrationScore: 1 - type: entity id: BulletMinigun @@ -19,3 +20,4 @@ damage: types: Piercing: 5 + penetrationScore: 1 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/light_rifle.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/light_rifle.yml index 3a0df2ac6c7..b69efdb1aa6 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/light_rifle.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/light_rifle.yml @@ -8,6 +8,7 @@ damage: types: Piercing: 19 + penetrationScore: 1 - type: entity id: BulletLightRiflePractice @@ -54,3 +55,4 @@ types: Radiation: 9 Piercing: 10 + penetrationScore: 1 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml index dd72b497d1d..a3ab5769dd0 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/magnum.yml @@ -8,6 +8,7 @@ damage: types: Piercing: 35 + penetrationScore: 1 - type: entity id: BulletMagnumPractice @@ -55,6 +56,7 @@ damage: types: Piercing: 26 # 20% decrease + penetrationScore: 2 ignoreResistances: true - type: entity @@ -68,3 +70,4 @@ types: Radiation: 15 Piercing: 20 + penetrationScore: 1 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/rifle.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/rifle.yml index 2113916cf52..adb9c4d8dc5 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/rifle.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/rifle.yml @@ -8,6 +8,7 @@ damage: types: Piercing: 17 + penetrationScore: 1 - type: entity id: BulletRiflePractice @@ -54,4 +55,5 @@ types: Radiation: 7 Piercing: 8 + penetrationScore: 1 diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml index cd9d4580367..fff384c2144 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Guns/Ammunition/Projectiles/shotgun.yml @@ -11,6 +11,7 @@ damage: types: Piercing: 28 + penetrationScore: 2 - type: entity id: PelletShotgunBeanbag @@ -41,6 +42,7 @@ damage: types: Piercing: 10 + penetrationScore: 1 - type: entity id: PelletShotgunIncendiary @@ -177,6 +179,7 @@ types: Radiation: 5 Piercing: 5 + penetrationScore: 1 - type: entity id: PelletGrapeshot #tally fucking ho diff --git a/Resources/Prototypes/Entities/Structures/Walls/walls.yml b/Resources/Prototypes/Entities/Structures/Walls/walls.yml index 0a1aea23cd7..0978b71a572 100644 --- a/Resources/Prototypes/Entities/Structures/Walls/walls.yml +++ b/Resources/Prototypes/Entities/Structures/Walls/walls.yml @@ -30,6 +30,8 @@ - type: Damageable damageContainer: StructuralInorganic damageModifierSet: StructuralMetallic + - type: Penetratable + stoppingPower: 2 - type: Physics bodyType: Static - type: Fixtures @@ -530,6 +532,8 @@ - type: Damageable damageContainer: StructuralInorganic damageModifierSet: StructuralMetallicStrong + - type: Penetratable + stoppingPower: 3 - type: Destructible thresholds: - trigger: diff --git a/Resources/Prototypes/Entities/Structures/Windows/reinforced.yml b/Resources/Prototypes/Entities/Structures/Windows/reinforced.yml index 71804fdab41..7dea327e2ae 100644 --- a/Resources/Prototypes/Entities/Structures/Windows/reinforced.yml +++ b/Resources/Prototypes/Entities/Structures/Windows/reinforced.yml @@ -14,6 +14,8 @@ - type: Damageable damageContainer: StructuralInorganic damageModifierSet: RGlass + - type: Penetratable + stoppingPower: 2 - type: RCDDeconstructable cost: 6 delay: 6 @@ -103,6 +105,8 @@ sprite: Structures/Windows/cracks_directional.rsi - type: Damageable damageModifierSet: RGlass + - type: Penetratable + stoppingPower: 2 - type: RCDDeconstructable cost: 4 delay: 4 diff --git a/Resources/Prototypes/Entities/Structures/base_structure.yml b/Resources/Prototypes/Entities/Structures/base_structure.yml index 71971a66243..963775b1549 100644 --- a/Resources/Prototypes/Entities/Structures/base_structure.yml +++ b/Resources/Prototypes/Entities/Structures/base_structure.yml @@ -9,6 +9,8 @@ - type: Clickable - type: Physics bodyType: Static + - type: Penetratable + stoppingPower: 1 - type: Fixtures fixtures: fix1: