From b00effff0d0dcf892a4cc14f8407497dad4f38a1 Mon Sep 17 00:00:00 2001 From: Aronai Sieyes Date: Wed, 26 May 2021 00:17:56 -0400 Subject: [PATCH] Tweak or break AI --- code/modules/ai/ai_holder_combat_unseen.dm | 13 ++++++++----- code/modules/ai/ai_holder_targeting.dm | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) 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)