Check if on the same turf (#20998)

This commit is contained in:
Vi3trice
2023-05-22 16:04:52 -04:00
committed by GitHub
parent 764aed10c5
commit 6bf89dd257
@@ -43,10 +43,11 @@
/datum/action/changeling/sting/can_sting(mob/user, mob/target)
if(!..() || !iscarbon(target) || !isturf(user.loc))
return FALSE
if(get_dist(user, target) > cling.sting_range) // Too far, don't bother pathfinding
var/target_distance = get_dist(user, target)
if(target_distance > cling.sting_range) // Too far, don't bother pathfinding
to_chat(user, "<span class='warning'>Our target is too far for our sting!</span>")
return FALSE
if(!length(get_path_to(user, target, max_distance = cling.sting_range, simulated_only = FALSE, skip_first = FALSE)))
if(target_distance && !length(get_path_to(user, target, max_distance = cling.sting_range, simulated_only = FALSE, skip_first = FALSE))) // If they're not on the same turf, check if it can even reach them.
to_chat(user, "<span class='warning'>Our sting is blocked from reaching our target!</span>")
return FALSE
if(!cling.chosen_sting)