From 0f4157d31e5453f52ab571a30f175618d5d078a7 Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Sun, 6 Nov 2022 10:26:29 +0000 Subject: [PATCH] Attempts to fix phantom bot path overlays (#19360) * a * more things * two more cheeky spots --- code/modules/mob/living/simple_animal/bot/bot.dm | 13 ++++++++++++- .../mob/living/simple_animal/bot/ed209bot.dm | 3 +++ .../mob/living/simple_animal/bot/griefsky.dm | 2 ++ code/modules/mob/living/simple_animal/bot/secbot.dm | 3 +++ .../mob/living/simple_animal/bot/syndicate.dm | 2 ++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm index b61758aa74b..f60e06aa789 100644 --- a/code/modules/mob/living/simple_animal/bot/bot.dm +++ b/code/modules/mob/living/simple_animal/bot/bot.dm @@ -184,6 +184,7 @@ /mob/living/simple_animal/bot/Destroy() if(paicard) ejectpai() + set_path(null) if(path_hud) QDEL_NULL(path_hud) path_hud = null @@ -593,6 +594,7 @@ Pass a positive integer as an argument to override a bot's default speed. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /mob/living/simple_animal/bot/proc/bot_patrol() + set_path(null) patrol_step() addtimer(CALLBACK(src, .proc/do_patrol), 5) @@ -601,7 +603,7 @@ Pass a positive integer as an argument to override a bot's default speed. patrol_step() /mob/living/simple_animal/bot/proc/start_patrol() - + set_path(null) if(tries >= BOT_STEP_MAX_RETRIES) //Bot is trapped, so stop trying to patrol. auto_patrol = FALSE tries = 0 @@ -1035,6 +1037,7 @@ Pass a positive integer as an argument to override a bot's default speed. for(var/V in path_huds_watching_me) var/datum/atom_hud/H = V H.remove_from_hud(src) + clear_path_image() var/list/path_images = hud_list[DIAG_PATH_HUD] QDEL_LIST(path_images) @@ -1088,5 +1091,13 @@ Pass a positive integer as an argument to override a bot's default speed. I.icon_state = null path.Cut(1, 2) +/mob/living/simple_animal/bot/proc/clear_path_image() + if(!path || !length(path)) + return + for(var/P in path) + var/image/I = path[P] + if(I?.icon_state) + I.icon_state = null + /mob/living/simple_animal/bot/proc/drop_part(obj/item/drop_item, dropzone) new drop_item(dropzone) diff --git a/code/modules/mob/living/simple_animal/bot/ed209bot.dm b/code/modules/mob/living/simple_animal/bot/ed209bot.dm index 7b32dbf5e98..6917ad5b7c9 100644 --- a/code/modules/mob/living/simple_animal/bot/ed209bot.dm +++ b/code/modules/mob/living/simple_animal/bot/ed209bot.dm @@ -91,6 +91,7 @@ oldtarget_name = null anchored = FALSE walk_to(src,0) + set_path(null) last_found = world.time set_weapon() @@ -245,6 +246,7 @@ if(BOT_IDLE) // idle walk_to(src,0) + set_path(null) if(!lasercolor) //lasertag bots don't want to arrest anyone look_for_perp() // see if any criminals are in range if(!mode && auto_patrol) // still idle, and set to patrol @@ -254,6 +256,7 @@ // if can't reach perp for long enough, go idle if(frustration >= 8) walk_to(src,0) + set_path(null) back_to_idle() if(target) // make sure target exists diff --git a/code/modules/mob/living/simple_animal/bot/griefsky.dm b/code/modules/mob/living/simple_animal/bot/griefsky.dm index 07d5797c65f..1ad4129df03 100644 --- a/code/modules/mob/living/simple_animal/bot/griefsky.dm +++ b/code/modules/mob/living/simple_animal/bot/griefsky.dm @@ -109,6 +109,7 @@ if(BOT_IDLE) // idle icon_state = "griefsky1" walk_to(src,0) + set_path(null) look_for_perp() // see if any criminals are in range if(!mode && auto_patrol) // still idle, and set to patrol mode = BOT_START_PATROL // switch to patrol mode @@ -117,6 +118,7 @@ playsound(loc,'sound/effects/spinsabre.ogg',50,1,-1) if(frustration >= frustration_number) // general beepsky doesn't give up so easily, jedi scum walk_to(src,0) + set_path(null) back_to_idle() return if(target) // make sure target exists diff --git a/code/modules/mob/living/simple_animal/bot/secbot.dm b/code/modules/mob/living/simple_animal/bot/secbot.dm index acdf5c02366..4912b861704 100644 --- a/code/modules/mob/living/simple_animal/bot/secbot.dm +++ b/code/modules/mob/living/simple_animal/bot/secbot.dm @@ -107,6 +107,7 @@ oldtarget_name = null anchored = FALSE walk_to(src,0) + set_path(null) last_found = world.time /mob/living/simple_animal/bot/secbot/set_custom_texts() @@ -306,6 +307,7 @@ switch(mode) if(BOT_IDLE) // idle walk_to(src,0) + set_path(null) look_for_perp() // see if any criminals are in range if(!mode && auto_patrol) // still idle, and set to patrol mode = BOT_START_PATROL // switch to patrol mode @@ -314,6 +316,7 @@ // if can't reach perp for long enough, go idle if(frustration >= 8) walk_to(src,0) + set_path(null) back_to_idle() return diff --git a/code/modules/mob/living/simple_animal/bot/syndicate.dm b/code/modules/mob/living/simple_animal/bot/syndicate.dm index 24d3f1a5d0b..6518055e6cf 100644 --- a/code/modules/mob/living/simple_animal/bot/syndicate.dm +++ b/code/modules/mob/living/simple_animal/bot/syndicate.dm @@ -82,12 +82,14 @@ switch(mode) if(BOT_IDLE) walk_to(src,0) + set_path(null) look_for_perp() if(!mode && auto_patrol) mode = BOT_START_PATROL if(BOT_HUNT) if(frustration >= 8) walk_to(src,0) + set_path(null) back_to_idle() if(target) if(isliving(target))