mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-29 11:31:51 +00:00
A* distance estimate improvement try #2: Only change it where pathing ignores diagonals, leave the old one where diagonals are considered.
This commit is contained in:
@@ -135,8 +135,19 @@
|
||||
if(!LinkBlocked(src, t) && !TurfBlockedNonWindow(t))
|
||||
L.Add(t)
|
||||
return L
|
||||
|
||||
Distance(turf/t)
|
||||
if(get_dist(src,t) == 1)
|
||||
var/cost = (src.x - t.x) * (src.x - t.x) + (src.y - t.y) * (src.y - t.y)
|
||||
cost *= (pathweight+t.pathweight)/2
|
||||
return cost
|
||||
|
||||
else
|
||||
return get_dist(src,t)
|
||||
|
||||
Distance_ortho(turf/t)
|
||||
return abs(src.x - t.x) + abs(src.y - t.y)
|
||||
|
||||
AdjacentTurfsSpace()
|
||||
var/L[] = new()
|
||||
for(var/turf/t in oview(src,1))
|
||||
|
||||
@@ -232,7 +232,7 @@ text("<A href='?src=\ref[src];operation=oddbutton'>[src.oddbutton ? "Yes" : "No"
|
||||
if (!next_dest_loc)
|
||||
next_dest_loc = closest_loc
|
||||
if (next_dest_loc)
|
||||
src.patrol_path = AStar(src.loc, next_dest_loc, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 120, id=botcard, exclude=null)
|
||||
src.patrol_path = AStar(src.loc, next_dest_loc, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_ortho, 0, 120, id=botcard, exclude=null)
|
||||
src.patrol_path = reverselist(src.patrol_path)
|
||||
else
|
||||
patrol_move()
|
||||
|
||||
@@ -563,7 +563,7 @@ Auto Patrol: []"},
|
||||
// calculates a path to the current destination
|
||||
// given an optional turf to avoid
|
||||
/obj/machinery/bot/ed209/proc/calc_path(var/turf/avoid = null)
|
||||
src.path = AStar(src.loc, patrol_target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 120, id=botcard, exclude=avoid)
|
||||
src.path = AStar(src.loc, patrol_target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_ortho, 0, 120, id=botcard, exclude=avoid)
|
||||
src.path = reverselist(src.path)
|
||||
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@
|
||||
|
||||
if(src.patient && src.path.len == 0 && (get_dist(src,src.patient) > 1))
|
||||
spawn(0)
|
||||
src.path = AStar(src.loc, get_turf(src.patient), /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 30,id=botcard)
|
||||
src.path = AStar(src.loc, get_turf(src.patient), /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_ortho, 0, 30,id=botcard)
|
||||
src.path = reverselist(src.path)
|
||||
if(src.path.len == 0)
|
||||
src.oldpatient = src.patient
|
||||
|
||||
@@ -694,7 +694,7 @@
|
||||
// calculates a path to the current destination
|
||||
// given an optional turf to avoid
|
||||
/obj/machinery/bot/mulebot/proc/calc_path(var/turf/avoid = null)
|
||||
src.path = AStar(src.loc, src.target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 250, id=botcard, exclude=avoid)
|
||||
src.path = AStar(src.loc, src.target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_ortho, 0, 250, id=botcard, exclude=avoid)
|
||||
src.path = reverselist(src.path)
|
||||
|
||||
|
||||
|
||||
@@ -543,7 +543,7 @@ Auto Patrol: []"},
|
||||
// calculates a path to the current destination
|
||||
// given an optional turf to avoid
|
||||
/obj/machinery/bot/secbot/proc/calc_path(var/turf/avoid = null)
|
||||
src.path = AStar(src.loc, patrol_target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance, 0, 120, id=botcard, exclude=avoid)
|
||||
src.path = AStar(src.loc, patrol_target, /turf/proc/CardinalTurfsWithAccess, /turf/proc/Distance_ortho, 0, 120, id=botcard, exclude=avoid)
|
||||
src.path = reverselist(src.path)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user