diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 24844d6deb..a24499ab05 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -205,11 +205,12 @@ /obj/item/projectile/proc/select_target(atom/A) //Selects another target from a wall if we hit a wall. - if(!A || !A.density || (A.flags_1 & ON_BORDER_1) || ismob(A)) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs or machines/structures on that tile. + if(!A || !A.density || (A.flags_1 & ON_BORDER_1) || ismob(A) || A == original) //if we hit a dense non-border obj or dense turf then we also hit one of the mobs or machines/structures on that tile. return - if(A == original || original in A) + var/turf/T = get_turf(A) + if(original in T) return original - var/list/mob/possible_mobs = typecache_filter_list(A, GLOB.typecache_mob) + var/list/mob/possible_mobs = typecache_filter_list(T, GLOB.typecache_mob) - A var/list/mob/mobs = list() for(var/i in possible_mobs) var/mob/M = i @@ -219,10 +220,9 @@ var/mob/M = safepick(mobs) if(M) return M.lowest_buckled_mob() - var/obj/O = safepick(typecache_filter_list(A, GLOB.typecache_machine_or_structure)) + var/obj/O = safepick(typecache_filter_list(T, GLOB.typecache_machine_or_structure)) - A if(O) return O - return A /obj/item/projectile/proc/check_ricochet() if(prob(ricochet_chance))