From 2ede6af8bcec2ea084670eb8f693b7c445e262e8 Mon Sep 17 00:00:00 2001 From: CabinetOnFire Date: Wed, 29 Apr 2026 22:59:01 +0200 Subject: [PATCH] Fix basic mobs triggering click cooldown erroneously. (#95906) ## About The Pull Request Basic Mobs used to always trigger cooldown on clicks. This resulted in missed attacks causing you to have a delay before you could attack again, this makes it really punishing to play as a basic mob. To resolve this I did a mini-refactor on basic mob's attack chain to allow for the return values to determine whether we go on cooldown or not. Preventing attacks that did nothing (due to not passing checks, or simply not having any behavior) from causing cooldown. This fixes #95605 ## Why It's Good For The Game being able to perform melee with the same rules as /human is only fair ## Changelog :cl: DresserOnFire fix: Fixes a bug where player-controlled basic mobs would get a cooldown when their attacks miss refactor: basic mob attack chain can now decided whether an attack resulted in a cooldown or not. /:cl: --- code/__DEFINES/basic_mobs.dm | 8 ++++++++ code/_onclick/other_mobs.dm | 2 +- code/game/objects/items/food/packaged.dm | 1 + .../game/objects/structures/lavaland/ore_vent.dm | 1 + .../antagonists/voidwalker/voidwalker_mob.dm | 10 +++++----- .../modules/mining/boulder_processing/boulder.dm | 1 + code/modules/mob/living/basic/alien/maid.dm | 6 +++--- code/modules/mob/living/basic/basic.dm | 15 ++++++++------- code/modules/mob/living/basic/boss/boss.dm | 3 ++- .../living/basic/bots/secbot/super_beepsky.dm | 3 +++ .../mob/living/basic/farm_animals/bee/_bee.dm | 8 ++++---- .../living/basic/icemoon/ice_whelp/ice_whelp.dm | 12 ++++++------ .../mob/living/basic/jungle/seedling/seedling.dm | 10 +++++----- .../basic/lavaland/gutlunchers/gutlunchers.dm | 6 +++--- .../mob/living/basic/lavaland/mook/mook.dm | 10 +++++----- .../mob/living/basic/lavaland/raptor/_raptor.dm | 8 ++++---- .../modules/mob/living/basic/minebots/minebot.dm | 8 ++++---- code/modules/mob/living/basic/pets/cat/cat.dm | 12 ++++++------ .../modules/mob/living/basic/pets/orbie/orbie.dm | 8 ++++---- .../mob/living/basic/pets/parrot/_parrot.dm | 8 ++++---- .../living/basic/ruin_defender/mimic/mimic.dm | 2 +- .../living/basic/space_fauna/eyeball/_eyeball.dm | 10 +++++----- .../living/basic/space_fauna/hivebot/_hivebot.dm | 8 ++++---- .../mob/living/basic/space_fauna/morph.dm | 16 ++++++++-------- .../basic/space_fauna/regal_rat/regal_rat.dm | 14 +++++++------- .../basic/space_fauna/supermatter_spider.dm | 8 ++++---- 26 files changed, 107 insertions(+), 91 deletions(-) diff --git a/code/__DEFINES/basic_mobs.dm b/code/__DEFINES/basic_mobs.dm index 32360a21260..1a97163a871 100644 --- a/code/__DEFINES/basic_mobs.dm +++ b/code/__DEFINES/basic_mobs.dm @@ -119,3 +119,11 @@ GLOBAL_LIST_EMPTY(customized_pets) #define BB_RAPTOR_FLEE_THRESHOLD "raptor_flee_threshold" #define MAX_RAPTOR_POP 64 + + +///Return value for [/mob/living/basic/proc/early_melee_attack]. Using this value will make the attack continue as normal. +#define BASIC_MOB_CONTINUE_ATTACK_CHAIN 0 +///Return value for [/mob/living/basic/proc/early_melee_attack]. Using this value will make the attack end, but not set a cooldown. This is the default. +#define BASIC_MOB_END_ATTACK_CHAIN 1 +///Return value for [/mob/living/basic/proc/early_melee_attack]. Using this value will make the attack end, and sets a cooldown. Useful if you add behavior to early_melee_attack +#define BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN 2 diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index 1cd89773c55..b934d7417e6 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -188,7 +188,7 @@ /atom/proc/attack_basic_mob(mob/user, list/modifiers) SHOULD_CALL_PARENT(TRUE) if(SEND_SIGNAL(src, COMSIG_ATOM_ATTACK_BASIC_MOB, user) & COMSIG_BASIC_ATTACK_CANCEL_CHAIN) - return + return FALSE return handle_basic_attack(user, modifiers) //return value of attack animal, this is how much damage was dealt to the attacked thing ///This exists so stuff can override the default call of attack_animal for attack_basic_mob diff --git a/code/game/objects/items/food/packaged.dm b/code/game/objects/items/food/packaged.dm index 95054ec4a1a..597ec3ce60d 100644 --- a/code/game/objects/items/food/packaged.dm +++ b/code/game/objects/items/food/packaged.dm @@ -117,6 +117,7 @@ if(!check_buffability(user)) return ..() apply_buff(user) + return TRUE /obj/item/food/canned/envirochow/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers) if(!check_buffability(interacting_with)) diff --git a/code/game/objects/structures/lavaland/ore_vent.dm b/code/game/objects/structures/lavaland/ore_vent.dm index c4204fd3f67..38e5ac83537 100644 --- a/code/game/objects/structures/lavaland/ore_vent.dm +++ b/code/game/objects/structures/lavaland/ore_vent.dm @@ -140,6 +140,7 @@ . = ..() if(HAS_TRAIT(user, TRAIT_BOULDER_BREAKER)) produce_boulder(TRUE) + return TRUE /obj/structure/ore_vent/is_buckle_possible(mob/living/target, force, check_loc) . = ..() diff --git a/code/modules/antagonists/voidwalker/voidwalker_mob.dm b/code/modules/antagonists/voidwalker/voidwalker_mob.dm index 447389876ea..2cd3ff136bb 100644 --- a/code/modules/antagonists/voidwalker/voidwalker_mob.dm +++ b/code/modules/antagonists/voidwalker/voidwalker_mob.dm @@ -139,7 +139,7 @@ /mob/living/basic/voidwalker/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!. || !can_do_abductions) + if(. || !can_do_abductions) return if(ishuman(target)) @@ -151,12 +151,12 @@ hewmon.apply_status_effect(/datum/status_effect/void_chomped) if(!should_attack) - return FALSE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN if(hewmon.stat == HARD_CRIT && !hewmon.has_trauma_type(/datum/brain_trauma/voided)) hewmon.balloon_alert(src, "is in crit!") hewmon.Stun(5 SECONDS) // blocks some crit movement mechanics from a bunch of sources - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN // left click if(LAZYACCESS(modifiers, LEFT_CLICK)) @@ -167,9 +167,9 @@ melee_damage_type = rclick_damage_type if(!istype(target, /turf/closed/wall)) - return + return BASIC_MOB_CONTINUE_ATTACK_CHAIN INVOKE_ASYNC(src, PROC_REF(try_convert_wall), target) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN /// Called by the regenerator component so we only regen in space /mob/living/basic/voidwalker/proc/can_regen() diff --git a/code/modules/mining/boulder_processing/boulder.dm b/code/modules/mining/boulder_processing/boulder.dm index 94435f233d7..96ed8878e71 100644 --- a/code/modules/mining/boulder_processing/boulder.dm +++ b/code/modules/mining/boulder_processing/boulder.dm @@ -110,6 +110,7 @@ return if(HAS_TRAIT(user, TRAIT_BOULDER_BREAKER)) manual_process(null, user, INATE_BOULDER_SPEED_MULTIPLIER) //A little hacky but it works around the speed of the blackboard task selection process for now. + return TRUE /obj/item/boulder/interact_with_atom(atom/interacting_with, mob/living/user, list/modifiers) . = ..() diff --git a/code/modules/mob/living/basic/alien/maid.dm b/code/modules/mob/living/basic/alien/maid.dm index cf6499884e9..7132f2ef4b0 100644 --- a/code/modules/mob/living/basic/alien/maid.dm +++ b/code/modules/mob/living/basic/alien/maid.dm @@ -19,15 +19,15 @@ ///Handles the maid attacking other players, cancelling the attack to clean up instead. /mob/living/basic/alien/maid/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return target.wash(CLEAN_SCRUB) if(istype(target, /obj/effect/decal/cleanable)) visible_message(span_notice("[src] cleans up \the [target].")) else visible_message(span_notice("[src] polishes \the [target].")) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /** * Barmaid special type diff --git a/code/modules/mob/living/basic/basic.dm b/code/modules/mob/living/basic/basic.dm index 0392cfcc6bc..4463ac48069 100644 --- a/code/modules/mob/living/basic/basic.dm +++ b/code/modules/mob/living/basic/basic.dm @@ -232,21 +232,22 @@ . += span_deadsay("Upon closer examination, [p_they()] appear[p_s()] to be [HAS_MIND_TRAIT(user, TRAIT_NAIVE) ? "asleep" : "dead"].") /mob/living/basic/proc/melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE) - if(!early_melee_attack(target, modifiers, ignore_cooldown)) + var/early_melee_result = early_melee_attack(target, modifiers, ignore_cooldown) + if(early_melee_result) //Truthy value means we want to end the chain + if(!ignore_cooldown && early_melee_result == BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN) + changeNext_move(melee_attack_cooldown) return FALSE var/result = target.attack_basic_mob(src, modifiers) SEND_SIGNAL(src, COMSIG_HOSTILE_POST_ATTACKINGTARGET, target, result) - if(!ignore_cooldown) - changeNext_move(melee_attack_cooldown) // Set it again because objects like to fuck with it in attack_basic_mob + if(result && !ignore_cooldown) //Only set cooldown if the attack achieved something, which is the case when the value is true-ey. This could definitely be done better but is probably easier once living/simple is gone and we no longer use attack_animal. + changeNext_move(melee_attack_cooldown) return result /mob/living/basic/proc/early_melee_attack(atom/target, list/modifiers, ignore_cooldown = FALSE) face_atom(target) - if(!ignore_cooldown) - changeNext_move(melee_attack_cooldown) // Set cooldown early in case it is cancelled if(SEND_SIGNAL(src, COMSIG_HOSTILE_PRE_ATTACKINGTARGET, target, Adjacent(target), modifiers) & COMPONENT_HOSTILE_NO_ATTACK) - return FALSE //but more importantly return before attack_animal called - return TRUE + return BASIC_MOB_END_ATTACK_CHAIN //but more importantly return before attack_animal called + return BASIC_MOB_CONTINUE_ATTACK_CHAIN /mob/living/basic/resolve_unarmed_attack(atom/attack_target, list/modifiers) melee_attack(attack_target, modifiers) diff --git a/code/modules/mob/living/basic/boss/boss.dm b/code/modules/mob/living/basic/boss/boss.dm index 4ffd7961de3..8f4a4924800 100644 --- a/code/modules/mob/living/basic/boss/boss.dm +++ b/code/modules/mob/living/basic/boss/boss.dm @@ -77,10 +77,11 @@ /mob/living/basic/boss/early_melee_attack(mob/living/target, list/modifiers, ignore_cooldown) . = ..() - if(!. || !istype(target)) + if(. || !istype(target)) return if(should_devour(target)) devour(target) + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /// Determines if this mob is worth devouring /mob/living/basic/boss/proc/should_devour(mob/living/victim) diff --git a/code/modules/mob/living/basic/bots/secbot/super_beepsky.dm b/code/modules/mob/living/basic/bots/secbot/super_beepsky.dm index cdb780036d8..1f82db49c7a 100644 --- a/code/modules/mob/living/basic/bots/secbot/super_beepsky.dm +++ b/code/modules/mob/living/basic/bots/secbot/super_beepsky.dm @@ -75,8 +75,11 @@ /mob/living/basic/bot/secbot/grievous/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() + if(.) + return INVOKE_ASYNC(weapon, TYPE_PROC_REF(/obj/item, melee_attack_chain), src, target) playsound(src, 'sound/items/weapons/blade1.ogg', 50, TRUE, -1) + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/bot/secbot/grievous/explode() var/atom/drop_location = drop_location() diff --git a/code/modules/mob/living/basic/farm_animals/bee/_bee.dm b/code/modules/mob/living/basic/farm_animals/bee/_bee.dm index a90b4e0dd4f..66cd498ccd6 100644 --- a/code/modules/mob/living/basic/farm_animals/bee/_bee.dm +++ b/code/modules/mob/living/basic/farm_animals/bee/_bee.dm @@ -111,18 +111,18 @@ /mob/living/basic/bee/early_melee_attack(atom/target, list/modifiers) . = ..() - if(!.) - return FALSE + if(.) + return if(istype(target, /obj/machinery/hydroponics)) var/obj/machinery/hydroponics/hydro = target pollinate(hydro) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(istype(target, /obj/structure/beebox)) var/obj/structure/beebox/hive = target handle_habitation(hive) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/bee/proc/handle_habitation(obj/structure/beebox/hive) if(hive == beehome) //if its our home, we enter or exit it diff --git a/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm b/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm index 1000c919b11..7d4c74747a3 100644 --- a/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm +++ b/code/modules/mob/living/basic/icemoon/ice_whelp/ice_whelp.dm @@ -51,22 +51,22 @@ /mob/living/basic/mining/ice_whelp/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(istype(target, /obj/structure/flora/rock/icy)) create_sculpture(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(!istype(target, type)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/mob/living/victim = target if(victim.stat != DEAD) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN cannibalize_victim(victim) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /// Carve a stone into a beautiful self-portrait /mob/living/basic/mining/ice_whelp/proc/create_sculpture(atom/target) diff --git a/code/modules/mob/living/basic/jungle/seedling/seedling.dm b/code/modules/mob/living/basic/jungle/seedling/seedling.dm index 129e7d7b2f3..49acc32e5ee 100644 --- a/code/modules/mob/living/basic/jungle/seedling/seedling.dm +++ b/code/modules/mob/living/basic/jungle/seedling/seedling.dm @@ -85,19 +85,19 @@ /mob/living/basic/seedling/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(istype(target, /obj/machinery/hydroponics)) treat_hydro_tray(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(isnull(held_can)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN if(istype(target, /obj/structure/sink) || istype(target, /obj/structure/reagent_dispensers)) held_can.melee_attack_chain(src, target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN ///seedlings can water trays, remove weeds, or remove dead plants diff --git a/code/modules/mob/living/basic/lavaland/gutlunchers/gutlunchers.dm b/code/modules/mob/living/basic/lavaland/gutlunchers/gutlunchers.dm index 87df7e847b5..9489a119c5c 100644 --- a/code/modules/mob/living/basic/lavaland/gutlunchers/gutlunchers.dm +++ b/code/modules/mob/living/basic/lavaland/gutlunchers/gutlunchers.dm @@ -46,16 +46,16 @@ /mob/living/basic/mining/gutlunch/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) + if(.) return if(!istype(target, /obj/structure/ore_container/food_trough/gutlunch_trough)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/obj/ore_food = locate(/obj/item/stack/ore) in target if(isnull(ore_food)) balloon_alert(src, "no food!") else UnarmedAttack(ore_food, TRUE, modifiers) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/mining/gutlunch/proc/after_birth(mob/living/basic/mining/gutlunch/grub/baby, mob/living/partner) var/our_color = LAZYACCESS(atom_colours, FIXED_COLOUR_PRIORITY) || COLOR_GRAY diff --git a/code/modules/mob/living/basic/lavaland/mook/mook.dm b/code/modules/mob/living/basic/lavaland/mook/mook.dm index a9cd028f4b6..80d398f23d0 100644 --- a/code/modules/mob/living/basic/lavaland/mook/mook.dm +++ b/code/modules/mob/living/basic/lavaland/mook/mook.dm @@ -97,26 +97,26 @@ /mob/living/basic/mining/mook/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return return attack_sequence(target) /mob/living/basic/mining/mook/proc/attack_sequence(atom/target) if(istype(target, /obj/item/stack/ore) && isnull(held_ore)) var/obj/item/ore_target = target ore_target.forceMove(src) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(istype(target, /obj/structure/ore_container/material_stand)) if(held_ore) held_ore.forceMove(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(istype(target, /obj/structure/bonfire)) var/obj/structure/bonfire/fire_target = target if(!fire_target.burning) fire_target.start_burning() - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/mining/mook/proc/change_combatant_state(state) attack_state = state diff --git a/code/modules/mob/living/basic/lavaland/raptor/_raptor.dm b/code/modules/mob/living/basic/lavaland/raptor/_raptor.dm index 82f8c484bcd..9d8fb37179d 100644 --- a/code/modules/mob/living/basic/lavaland/raptor/_raptor.dm +++ b/code/modules/mob/living/basic/lavaland/raptor/_raptor.dm @@ -169,16 +169,16 @@ GLOBAL_LIST_EMPTY(raptor_population) /mob/living/basic/raptor/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(!istype(target, /obj/structure/ore_container/food_trough/raptor_trough)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/obj/ore_food = locate(/obj/item/stack/ore) in target if(isnull(ore_food)) balloon_alert(src, "no food!") else UnarmedAttack(ore_food, TRUE, modifiers) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/raptor/melee_attack(mob/living/target, list/modifiers, ignore_cooldown) if (!combat_mode && istype(target, /mob/living/basic/raptor)) diff --git a/code/modules/mob/living/basic/minebots/minebot.dm b/code/modules/mob/living/basic/minebots/minebot.dm index 0409095f8a8..525f1450141 100644 --- a/code/modules/mob/living/basic/minebots/minebot.dm +++ b/code/modules/mob/living/basic/minebots/minebot.dm @@ -255,13 +255,13 @@ /mob/living/basic/mining_drone/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(!istype(target, /mob/living/basic/node_drone)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN repair_node_drone(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/mining_drone/proc/repair_node_drone(mob/living/my_target) do_sparks(5, FALSE, source = my_target) diff --git a/code/modules/mob/living/basic/pets/cat/cat.dm b/code/modules/mob/living/basic/pets/cat/cat.dm index 0f749660c2e..30d36663698 100644 --- a/code/modules/mob/living/basic/pets/cat/cat.dm +++ b/code/modules/mob/living/basic/pets/cat/cat.dm @@ -103,21 +103,21 @@ /mob/living/basic/pet/cat/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(istype(target, /obj/machinery/oven/range) && can_interact_with_stove) target.attack_hand(src) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(!can_hold_item) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN if(!is_type_in_list(target, huntable_items) || held_food) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/atom/movable/movable_target = target movable_target.forceMove(src) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/pet/cat/Exited(atom/movable/gone, direction) . = ..() diff --git a/code/modules/mob/living/basic/pets/orbie/orbie.dm b/code/modules/mob/living/basic/pets/orbie/orbie.dm index 40a93f4b882..fbbdfd89d22 100644 --- a/code/modules/mob/living/basic/pets/orbie/orbie.dm +++ b/code/modules/mob/living/basic/pets/orbie/orbie.dm @@ -63,14 +63,14 @@ /mob/living/basic/orbie/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(src == target || happy_state || !istype(target)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN toggle_happy_state() addtimer(CALLBACK(src, PROC_REF(toggle_happy_state)), 30 SECONDS) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/orbie/proc/on_lights(datum/source) SIGNAL_HANDLER diff --git a/code/modules/mob/living/basic/pets/parrot/_parrot.dm b/code/modules/mob/living/basic/pets/parrot/_parrot.dm index 8e338d7bf60..d40a6af9b3d 100644 --- a/code/modules/mob/living/basic/pets/parrot/_parrot.dm +++ b/code/modules/mob/living/basic/pets/parrot/_parrot.dm @@ -282,14 +282,14 @@ GLOBAL_LIST_INIT(strippable_parrot_items, create_strippable_list(list( /// This is pretty much meant for players, AI will use the task-specific procs instead. /mob/living/basic/parrot/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(isitem(target) && steal_from_ground(target)) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(iscarbon(target) && steal_from_mob(target)) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /// Picks up an item from the ground and puts it in our claws. Returns TRUE if we picked it up, FALSE otherwise. /mob/living/basic/parrot/proc/steal_from_ground(obj/item/target) diff --git a/code/modules/mob/living/basic/ruin_defender/mimic/mimic.dm b/code/modules/mob/living/basic/ruin_defender/mimic/mimic.dm index c6140302bf8..c19af055529 100644 --- a/code/modules/mob/living/basic/ruin_defender/mimic/mimic.dm +++ b/code/modules/mob/living/basic/ruin_defender/mimic/mimic.dm @@ -138,7 +138,7 @@ GLOBAL_LIST_INIT(animatable_blacklist, typecacheof(list( /mob/living/basic/mimic/crate/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) if(target == src) toggle_open() - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN return ..() /mob/living/basic/mimic/crate/CanAllowThrough(atom/movable/mover, border_dir) diff --git a/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm b/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm index 26bb5548e80..7b2846d4272 100644 --- a/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm +++ b/code/modules/mob/living/basic/space_fauna/eyeball/_eyeball.dm @@ -96,16 +96,16 @@ /mob/living/basic/eyeball/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(!ishuman(target)) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/mob/living/carbon/human_target = target var/obj/item/organ/eyes/eyes = human_target.get_organ_slot(ORGAN_SLOT_EYES) if(isnull(eyes) || eyes.damage < 10) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN heal_eye_damage(human_target, eyes) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/eyeball/proc/heal_eye_damage(mob/living/target, obj/item/organ/eyes/eyes) if(!COOLDOWN_FINISHED(src, eye_healing)) diff --git a/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm b/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm index 925b5eb271e..7b5edab617a 100644 --- a/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm +++ b/code/modules/mob/living/basic/space_fauna/hivebot/_hivebot.dm @@ -99,16 +99,16 @@ /mob/living/basic/hivebot/mechanic/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(ismachinery(target)) repair_machine(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(istype(target, /mob/living/basic/hivebot)) repair_hivebot(target) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /mob/living/basic/hivebot/mechanic/proc/repair_machine(obj/machinery/fixable) if(fixable.get_integrity() >= fixable.max_integrity) diff --git a/code/modules/mob/living/basic/space_fauna/morph.dm b/code/modules/mob/living/basic/space_fauna/morph.dm index 3190f3313e9..a76704e40fe 100644 --- a/code/modules/mob/living/basic/space_fauna/morph.dm +++ b/code/modules/mob/living/basic/space_fauna/morph.dm @@ -149,29 +149,29 @@ /// Handles the logic for attacking anything. /mob/living/basic/morph/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(HAS_TRAIT(src, TRAIT_DISGUISED) && (melee_damage_disguised <= 0)) balloon_alert(src, "can't attack while disguised!") - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(isliving(target)) //Eat Corpses to regen health var/mob/living/living_target = target if(living_target.stat != DEAD) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN eat(eatable = living_target, delay = 3 SECONDS, update_health = -50) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(!isitem(target)) //Eat items just to be annoying - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN var/obj/item/item_target = target if(item_target.anchored) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN eat(eatable = item_target, delay = 2 SECONDS) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /// Eat stuff. Delicious. Return TRUE if we ate something, FALSE otherwise. /// Required: `eatable` is the thing (item or mob) that we are going to eat. diff --git a/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm b/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm index 42e6e831dd5..f0e370c668e 100644 --- a/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm +++ b/code/modules/mob/living/basic/space_fauna/regal_rat/regal_rat.dm @@ -171,22 +171,22 @@ /// Checks if we are able to attack this object, as well as send out the signal to see if we get any special regal rat interactions. /mob/living/basic/regal_rat/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(DOING_INTERACTION(src, REGALRAT_INTERACTION) || !allowed_to_attack(target)) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN if(SEND_SIGNAL(target, COMSIG_RAT_INTERACT, src) & COMPONENT_RAT_INTERACTED) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(isnull(mind) || combat_mode) - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN if(poison_target(target)) - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN - return TRUE + return BASIC_MOB_CONTINUE_ATTACK_CHAIN /// Checks if we are allowed to attack this mob. Will return TRUE if we are potentially allowed to attack, but if we end up in a case where we should NOT attack, return FALSE. /mob/living/basic/regal_rat/proc/allowed_to_attack(atom/the_target) diff --git a/code/modules/mob/living/basic/space_fauna/supermatter_spider.dm b/code/modules/mob/living/basic/space_fauna/supermatter_spider.dm index 02f11dc9426..44d7585faff 100644 --- a/code/modules/mob/living/basic/space_fauna/supermatter_spider.dm +++ b/code/modules/mob/living/basic/space_fauna/supermatter_spider.dm @@ -49,8 +49,8 @@ /// Proc that we call on attacking something to dust 'em. /mob/living/basic/supermatter_spider/early_melee_attack(atom/target, list/modifiers, ignore_cooldown) . = ..() - if(!.) - return FALSE + if(.) + return if(isliving(target)) var/mob/living/victim = target @@ -59,14 +59,14 @@ victim.dust() if(single_use) death() - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN if(!isturf(target)) dust_feedback(target) qdel(target) if(single_use) death() - return FALSE + return BASIC_MOB_END_ATTACK_CHAIN_COOLDOWN /// Simple proc that plays the supermatter dusting sound and sends a visible message. /mob/living/basic/supermatter_spider/proc/dust_feedback(atom/target)