From 075d33668cf61ae2c230d8f466e766e99faded0b Mon Sep 17 00:00:00 2001
From: homexp13 <52973135+homexp13@users.noreply.github.com>
Date: Fri, 19 Jul 2024 07:55:25 +0300
Subject: [PATCH] Xeno penetration (#22)
* penetration
* bruh
* aaaaaaaaa
* rutgmc
---
code/modules/codex/entries/ammunition_codex.dm | 3 +++
code/modules/codex/entries/magazine_codex.dm | 3 +++
code/modules/projectiles/ammo_datums.dm | 2 ++
code/modules/projectiles/projectile.dm | 13 +++++--------
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/code/modules/codex/entries/ammunition_codex.dm b/code/modules/codex/entries/ammunition_codex.dm
index 5fcea857473..9f68ff7e330 100644
--- a/code/modules/codex/entries/ammunition_codex.dm
+++ b/code/modules/codex/entries/ammunition_codex.dm
@@ -35,6 +35,9 @@
if(ammo.penetration)
entry.mechanics_text += "Armor penetration: [ammo.penetration]
"
+ if(ammo.additional_xeno_penetration)
+ entry.mechanics_text += "Xenomorph additional armor penetration: [ammo.penetration]
"
+
if(ammo.armor_type)
entry.mechanics_text += "Armor type: [ammo.armor_type]
"
diff --git a/code/modules/codex/entries/magazine_codex.dm b/code/modules/codex/entries/magazine_codex.dm
index 0d44f7803f7..8b9570dead7 100644
--- a/code/modules/codex/entries/magazine_codex.dm
+++ b/code/modules/codex/entries/magazine_codex.dm
@@ -42,6 +42,9 @@
if(default_ammo.penetration)
traits += "Armor penetration: [default_ammo.penetration]
"
+ if(default_ammo.additional_xeno_penetration)
+ traits += "Xenomorph additional armor penetration: [default_ammo.additional_xeno_penetration]
"
+
if(default_ammo.sundering)
traits += "Sundering amount: [default_ammo.sundering]
"
diff --git a/code/modules/projectiles/ammo_datums.dm b/code/modules/projectiles/ammo_datums.dm
index 63958c4131f..ad19f085ab8 100644
--- a/code/modules/projectiles/ammo_datums.dm
+++ b/code/modules/projectiles/ammo_datums.dm
@@ -47,6 +47,8 @@ GLOBAL_LIST_INIT(no_sticky_resin, typecacheof(list(/obj/item/clothing/mask/faceh
var/damage_type = BRUTE
///How much armor it ignores before calculations take place
var/penetration = 0
+ ///How much extra penetration applies to xeno
+ var/additional_xeno_penetration = 0
///The % chance it will imbed in a human
var/shrapnel_chance = 0
///How fast the projectile moves
diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm
index 5b648820838..fee282c1b04 100644
--- a/code/modules/projectiles/projectile.dm
+++ b/code/modules/projectiles/projectile.dm
@@ -68,6 +68,8 @@
var/damage = 0
///ammo sundering value
var/sundering = 0
+ ///How much extra penetration applies to xeno
+ var/additional_xeno_penetration = 0
var/accuracy = 90 //Base projectile accuracy. Can maybe be later taken from the mob if desired.
///how many damage points the projectile loses per tiles travelled
@@ -154,6 +156,7 @@
icon_state = ammo.icon_state
damage = ammo.damage + bonus_damage //Mainly for emitters.
penetration = ammo.penetration
+ additional_xeno_penetration = ammo.additional_xeno_penetration
sundering = ammo.sundering
scatter = ammo.scatter
airburst_multiplier = ammo.airburst_multiplier
@@ -902,12 +905,7 @@ So if we are on the 32th absolute pixel coordinate we are on tile 1, but if we a
damage *= STAGGER_DAMAGE_MULTIPLIER //Since we hate RNG, stagger reduces damage by a % instead of reducing accuracy; consider it a 'glancing' hit due to being disoriented.
var/original_damage = damage
- //// RUTGMC EDIT
- var/sunder_to_penetration = 0
- if(isxeno(src))
- sunder_to_penetration = log(proj.sundering + 1) * 10
-
- damage = modify_by_armor(damage, proj.armor_type, proj.sundering >= 20 ? proj.penetration : (proj.penetration + sunder_to_penetration), proj.def_zone)// RUTGMC EDIT
+ damage = modify_by_armor(damage, proj.armor_type, isxeno(src) ? proj.penetration + proj.additional_xeno_penetration : proj.penetration, proj.def_zone)
if(damage == original_damage)
feedback_flags |= BULLET_FEEDBACK_PEN
else if(!damage)
@@ -919,8 +917,7 @@ So if we are on the 32th absolute pixel coordinate we are on tile 1, but if we a
if(IgniteMob())
feedback_flags |= (BULLET_FEEDBACK_FIRE)
-
- if((proj.ammo.flags_ammo_behavior & AMMO_SUNDERING) && proj.sundering >= 20) // RUTGMC EDIT
+ if(proj.ammo.flags_ammo_behavior & AMMO_SUNDERING)
adjust_sunder(proj.sundering) // RUTGMC EDIT
if(stat != DEAD && ismob(proj.firer))