From bc3a18f164699290d763bfedcc17160110dca7c4 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Sat, 18 Jul 2020 18:22:04 -0700 Subject: [PATCH] Update projectile.dm --- code/modules/projectiles/projectile.dm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 47e9c5f6d6..8ef1bfe2a6 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -134,6 +134,8 @@ // This is distinct from the hitscan's "impact_type" var. var/impact_effect_type = null + var/list/impacted_mobs = list() + /obj/item/projectile/proc/Range() range-- if(range <= 0 && loc) @@ -442,6 +444,12 @@ if(hitscan) finalize_hitscan_and_generate_tracers() STOP_PROCESSING(SSprojectiles, src) + + if(impacted_mobs) + if(LAZYLEN(impacted_mobs)) + impacted_mobs.Cut() + impacted_mobs = null + qdel(trajectory) return ..() @@ -634,6 +642,9 @@ if(!istype(target_mob)) return + if(target_mob in impacted_mobs) + return + //roll to-hit miss_modifier = max(15*(distance-2) - accuracy + miss_modifier + target_mob.get_evasion(), 0) var/hit_zone = get_zone_with_miss_chance(def_zone, target_mob, miss_modifier, ranged_attack=(distance > 1 || original != target_mob)) //if the projectile hits a target we weren't originally aiming at then retain the chance to miss @@ -646,6 +657,10 @@ if(!istype(target_mob)) return FALSE // Mob deleted itself or something. + // Safe to add the target to the list that is soon to be poofed. No double jeopardy, pixel projectiles. + if(islist(impacted_mobs)) + impacted_mobs |= target_mob + if(result == PROJECTILE_FORCE_MISS) if(!silenced) target_mob.visible_message("\The [src] misses \the [target_mob] narrowly!") @@ -792,4 +807,4 @@ var/volume = CLAMP(vol_by_damage() + 20, 0, 100) if(silenced) volume = 5 - playsound(get_turf(A), hitsound_wall, volume, 1, -1) + playsound(A, hitsound_wall, volume, 1, -1)