mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-26 14:39:58 +01:00
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 🆑 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. /🆑
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user