From c7f959d34f273604beb5489681c2ca5aaaee74c6 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Thu, 16 Aug 2012 14:13:40 +0000 Subject: [PATCH] - Changeling stings now utilize the AStar algorithm to determine whether you can actually reach the target. Fixed issue 351. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4434 316c924e-a436-60f5-8080-3fe189b3f50e --- .../gamemodes/changeling/changeling_powers.dm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 93b4809aaad..d42e0e2fd18 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -462,6 +462,14 @@ ////////// //STINGS// //They get a pretty header because there's just so fucking many of them ;_; ////////// + +/mob/proc/sting_can_reach(mob/M as mob, sting_range = 1) + if(M.loc == src.loc) return 1 //target and source are in the same thing + if(!isturf(src.loc) || !isturf(M.loc)) return 0 //One is inside, the other is outside something. + if(AStar(src.loc, M.loc, /turf/proc/AdjacentTurfs, /turf/proc/Distance, sting_range)) //If a path exists, good! + return 1 + return 0 + //Handles the general sting code to reduce on copypasta (seeming as somebody decided to make SO MANY dumb abilities) /mob/proc/changeling_sting(var/required_chems=0, var/verb_path) var/datum/changeling/changeling = changeling_power(required_chems) @@ -472,9 +480,10 @@ victims += C var/mob/living/carbon/T = input(usr, "Who will we sting?") as null|anything in victims - if(!T) return - if(!(T in view(changeling.sting_range))) return - if(!changeling_power(required_chems)) return + if(!T) return + if(!(T in view(changeling.sting_range))) return + if(!sting_can_reach(T, changeling.sting_range)) return + if(!changeling_power(required_chems)) return changeling.chem_charges -= required_chems changeling.sting_range = 1