diff --git a/code/modules/mob/living/basic/bots/bot_ai.dm b/code/modules/mob/living/basic/bots/bot_ai.dm index 4fde29dcee6..6f726c9586c 100644 --- a/code/modules/mob/living/basic/bots/bot_ai.dm +++ b/code/modules/mob/living/basic/bots/bot_ai.dm @@ -12,7 +12,7 @@ ai_movement = /datum/ai_movement/jps/bot planning_subtrees = list( -/datum/ai_planning_subtree/escape_captivity/pacifist, + /datum/ai_planning_subtree/escape_captivity/pacifist, /datum/ai_planning_subtree/respond_to_summon, /datum/ai_planning_subtree/salute_authority, /datum/ai_planning_subtree/find_patrol_beacon, @@ -55,8 +55,12 @@ /datum/ai_controller/basic_controller/bot/proc/on_movement_start(mob/living/basic/bot/source, atom/target) SIGNAL_HANDLER + if(current_movement_target == blackboard[BB_BEACON_TARGET]) source.update_bot_mode(new_mode = BOT_PATROL) + return + + source.clear_path_hud(remove_hud = FALSE) /datum/ai_controller/basic_controller/bot/proc/add_to_blacklist(atom/target, duration) var/final_duration = duration || blackboard[BB_UNREACHABLE_LIST_COOLDOWN] diff --git a/code/modules/mob/living/basic/bots/bot_hud.dm b/code/modules/mob/living/basic/bots/bot_hud.dm index 08a7f9e3fbb..602b2cc54bd 100644 --- a/code/modules/mob/living/basic/bots/bot_hud.dm +++ b/code/modules/mob/living/basic/bots/bot_hud.dm @@ -40,6 +40,12 @@ if(isnull(ai_controller)) return + + var/atom/move_target = ai_controller.current_movement_target + if(move_target != ai_controller.blackboard[BB_BEACON_TARGET]) + return + + //Removes path images and handles removing hud client images clear_path_hud() @@ -48,11 +54,6 @@ var/list/path_images = active_hud_list[DIAG_PATH_HUD] LAZYCLEARLIST(path_images) - - var/atom/move_target = ai_controller.current_movement_target - if(move_target != ai_controller.blackboard[BB_BEACON_TARGET]) - return - var/list/our_path = source.movement_path if(!length(our_path)) return @@ -94,11 +95,6 @@ if(client || !length(current_pathed_turfs) || isnull(ai_controller)) return - var/atom/move_target = ai_controller.current_movement_target - - if(move_target != ai_controller.blackboard[BB_BEACON_TARGET]) - clear_path_hud() - var/turf/our_turf = get_turf(src) var/image/target_image = current_pathed_turfs[our_turf] if(target_image) @@ -106,12 +102,15 @@ current_pathed_turfs -= our_turf ///proc that handles deleting the bot's drawn path when needed -/mob/living/basic/bot/proc/clear_path_hud() +/mob/living/basic/bot/proc/clear_path_hud(remove_hud = TRUE) for(var/turf/index as anything in current_pathed_turfs) var/image/our_image = current_pathed_turfs[index] animate(our_image, alpha = 0, time = 0.3 SECONDS) current_pathed_turfs -= index + if(!remove_hud) + return + // Call hud remove handlers to ensure viewing user client images are removed var/list/path_huds_watching_me = list(GLOB.huds[DATA_HUD_DIAGNOSTIC], GLOB.huds[DATA_HUD_BOT_PATH]) for(var/datum/atom_hud/hud as anything in path_huds_watching_me)