mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
Retrofit TG pathfinder with upstream improvements (#25583)
* Retrofit TG pathfinder with upstream improvements * i know how things work * don't use HAS_TRAIT for things that aren't traits * unique filenames * i'm just a goofy lil moron * use new block syntax * apparently values don't need clamping with new block syntax? * silence invalid JPS dest runtime * fix runtime passing ID instead of access list
This commit is contained in:
committed by
GitHub
parent
62dc3d57dd
commit
ca93f6bc77
@@ -57,11 +57,10 @@ GLOBAL_LIST_EMPTY(blob_minions)
|
||||
/obj/structure/blob/CanAtmosPass(direction)
|
||||
return !atmosblock
|
||||
|
||||
/obj/structure/blob/CanPathfindPass(obj/item/card/id/ID, dir, caller, no_id = FALSE)
|
||||
. = 0
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || mover.checkpass(PASSBLOB)
|
||||
/obj/structure/blob/CanPathfindPass(to_dir, datum/can_pass_info/pass_info)
|
||||
. = FALSE
|
||||
if(pass_info.is_movable)
|
||||
. = . || pass_info.pass_flags & PASSBLOB
|
||||
|
||||
/obj/structure/blob/process()
|
||||
Life()
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
AM.setDir(current_dir)
|
||||
now_pushing = FALSE
|
||||
|
||||
/mob/living/CanPathfindPass(obj/item/card/id/ID, to_dir, atom/movable/caller, no_id = FALSE)
|
||||
/mob/living/CanPathfindPass(to_dir, datum/can_pass_info/pass_info)
|
||||
return TRUE // Unless you're a mule, something's trying to run you over.
|
||||
|
||||
/mob/living/proc/can_track(mob/living/user)
|
||||
|
||||
@@ -442,12 +442,8 @@
|
||||
|
||||
var/datum/pathfinding_mover/pathfind = new(src, target)
|
||||
|
||||
// I originally only wanted to make it use an ID if it couldnt pathfind otherwise, but that means it could take multiple minutes if both searches failed
|
||||
var/obj/item/card/id/temp_id = new(src)
|
||||
temp_id.access = get_all_accesses()
|
||||
set_pathfinding(pathfind)
|
||||
var/found_path = pathfind.generate_path(150, null, temp_id)
|
||||
qdel(temp_id)
|
||||
var/found_path = pathfind.generate_path(150, null, get_all_accesses())
|
||||
if(!found_path)
|
||||
set_pathfinding(null)
|
||||
return FALSE
|
||||
|
||||
@@ -178,7 +178,7 @@
|
||||
return
|
||||
|
||||
if(!bot_move(last_target_location, move_speed = 6))
|
||||
var/last_target_pos_path = get_path_to(src, last_target_location, id = access_card, skip_first = TRUE)
|
||||
var/last_target_pos_path = get_path_to(src, last_target_location, access = access_card.access, skip_first = TRUE)
|
||||
if(length(last_target_pos_path) == 0)
|
||||
frustration = 10
|
||||
return
|
||||
@@ -656,7 +656,7 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
|
||||
access_card.access = get_all_accesses() // Give the bot temporary all access
|
||||
|
||||
set_path(get_path_to(src, waypoint, 200, id = access_card))
|
||||
set_path(get_path_to(src, waypoint, 200, access = access_card.access))
|
||||
calling_ai = caller // Link the AI to the bot!
|
||||
ai_waypoint = waypoint
|
||||
|
||||
@@ -880,12 +880,12 @@ Pass a positive integer as an argument to override a bot's default speed.
|
||||
// Given an optional turf to avoid
|
||||
/mob/living/simple_animal/bot/proc/calc_path(turf/avoid)
|
||||
check_bot_access()
|
||||
set_path(get_path_to(src, patrol_target, 120, id=access_card, exclude=avoid))
|
||||
set_path(get_path_to(src, patrol_target, 120, access = access_card.access, exclude=avoid))
|
||||
|
||||
/mob/living/simple_animal/bot/proc/calc_summon_path(turf/avoid)
|
||||
set waitfor = FALSE
|
||||
check_bot_access()
|
||||
set_path(get_path_to(src, summon_target, 150, id=access_card, exclude=avoid))
|
||||
set_path(get_path_to(src, summon_target, 150, access = access_card.access, exclude=avoid))
|
||||
if(!length(path)) // Cannot reach target. Give up and announce the issue.
|
||||
speak("Summon command failed, destination unreachable.",radio_channel)
|
||||
bot_reset()
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
if(target)
|
||||
if(!path || !length(path)) //No path, need a new one
|
||||
//Try to produce a path to the target, and ignore airlocks to which it has access.
|
||||
path = get_path_to(src, target, 30, id=access_card)
|
||||
path = get_path_to(src, target, 30, access = access_card.access)
|
||||
if(!bot_move(target))
|
||||
ignore_job -= target.UID()
|
||||
add_to_ignore(target)
|
||||
|
||||
@@ -235,9 +235,9 @@
|
||||
if(!length(path)) // No path, need a new one
|
||||
if(!isturf(target))
|
||||
var/turf/TL = get_turf(target)
|
||||
path = get_path_to(src, TL, 30, id = access_card, simulated_only = 0)
|
||||
path = get_path_to(src, TL, 30, access = access_card.access, simulated_only = 0)
|
||||
else
|
||||
path = get_path_to(src, target, 30, id = access_card, simulated_only = 0)
|
||||
path = get_path_to(src, target, 30, access = access_card.access, simulated_only = 0)
|
||||
|
||||
if(!bot_move(target))
|
||||
add_to_ignore(target)
|
||||
|
||||
@@ -335,10 +335,10 @@
|
||||
return
|
||||
|
||||
if(patient && !length(path) && (get_dist(src,patient) > 1))
|
||||
path = get_path_to(src, patient, 30,id=access_card)
|
||||
path = get_path_to(src, patient, 30, access = access_card.access)
|
||||
mode = BOT_MOVING
|
||||
if(!length(path)) //try to get closer if you can't reach the patient directly
|
||||
path = get_path_to(src, patient, 30,1,id=access_card)
|
||||
path = get_path_to(src, patient, 30, 1, access = access_card.access)
|
||||
if(!length(path)) //Do not chase a patient we cannot reach.
|
||||
soft_reset()
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
QDEL_NULL(cell)
|
||||
return ..()
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/CanPathfindPass(obj/item/card/id/ID, to_dir, atom/movable/caller, no_id)
|
||||
/mob/living/simple_animal/bot/mulebot/CanPathfindPass(to_dir, datum/can_pass_info/pass_info)
|
||||
return FALSE
|
||||
|
||||
/mob/living/simple_animal/bot/mulebot/can_buckle()
|
||||
@@ -606,7 +606,7 @@
|
||||
// given an optional turf to avoid
|
||||
/mob/living/simple_animal/bot/mulebot/calc_path(turf/avoid = null)
|
||||
check_bot_access()
|
||||
set_path(get_path_to(src, target, 250, id=access_card, exclude=avoid))
|
||||
set_path(get_path_to(src, target, 250, access = access_card.access, exclude = avoid))
|
||||
|
||||
// sets the current destination
|
||||
// signals all beacons matching the delivery code
|
||||
|
||||
@@ -712,9 +712,6 @@
|
||||
animate(held_item_icon, transform = m180)
|
||||
underlays += held_item_icon
|
||||
|
||||
/mob/living/simple_animal/parrot/CanPathfindPassTo(ID, dir, obj/destination)
|
||||
return is_type_in_typecache(destination, desired_perches)
|
||||
|
||||
#undef PARROT_PERCH
|
||||
#undef PARROT_SWOOP
|
||||
#undef PARROT_WANDER
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
to_chat(imp_in, "<span class='warning'>The implant does not recognize you as a known species!</span>")
|
||||
return FALSE
|
||||
var/mob/living/carbon/human/H = imp_in
|
||||
set_path(get_path_to(module.mod, target, 150, id = H.wear_id, simulated_only = FALSE)) //Yes, science proves jetpacks work in space. More at 11.
|
||||
set_path(get_path_to(module.mod, target, 150, access = H?.wear_id.GetAccess(), simulated_only = FALSE)) //Yes, science proves jetpacks work in space. More at 11.
|
||||
if(!length(path)) //Cannot reach target. Give up and announce the issue.
|
||||
to_chat(H, "<span class='warning'>No viable path found!</span>")
|
||||
return FALSE
|
||||
@@ -179,7 +179,7 @@
|
||||
set_path(null)
|
||||
var/target = get_turf(imp_in)
|
||||
var/mob/living/carbon/human/H = imp_in
|
||||
set_path(get_path_to(module.mod, target, 150, id = H.wear_id, simulated_only = FALSE)) //Yes, science proves jetpacks work in space. More at 11.
|
||||
set_path(get_path_to(module.mod, target, 150, access = H?.wear_id.GetAccess(), simulated_only = FALSE)) //Yes, science proves jetpacks work in space. More at 11.
|
||||
addtimer(CALLBACK(src, PROC_REF(mod_move), target), 6) //I'll value this properly soon
|
||||
|
||||
return TRUE
|
||||
|
||||
Reference in New Issue
Block a user