Merge pull request #15536 from SandPoot/JPS
Implements JPS (Jump Point Search) Pathfinding
This commit is contained in:
@@ -638,3 +638,23 @@ GLOBAL_LIST_EMPTY(station_turfs)
|
||||
var/obj/machinery/door/D = locate() in src
|
||||
if(D?.density)
|
||||
. += D.opacity? 29 : 19 // glass doors are slightly more resistant to screaming
|
||||
|
||||
/**
|
||||
* Returns adjacent turfs to this turf that are reachable, in all cardinal directions
|
||||
*
|
||||
* Arguments:
|
||||
* * caller: The movable, if one exists, being used for mobility checks to see what tiles it can reach
|
||||
* * ID: An ID card that decides if we can gain access to doors that would otherwise block a turf
|
||||
* * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space?
|
||||
*/
|
||||
/turf/proc/reachableAdjacentTurfs(caller, ID, simulated_only)
|
||||
var/static/space_type_cache = typecacheof(/turf/open/space)
|
||||
. = list()
|
||||
|
||||
for(var/iter_dir in GLOB.cardinals)
|
||||
var/turf/turf_to_check = get_step(src,iter_dir)
|
||||
if(!turf_to_check || (simulated_only && space_type_cache[turf_to_check.type]))
|
||||
continue
|
||||
if(turf_to_check.density || LinkBlockedWithAccess(turf_to_check, caller, ID))
|
||||
continue
|
||||
. += turf_to_check
|
||||
|
||||
Reference in New Issue
Block a user