From 79d7d0f8b0e77d63b65747576d1c789431567850 Mon Sep 17 00:00:00 2001 From: Halonexus Date: Tue, 17 Dec 2024 18:06:37 +0300 Subject: [PATCH] Smoother retargetting --- .../living/simple_animal/hostile/hostile.dm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index 03bcab619e6f..01da7bfb9c10 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -695,15 +695,17 @@ target and they suddenly or are currently something we dont attack.*/ if(QDELETED(target)) - if(approaching_target) - /* Approaching target means we are currently moving menacingly - towards something. Otherwise we are just moving and if we - are investigating a location we dont want to be told to stand still. */ - LoseTarget() - return FALSE + if(!FindTarget(possible_targets, TRUE)) + if(approaching_target) + /* Approaching target means we are currently moving menacingly + towards something. Otherwise we are just moving and if we + are investigating a location we dont want to be told to stand still. */ + LoseTarget() + return FALSE if(!CanAttack(target)) - LoseTarget() - return FALSE + if(!FindTarget(possible_targets, TRUE)) + LoseTarget() + return FALSE // The target we currently have is in our view and we must decide if we move towards it more. if(target in possible_targets) var/turf/T = get_turf(src)