several improvements: WIP

This commit is contained in:
Sypsoti
2022-04-16 09:24:33 -08:00
committed by atermonera
parent 2774f7dd50
commit 2fae0d653d
5 changed files with 111 additions and 4 deletions
+2 -2
View File
@@ -4,7 +4,7 @@
/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)
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))
@@ -12,7 +12,7 @@
// Go to where you last saw the enemy.
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)
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)
@@ -0,0 +1,37 @@
/*
/// For Skathari
/// In its own file to easily expand upon. Mob found in alien.dm
*/
/datum/ai_holder/simple_mob/xeno_alien /// Basic
hostile = TRUE
retaliate = TRUE
cooperative = TRUE
returns_home = FALSE
can_flee = FALSE
speak_chance = 0
wander = TRUE
base_wander_delay = 4
/datum/ai_holder/simple_mob/xeno_alien/post_melee_attack(atom/A)
if(holder.Adjacent(A))
holder.IMove(get_step(holder, pick(alldirs)))
holder.face_atom(A)
/datum/ai_holder/simple_mob/xeno_alien/ranged /// Drones
pointblank = TRUE
ignore_incapacitated = TRUE /// We're squishier and our tox hits hard. Focus on who's up.
var/run_if_this_close = 4
var/max_distance = 6
/datum/ai_holder/simple_mob/xeno_alien/ranged/on_engagement(atom/A)
if(get_dist(holder, A) < run_if_this_close)
holder.IMove(get_step_away(holder, A, run_if_this_close))
holder.face_atom(A)
else if(get_dist(holder, A) > max_distance)
holder.IMove(get_step_towards(holder, A))
holder.face_atom(A)
/datum/ai_holder/simple_mob/xeno_alien/empress /// Big mama
ignore_incapacitated = TRUE /// Focus on better threats.
intelligence_level = AI_SMART /// She's got the brains
+8
View File
@@ -4,6 +4,7 @@
var/hostile = FALSE // Do we try to hurt others?
var/retaliate = FALSE // Attacks whatever struck it first. Mobs will still attack back if this is false but hostile is true.
var/mauling = FALSE // Attacks unconscious mobs
var/ignore_incapacitated = FALSE // If it's interested in attacking targets that are STUNNED.
var/handle_corpse = FALSE // Allows AI to acknowledge corpses (e.g. nurse spiders)
var/atom/movable/target = null // The thing (mob or object) we're trying to kill.
@@ -129,6 +130,9 @@
return TRUE
else
return FALSE
if(L.incapacitated(INCAPACITATION_STUNNED)) // Are they stunned and do we care?
if(ignore_incapacitated)
return FALSE
if(holder.IIsAlly(L))
return FALSE
return TRUE
@@ -161,6 +165,10 @@
/datum/ai_holder/proc/lose_target()
ai_log("lose_target() : Entering.", AI_LOG_TRACE)
if(target)
ai_log("lose_target() : Had a target, checking if still valid.", AI_LOG_DEBUG)
if(!can_attack(target, FALSE)) /// If it's not valid to chase, don't keep looking.
remove_target()
return find_target()
ai_log("lose_target() : Had a target, setting to null and LTT.", AI_LOG_DEBUG)
target = null
lose_target_time = world.time