From 1f1bddfe4f88ee8ef6a7d569a4de567e53265c68 Mon Sep 17 00:00:00 2001 From: Ryll Ryll <3589655+Ryll-Ryll@users.noreply.github.com> Date: Mon, 23 Nov 2020 22:35:04 -0500 Subject: [PATCH] Foam darts and other unembeddable bullets will no longer leave ghost shrapnel (#54994) Projectiles are assigned the ability to try embedding by the presence of a shrapnel_type variable being set on them, whether or not they actually have a set of embedding stats in their embedding var. By default, children of /obj/projectile/bullet have a shrapnel type set to a generic embedded bullet item, including things like foam darts and lollypop projectiles which shouldn't be able to embed (and certainly not embed as a bullet). While they had their embedding vars set to null, they still had their shrapnel_type set to the embedded bullet type, meaning shooting a person with a dart gun or whatever would leave a failed shrapnel item on the ground where they weren't supposed to. This fixes that by requiring both a defined shrapnel_type AND a defined embedding var for the embedding stats. Any projectiles without both won't be able to try embedding. I also manually put 'shrapnel_type = null' on any bullet subtypes with embedding = null just to be safe and for consistency. --- code/game/objects/items/robot/robot_items.dm | 1 - code/modules/projectiles/projectile.dm | 2 +- code/modules/projectiles/projectile/bullets/dart_syringe.dm | 1 + code/modules/projectiles/projectile/bullets/dnainjector.dm | 1 + code/modules/projectiles/projectile/bullets/grenade.dm | 1 + code/modules/projectiles/projectile/bullets/pistol.dm | 1 + code/modules/projectiles/projectile/bullets/revolver.dm | 2 +- code/modules/projectiles/projectile/bullets/special.dm | 1 + code/modules/projectiles/projectile/reusable/_reusable.dm | 5 +++-- code/modules/projectiles/projectile/special/rocket.dm | 4 ++++ 10 files changed, 14 insertions(+), 5 deletions(-) diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm index 048179792a9..fb3300e975f 100644 --- a/code/game/objects/items/robot/robot_items.dm +++ b/code/game/objects/items/robot/robot_items.dm @@ -532,7 +532,6 @@ desc = "Oh noes! A fast-moving lollipop!" icon_state = "lollipop_1" ammo_type = /obj/item/food/chewable/lollipop/cyborg - embedding = null nodamage = TRUE damage = 0 speed = 0.5 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 732a9ab0130..70d950b670e 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -443,7 +443,7 @@ if(fired_from) SEND_SIGNAL(fired_from, COMSIG_PROJECTILE_BEFORE_FIRE, src, original) //If no angle needs to resolve it from xo/yo! - if(shrapnel_type) + if(shrapnel_type && LAZYLEN(embedding)) AddElement(/datum/element/embed, projectile_payload = shrapnel_type) if(!log_override && firer && original) log_combat(firer, original, "fired at", src, "from [get_area_name(src, TRUE)]") diff --git a/code/modules/projectiles/projectile/bullets/dart_syringe.dm b/code/modules/projectiles/projectile/bullets/dart_syringe.dm index b86f3a38a44..77a1bed9ce8 100644 --- a/code/modules/projectiles/projectile/bullets/dart_syringe.dm +++ b/code/modules/projectiles/projectile/bullets/dart_syringe.dm @@ -3,6 +3,7 @@ icon_state = "cbbolt" damage = 6 embedding = null + shrapnel_type = null var/piercing = FALSE /obj/projectile/bullet/dart/Initialize() diff --git a/code/modules/projectiles/projectile/bullets/dnainjector.dm b/code/modules/projectiles/projectile/bullets/dnainjector.dm index e45b67ccfde..042f0d05960 100644 --- a/code/modules/projectiles/projectile/bullets/dnainjector.dm +++ b/code/modules/projectiles/projectile/bullets/dnainjector.dm @@ -5,6 +5,7 @@ damage = 5 hitsound_wall = "shatter" embedding = null + shrapnel_type = null /obj/projectile/bullet/dnainjector/on_hit(atom/target, blocked = FALSE) if(iscarbon(target)) diff --git a/code/modules/projectiles/projectile/bullets/grenade.dm b/code/modules/projectiles/projectile/bullets/grenade.dm index f3f4ef12af2..89f350af432 100644 --- a/code/modules/projectiles/projectile/bullets/grenade.dm +++ b/code/modules/projectiles/projectile/bullets/grenade.dm @@ -6,6 +6,7 @@ icon_state= "bolter" damage = 60 embedding = null + shrapnel_type = null /obj/projectile/bullet/a40mm/on_hit(atom/target, blocked = FALSE) ..() diff --git a/code/modules/projectiles/projectile/bullets/pistol.dm b/code/modules/projectiles/projectile/bullets/pistol.dm index 0752c0f8533..1f89e8aa937 100644 --- a/code/modules/projectiles/projectile/bullets/pistol.dm +++ b/code/modules/projectiles/projectile/bullets/pistol.dm @@ -10,6 +10,7 @@ damage = 27 armour_penetration = 40 embedding = null + shrapnel_type = null /obj/projectile/bullet/c9mm_hp name = "9mm hollow-point bullet" diff --git a/code/modules/projectiles/projectile/bullets/revolver.dm b/code/modules/projectiles/projectile/bullets/revolver.dm index dc7b56d77ae..ac4d3ef9f6f 100644 --- a/code/modules/projectiles/projectile/bullets/revolver.dm +++ b/code/modules/projectiles/projectile/bullets/revolver.dm @@ -42,7 +42,7 @@ ricochet_incidence_leeway = 0 ricochet_chance = 130 ricochet_decay_damage = 0.8 - shrapnel_type = NONE + shrapnel_type = null sharpness = SHARP_NONE embedding = null diff --git a/code/modules/projectiles/projectile/bullets/special.dm b/code/modules/projectiles/projectile/bullets/special.dm index a6188f57dd5..755eee796aa 100644 --- a/code/modules/projectiles/projectile/bullets/special.dm +++ b/code/modules/projectiles/projectile/bullets/special.dm @@ -10,6 +10,7 @@ icon_state = "banana" range = 200 embedding = null + shrapnel_type = null /obj/projectile/bullet/honker/Initialize() . = ..() diff --git a/code/modules/projectiles/projectile/reusable/_reusable.dm b/code/modules/projectiles/projectile/reusable/_reusable.dm index 4024428e15f..ab7d89573ee 100644 --- a/code/modules/projectiles/projectile/reusable/_reusable.dm +++ b/code/modules/projectiles/projectile/reusable/_reusable.dm @@ -1,10 +1,11 @@ /obj/projectile/bullet/reusable name = "reusable bullet" desc = "How do you even reuse a bullet?" - var/ammo_type = /obj/item/ammo_casing/caseless - var/dropped = FALSE impact_effect_type = null embedding = null + shrapnel_type = null + var/ammo_type = /obj/item/ammo_casing/caseless + var/dropped = FALSE /obj/projectile/bullet/reusable/on_hit(atom/target, blocked = FALSE) . = ..() diff --git a/code/modules/projectiles/projectile/special/rocket.dm b/code/modules/projectiles/projectile/special/rocket.dm index defd84f1b40..3a925ea556e 100644 --- a/code/modules/projectiles/projectile/special/rocket.dm +++ b/code/modules/projectiles/projectile/special/rocket.dm @@ -3,6 +3,7 @@ icon_state= "bolter" damage = 50 embedding = null + shrapnel_type = null /obj/projectile/bullet/gyro/on_hit(atom/target, blocked = FALSE) ..() @@ -18,6 +19,7 @@ armour_penetration = 100 dismemberment = 100 embedding = null + shrapnel_type = null /obj/projectile/bullet/a84mm/on_hit(atom/target, blocked = FALSE) ..() @@ -38,6 +40,7 @@ damage = 30 ricochets_max = 0 //it's a MISSILE embedding = null + shrapnel_type = null /obj/projectile/bullet/a84mm_he/on_hit(atom/target, blocked=0) ..() @@ -54,6 +57,7 @@ damage = 30 ricochets_max = 0 //it's a MISSILE embedding = null + shrapnel_type = null var/sturdy = list( /turf/closed, /obj/vehicle/sealed/mecha,