mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
Fixes Pathfinder module AGAIN, General JPS Tweak (#84348)
## About The Pull Request 1. Fixes the modsuit pathfinder module's pathfinding for the second time. This time AI idling broke it, we just make it not idle. 2. Changes the heuristic used by JPS nodes from Chebyshev distance to Euclidean distance. I have no real logical explanation, it just appeared to produce a more optimal path. CC @LemonInTheDark 3. Renames `get_dist_euclidian()` to `get_dist_euclidean()`. Red line: Euclidean dist JPS path (roughly) Green line: Chebyshev dist JPS path (roughly)  ## Changelog 🆑 fix: MODsuit pathfinder module works. Again. code: AI pathfinding should produce slightly better paths. /🆑
This commit is contained in:
@@ -114,7 +114,7 @@
|
||||
var/locx = (target_turf.x - here_turf.x) + 24
|
||||
var/locy = (here_turf.y - target_turf.y) + 24
|
||||
|
||||
if(get_dist_euclidian(here_turf, target_turf) > 24)
|
||||
if(get_dist_euclidean(here_turf, target_turf) > 24)
|
||||
userot = TRUE
|
||||
rot = round(get_angle(here_turf, target_turf))
|
||||
else
|
||||
@@ -208,7 +208,7 @@
|
||||
|
||||
var/here_turf = get_turf(computer)
|
||||
var/target_turf = get_turf(signal)
|
||||
var/trackdistance = get_dist_euclidian(here_turf, target_turf)
|
||||
var/trackdistance = get_dist_euclidean(here_turf, target_turf)
|
||||
switch(trackdistance)
|
||||
if(0)
|
||||
program_open_overlay = "[initial(program_open_overlay)]direct"
|
||||
@@ -471,7 +471,7 @@
|
||||
*/
|
||||
/obj/item/circuit_component/mod_program/radar/proc/can_track(datum/source, atom/signal, signal_turf, computer_turf)
|
||||
SIGNAL_HANDLER
|
||||
if(target.value && get_dist_euclidian(computer_turf, signal_turf) > MAX_RADAR_CIRCUIT_DISTANCE)
|
||||
if(target.value && get_dist_euclidean(computer_turf, signal_turf) > MAX_RADAR_CIRCUIT_DISTANCE)
|
||||
return COMPONENT_RADAR_DONT_TRACK
|
||||
return COMPONENT_RADAR_TRACK_ANYWAY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user