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.
This commit is contained in:
Ryll Ryll
2020-11-23 19:35:04 -08:00
committed by GitHub
parent 23739baf2c
commit 1f1bddfe4f
10 changed files with 14 additions and 5 deletions
@@ -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
+1 -1
View File
@@ -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)]")
@@ -3,6 +3,7 @@
icon_state = "cbbolt"
damage = 6
embedding = null
shrapnel_type = null
var/piercing = FALSE
/obj/projectile/bullet/dart/Initialize()
@@ -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))
@@ -6,6 +6,7 @@
icon_state= "bolter"
damage = 60
embedding = null
shrapnel_type = null
/obj/projectile/bullet/a40mm/on_hit(atom/target, blocked = FALSE)
..()
@@ -10,6 +10,7 @@
damage = 27
armour_penetration = 40
embedding = null
shrapnel_type = null
/obj/projectile/bullet/c9mm_hp
name = "9mm hollow-point bullet"
@@ -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
@@ -10,6 +10,7 @@
icon_state = "banana"
range = 200
embedding = null
shrapnel_type = null
/obj/projectile/bullet/honker/Initialize()
. = ..()
@@ -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)
. = ..()
@@ -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,