diff --git a/code/__HELPERS/path.dm b/code/__HELPERS/path.dm index 7ae72c3fa2..bac95fc296 100644 --- a/code/__HELPERS/path.dm +++ b/code/__HELPERS/path.dm @@ -44,7 +44,7 @@ * Note that this can only be used inside the [datum/pathfind][pathfind datum] since it uses variables from said datum. * If you really want to optimize things, optimize this, cuz this gets called a lot. */ -#define CAN_STEP(cur_turf, next) (next && !next.density && cur_turf.Adjacent(next) && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && !cur_turf.LinkBlockedWithAccess(next,caller, id) && (next != avoid)) +#define CAN_STEP(cur_turf, next) (next && !next.density && !(simulated_only && SSpathfinder.space_type_cache[next.type]) && !cur_turf.LinkBlockedWithAccess(next,caller, id) && (next != avoid)) /// Another helper macro for JPS, for telling when a node has forced neighbors that need expanding #define STEP_NOT_HERE_BUT_THERE(cur_turf, dirA, dirB) ((!CAN_STEP(cur_turf, get_step(cur_turf, dirA)) && CAN_STEP(cur_turf, get_step(cur_turf, dirB)))) @@ -338,8 +338,21 @@ * * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space? */ /turf/proc/LinkBlockedWithAccess(turf/destination_turf, caller, ID) + if(destination_turf.x != x && destination_turf.y != y) //diagonal + var/in_dir = get_dir(destination_turf,src) // eg. northwest (1+8) = 9 (00001001) + var/first_step_direction_a = in_dir & 3 // eg. north (1+8)&3 (0000 0011) = 1 (0000 0001) + var/first_step_direction_b = in_dir & 12 // eg. west (1+8)&12 (0000 1100) = 8 (0000 1000) + + for(var/first_step_direction in list(first_step_direction_a,first_step_direction_b)) + var/turf/midstep_turf = get_step(destination_turf,first_step_direction) + var/way_blocked = LinkBlockedWithAccess(midstep_turf,caller,ID) || midstep_turf.LinkBlockedWithAccess(destination_turf,caller,ID) + if(!way_blocked) + return FALSE + return TRUE + var/actual_dir = get_dir(src, destination_turf) + // Source border object checks for(var/obj/structure/window/iter_window in src) if(!iter_window.CanAStarPass(ID, actual_dir)) return TRUE @@ -348,6 +361,15 @@ if(!iter_windoor.CanAStarPass(ID, actual_dir)) return TRUE + for(var/obj/structure/railing/iter_rail in src) + if(!iter_rail.CanAStarPass(ID, actual_dir)) + return TRUE + + for(var/obj/machinery/door/firedoor/border_only/firedoor in src) + if(!firedoor.CanAStarPass(ID, actual_dir)) + return TRUE + + // Destination blockers check var/reverse_dir = get_dir(destination_turf, src) for(var/obj/iter_object in destination_turf) if(!iter_object.CanAStarPass(ID, reverse_dir, caller)) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index d84b994b92..ba0c852cc6 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -355,6 +355,9 @@ else return TRUE +/obj/machinery/door/firedoor/border_only/CanAStarPass(obj/item/card/id/ID, to_dir) + return !density || (dir != to_dir) + /obj/machinery/door/firedoor/border_only/CheckExit(atom/movable/mover as mob|obj, turf/target) if(istype(mover) && (mover.pass_flags & PASSGLASS)) return TRUE diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index 3aec65f6fb..bac59ef2e0 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -285,7 +285,7 @@ call_mode() return if(BOT_SUMMON) //Called by PDA - bot_summon() + summon_step() return return TRUE //Successful completion. Used to prevent child process() continuing if this one is ended early. @@ -731,8 +731,6 @@ Pass a positive integer as an argument to override a bot's default speed. mode = BOT_SUMMON speak("Responding.", radio_channel) - calc_summon_path() - if("ejectpai") ejectpairemote(user) return @@ -759,9 +757,6 @@ Pass a positive integer as an argument to override a bot's default speed. else to_chat(src, "Unidentified control sequence received:[command]") -/mob/living/simple_animal/bot/proc/bot_summon() // summoned to PDA - summon_step() - // calculates a path to the current destination // given an optional turf to avoid /mob/living/simple_animal/bot/proc/calc_path(turf/avoid)