Merge pull request #10527 from VOREStation/Arokha/AItweak

Tweak AI
This commit is contained in:
Aronai Sieyes
2021-06-02 12:00:23 -04:00
committed by Chompstation Bot
parent 4e39cb8cfc
commit 5c39c85412
2 changed files with 11 additions and 10 deletions

View File

@@ -3,23 +3,20 @@
// 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()
return find_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.
// We conserve ammo (or can't shoot) so walk closer
if(get_dist(holder, target_last_seen_turf) > 1)
return give_destination(target_last_seen_turf, 1, TRUE) // Sets stance as well
// 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()
// We're right there, look around?
else
return find_target()
// Shoot in their direction angrily
else
return shoot_near_turf(target_last_seen_turf)

View File

@@ -69,6 +69,10 @@
// Step 4, give us our selected target.
/datum/ai_holder/proc/give_target(new_target, urgent = FALSE)
ai_log("give_target() : Given '[new_target]', urgent=[urgent].", AI_LOG_TRACE)
if(target)
remove_target()
target = new_target
if(target != null)