From 9bcdb2faf9266d58770920499fa4d9af4c7c545f Mon Sep 17 00:00:00 2001 From: Morrow Date: Tue, 14 Nov 2023 00:56:05 -0500 Subject: [PATCH] reset charge turf if we stop for some reason --- code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm | 2 ++ .../carbon/xenomorph/abilities/crusher/crusher_abilities.dm | 1 + .../mob/living/carbon/xenomorph/ai/movement/crusher.dm | 6 ++++++ 3 files changed, 9 insertions(+) diff --git a/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm b/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm index f66c264fde..0027e6700b 100644 --- a/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm +++ b/code/__DEFINES/dcs/signals/atom/mob/living/signals_xeno.dm @@ -42,6 +42,8 @@ #define COMSIG_XENO_STOP_MOMENTUM "xeno_stop_momentum" /// Called whenever xeno should resume charge #define COMSIG_XENO_START_CHARGING "xeno_start_charging" +/// From /datum/action/xeno_action/onclick/charger_charge/proc/stop_momentum() +#define COMSIG_XENO_STOPPED_CHARGING "xeno_stopped_charging" // Used in resin_constructions.dm // Checks whether the xeno can build a thick structure regardless of hive weeds diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/crusher/crusher_abilities.dm b/code/modules/mob/living/carbon/xenomorph/abilities/crusher/crusher_abilities.dm index 3c7c268c77..55624714e3 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/crusher/crusher_abilities.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/crusher/crusher_abilities.dm @@ -240,6 +240,7 @@ Xeno.visible_message(SPAN_DANGER("[Xeno] skids to a halt!")) REMOVE_TRAIT(Xeno, TRAIT_CHARGING, TRAIT_SOURCE_XENO_ACTION_CHARGE) + SEND_SIGNAL(Xeno, COMSIG_XENO_STOPPED_CHARGING) steps_taken = 0 momentum = 0 Xeno.recalculate_speed() diff --git a/code/modules/mob/living/carbon/xenomorph/ai/movement/crusher.dm b/code/modules/mob/living/carbon/xenomorph/ai/movement/crusher.dm index 5c63a2364b..e597c5ab16 100644 --- a/code/modules/mob/living/carbon/xenomorph/ai/movement/crusher.dm +++ b/code/modules/mob/living/carbon/xenomorph/ai/movement/crusher.dm @@ -6,6 +6,7 @@ /datum/xeno_ai_movement/crusher/New(mob/living/carbon/xenomorph/parent) . = ..() + RegisterSignal(parent, COMSIG_XENO_STOPPED_CHARGING, PROC_REF(stopped_charging)) #define MIN_TARGETS_TO_CHARGE 2 #define MAX_CHARGE_DISTANCE 50 @@ -143,6 +144,11 @@ INVOKE_ASYNC(charge_action, TYPE_PROC_REF(/datum/action/xeno_action/onclick/charger_charge, use_ability_wrapper)) charge_turf = null +/datum/xeno_ai_movement/crusher/proc/stopped_charging() + SIGNAL_HANDLER + + charge_turf = null + /mob/living/carbon/xenomorph/crusher/Move(NewLoc, direct) if(direct == 0) direct = last_move_dir