From 39ac21f500f24d24d8d8dbba0b810b46a2ec21cc Mon Sep 17 00:00:00 2001 From: xDanilcusx Date: Mon, 23 Oct 2023 03:29:33 +0300 Subject: [PATCH] stop lurking on crit and small handle_ai_shot refactor --- code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm | 8 +++----- code/modules/mob/living/carbon/xenomorph/life.dm | 4 ++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm b/code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm index 4124290454..e090928a3d 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Lurker.dm @@ -79,16 +79,14 @@ /mob/living/carbon/xenomorph/lurker/handle_ai_shot(obj/projectile/P) if(P.firer) - var/distance = get_dist(src, P.firer) - if(distance > world.view) - if(prob(LURKING_IGNORE_SHOT_CHANCE)) - return + if(prob(LURKING_IGNORE_SHOT_CHANCE)) + return var/datum/xeno_ai_movement/linger/lurking/lurker_ai = ai_movement_handler if(lurker_ai && istype(lurker_ai)) lurker_ai.stop_lurking() - SSxeno_pathfinding.calculate_path(src, P.firer, distance, src, CALLBACK(src, PROC_REF(set_path)), list(src, P.firer)) + SSxeno_pathfinding.calculate_path(src, P.firer, ai_range, src, CALLBACK(src, PROC_REF(set_path)), list(src, P.firer)) /mob/living/carbon/xenomorph/lurker/ai_move_target(delta_time) if(throwing) diff --git a/code/modules/mob/living/carbon/xenomorph/life.dm b/code/modules/mob/living/carbon/xenomorph/life.dm index 65839e9c8c..33e53cbd1d 100644 --- a/code/modules/mob/living/carbon/xenomorph/life.dm +++ b/code/modules/mob/living/carbon/xenomorph/life.dm @@ -539,6 +539,10 @@ Make sure their actual health updates immediately.*/ if(!lying) update_canmove() + var/datum/xeno_ai_movement/linger/lurking/AI = ai_movement_handler + if(AI && istype(AI)) + AI.stop_lurking() + /mob/living/carbon/xenomorph/proc/handle_luminosity() var/new_luminosity = 0 if(caste)