Files
Paradise/code/datums/spell_targeting/reachable_turfs.dm
Vi3trice 05d93f665a [TM] Port TG Jump Point Search and SSpathfinder (#18984)
* move along move along

* Update bot.dm

* Diagonals are now more expensive

* Update path.dm

* Update parrot.dm

* Update path.dm

* Tweaks

* Fix cleanbot, add path safety

* Tweaked, added a safety, removed the previous one

* Update medbot.dm

* path.len isn't very safe as a whole, floorbots also had order of operations wrong

* Update medbot.dm

* clings not even once

* Back to the drawing board

* Update path.dm

* Make mules actually clear the drawn path.

* Make bots use step_towards unconditionally instead of flipping between step_to and Move

* Making extra sure the path is cleared. Somehow path was left over.

* Check for length as get_path_to is always true

* This and that
2022-10-30 15:54:51 +00:00

19 lines
829 B
Plaintext

/**
* A spell targeting system which will return nearby turfs which are reachable from the users location. Will pad the targets with the user's location if needed
*/
/datum/spell_targeting/reachable_turfs
/datum/spell_targeting/reachable_turfs/choose_targets(mob/user, obj/effect/proc_holder/spell/spell, params, atom/clicked_atom)
var/list/turf/locs = list()
for(var/direction in GLOB.alldirs)
if(length(locs) == max_targets) //we found 2 locations and thats all we need
break
var/turf/T = get_step(user, direction) //getting a loc in that direction
if(length(get_path_to(user, T, max_distance = 1, simulated_only = FALSE))) // if a path exists, so no dense objects in the way its valid salid
locs += T
// pad with player location
for(var/i = length(locs) + 1 to max_targets)
locs += user.loc
return locs