diff --git a/code/modules/ai/ai_holder_combat_unseen.dm b/code/modules/ai/ai_holder_combat_unseen.dm index 5c29f8a31b3..ae6743832fd 100644 --- a/code/modules/ai/ai_holder_combat_unseen.dm +++ b/code/modules/ai/ai_holder_combat_unseen.dm @@ -3,16 +3,19 @@ // Used when a target is out of sight or invisible. /datum/ai_holder/proc/engage_unseen_enemy() ai_log("engage_unseen_enemy() : Entering.", AI_LOG_TRACE) + // Also handled in strategic updates but handling it here allows for more fine resolution timeouts + if((lose_target_time+lose_target_timeout) >= world.time) + return remove_target() // Lets do some last things before giving up. if(conserve_ammo || !holder.ICheckRangedAttack(target_last_seen_turf)) if(get_dist(holder, target_last_seen_turf) > 1) // We last saw them over there. // Go to where you last saw the enemy. return give_destination(target_last_seen_turf, 1, TRUE) // Sets stance as well - else if(lose_target_time < world.time) // We last saw them next to us, so do a blind attack on that tile. - if(melee_on_tile(target_last_seen_turf) != ATTACK_SUCCESSFUL && intelligence_level >= AI_NORMAL) - var/obj/O = find_escape_route() - if(istype(O)) - return give_destination(get_turf(O), 0, TRUE) + // We last saw them next to us, so do a blind attack on that tile. + else if(melee_on_tile(target_last_seen_turf) != ATTACK_SUCCESSFUL && intelligence_level >= AI_NORMAL) + var/obj/O = find_escape_route() + if(istype(O)) + return give_destination(get_turf(O), 0, TRUE) else return find_target() else diff --git a/code/modules/ai/ai_holder_targeting.dm b/code/modules/ai/ai_holder_targeting.dm index 3647c53cc51..d4fd0fa33b3 100644 --- a/code/modules/ai/ai_holder_targeting.dm +++ b/code/modules/ai/ai_holder_targeting.dm @@ -183,6 +183,7 @@ give_up_movement() lose_target_position() set_stance(STANCE_IDLE) + return TRUE // Check if target is visible to us. /datum/ai_holder/proc/can_see_target(atom/movable/the_target, view_range = vision_range) diff --git a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm index 51b07954a61..eb55b02dabf 100644 --- a/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm +++ b/code/modules/mob/living/simple_mob/subtypes/animal/giant_spider/nurse.dm @@ -140,7 +140,7 @@ if(large_cocoon) C.icon_state = pick("cocoon_large1","cocoon_large2","cocoon_large3") - ai_holder.target = null + ai_holder.remove_target() return TRUE diff --git a/code/modules/mob/living/simple_mob/subtypes/vore/softdog.dm b/code/modules/mob/living/simple_mob/subtypes/vore/softdog.dm index b5804c22671..6eeeff5c7fb 100644 --- a/code/modules/mob/living/simple_mob/subtypes/vore/softdog.dm +++ b/code/modules/mob/living/simple_mob/subtypes/vore/softdog.dm @@ -188,6 +188,7 @@ retaliate = 1 cooperative = TRUE speak_chance = 1 + lose_target_timeout = 0 // Easily distracted /datum/ai_holder/simple_mob/woof/hostile hostile = 1