diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index 3df635790a5e2..40f43002bedb1 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -258,7 +258,7 @@ /// If the mob won't drop items held in face slot when downed #define TRAIT_IRON_TEETH "t_iron_teeth" -// -- ability traits -- +// -- general ability traits -- /// Xenos with this trait cannot have plasma transferred to them #define TRAIT_ABILITY_NO_PLASMA_TRANSFER "t_ability_no_plasma_transfer" /// Shows that the xeno queen is on ovi @@ -267,6 +267,10 @@ #define TRAIT_ABILITY_BURROWED "t_ability_burrowed" /// Xenos with this trait can toggle long sight while resting. #define TRAIT_ABILITY_SIGHT_IGNORE_REST "t_ability_sight_ignore_rest" + + +// -- specific ability traits -- +#define TRAIT_ABILITY_BOMBARD "t_ability_bombard" /// Used by shielder to check stance. #define TRAIT_ABILITY_ENCLOSED_PLATES "t_ability_enclosed_plates" /// Used by shielder for reflective plates. diff --git a/code/__DEFINES/xeno.dm b/code/__DEFINES/xeno.dm index 4c824d65ade05..fe690f9e90b7f 100644 --- a/code/__DEFINES/xeno.dm +++ b/code/__DEFINES/xeno.dm @@ -806,3 +806,7 @@ #define FACEHUGGER_JUMP_RANGE 1 // dont really want them to hug you immediately as you break down a corner or a door when a carrier stacks them on a tile #define EGG_JUMP_RANGE 2 // This is for egg huggers, they are supposed to be scary and leap at people yes. #define CARRIER_HUGGER_THROW_RANGE 6 + +// defines below should only be used in ability actions. +#define XENO_ACTION_CHECK(X) if(!X.check_state() || !action_cooldown_check() || !check_plasma_owner(src.plasma_cost)) return +#define XENO_ACTION_CHECK_USE_PLASMA(X) if(!X.check_state() || !action_cooldown_check() || !check_and_use_plasma_owner(src.plasma_cost)) return diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm index 13cacd7929595..66d9bc4a9a9c3 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_abilities.dm @@ -462,7 +462,6 @@ ability_uses_acid_overlay = TRUE /// Var that keeps track of in-progress wind-up spits like Bombard to prevent spitting multiple spits at the same time - var/spitting = FALSE var/sound_to_play = "acid_spit" var/aim_turf = FALSE diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm index ec981e3d9ce13..ffeb8250aa133 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/general_powers.dm @@ -911,52 +911,48 @@ return FALSE return TRUE -/datum/action/xeno_action/activable/xeno_spit/use_ability(atom/atom) +/datum/action/xeno_action/activable/xeno_spit/use_ability(atom/target_atom) var/mob/living/carbon/xenomorph/xeno = owner - var/spit_target = aim_turf ? get_turf(atom) : atom - if(!xeno.check_state()) - return + var/spit_target = aim_turf ? get_turf(target_atom) : target_atom - if(spitting) - to_chat(src, SPAN_WARNING("We are already preparing a spit!")) + if(HAS_TRAIT(xeno, TRAIT_ABILITY_BOMBARD)) + to_chat(xeno, SPAN_WARNING("We are already preparing a spit!")) return if(!isturf(xeno.loc)) - to_chat(src, SPAN_WARNING("We can't spit from here!")) + to_chat(xeno, SPAN_WARNING("We can't spit from here!")) return if(!action_cooldown_check()) - to_chat(src, SPAN_WARNING("We must wait for our spit glands to refill.")) + to_chat(xeno, SPAN_WARNING("We must wait for our spit glands to refill.")) return var/turf/current_turf = get_turf(xeno) - if(!current_turf) return - if (!check_plasma_owner()) - return + XENO_ACTION_CHECK(xeno) if(xeno.ammo.spit_windup) - spitting = TRUE + ADD_TRAIT(xeno, TRAIT_ABILITY_BOMBARD, TRAIT_SOURCE_ABILITY("bombard")) if(xeno.ammo.pre_spit_warn) playsound(xeno.loc,"alien_drool", 55, 1) to_chat(xeno, SPAN_WARNING("We begin to prepare a large spit!")) xeno.visible_message(SPAN_WARNING("[xeno] prepares to spit a massive glob!"), SPAN_WARNING("We begin to spit [xeno.ammo.name]!")) - if (!do_after(xeno, xeno.ammo.spit_windup, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_HOSTILE)) + if(!do_after(xeno, xeno.ammo.spit_windup, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_HOSTILE)) to_chat(xeno, SPAN_XENODANGER("We decide to cancel our spit.")) - spitting = FALSE + REMOVE_TRAIT(xeno, TRAIT_ABILITY_BOMBARD, TRAIT_SOURCE_ABILITY("bombard")) return plasma_cost = xeno.ammo.spit_cost if(!check_and_use_plasma_owner()) - spitting = FALSE + REMOVE_TRAIT(xeno, TRAIT_ABILITY_BOMBARD, TRAIT_SOURCE_ABILITY("bombard")) return - xeno.visible_message(SPAN_XENOWARNING("[xeno] spits at [atom]!"), + xeno.visible_message(SPAN_XENOWARNING("[xeno] spits at [target_atom]!"), - SPAN_XENOWARNING("We spit [xeno.ammo.name] at [atom]!") ) + SPAN_XENOWARNING("We spit [xeno.ammo.name] at [target_atom]!") ) playsound(xeno.loc, sound_to_play, 25, 1) var/obj/projectile/proj = new (current_turf, create_cause_data(xeno.ammo.name, xeno)) @@ -965,8 +961,7 @@ proj.def_zone = xeno.get_limbzone_target() proj.fire_at(spit_target, xeno, xeno, xeno.ammo.max_range, xeno.ammo.shell_speed) - spitting = FALSE - + REMOVE_TRAIT(xeno, TRAIT_ABILITY_BOMBARD, TRAIT_SOURCE_ABILITY("bombard")) SEND_SIGNAL(xeno, COMSIG_XENO_POST_SPIT) apply_cooldown() diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm index d2cd1e6615566..5ea9d9a32566b 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/xeno_action.dm @@ -485,6 +485,3 @@ /datum/action/xeno_action/proc/on_deselect(mob/user) return - -#define XENO_ACTION_CHECK(X) if(!X.check_state() || !action_cooldown_check() || !check_plasma_owner(src.plasma_cost)) return -#define XENO_ACTION_CHECK_USE_PLASMA(X) if(!X.check_state() || !action_cooldown_check() || !check_and_use_plasma_owner(src.plasma_cost)) return diff --git a/code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm b/code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm index 95483880fa51b..90c35a68dfd6b 100644 --- a/code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm +++ b/code/modules/mob/living/carbon/xenomorph/castes/Boiler.dm @@ -102,9 +102,9 @@ . = ..() var/mob/living/carbon/xenomorph/xeno = owner if(!action_cooldown_check()) // activate c/d only if we already spit - for (var/action_type in action_types_to_cd) + for(var/action_type in action_types_to_cd) var/datum/action/xeno_action/xeno_action = get_action(xeno, action_type) - if (!istype(xeno_action)) + if(!istype(xeno_action)) continue xeno_action.apply_cooldown_override(cooldown_duration) @@ -113,21 +113,17 @@ /datum/action/xeno_action/onclick/acid_shroud/use_ability(atom/affected_atom) var/datum/effect_system/smoke_spread/xeno_acid/spicy_gas var/mob/living/carbon/xenomorph/xeno = owner - if (!isxeno(owner)) + if(!isxeno(owner)) return - if (!action_cooldown_check()) - return - - if (!xeno.check_state()) - return + XENO_ACTION_CHECK(xeno) if(sound_play) playsound(xeno,"acid_strike", 35, 1) sound_play = FALSE addtimer(VARSET_CALLBACK(src, sound_play, TRUE), 2 SECONDS) - if (!do_after(xeno, xeno.ammo.spit_windup/6.5, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_HOSTILE, numticks = 2)) /// 0.7 seconds + if(!do_after(xeno, xeno.ammo.spit_windup / 6.5, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_HOSTILE, numticks = 2)) /// 0.7 seconds to_chat(xeno, SPAN_XENODANGER("We decide to cancel our gas shroud.")) return @@ -144,9 +140,9 @@ spicy_gas.start() to_chat(xeno, SPAN_XENOHIGHDANGER("We dump our acid through our pores, creating a shroud of gas!")) - for (var/action_type in action_types_to_cd) + for(var/action_type in action_types_to_cd) var/datum/action/xeno_action/xeno_action = get_action(xeno, action_type) - if (!istype(xeno_action)) + if(!istype(xeno_action)) continue xeno_action.apply_cooldown_override(cooldown_duration)