mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-14 19:51:59 +00:00
## About The Pull Request - Deletes `spec_unarmedattack` - Deletes `spec_unarmedattacked` - Replaces `COMSIG_HUMAN_EARLY_UNARMED_ATTACK` with `COMSIG_LIVING_EARLY_UNARMED_ATTACK` - Replaces uses of `COMSIG_HUMAN_MELEE_UNARMED_ATTACK` with `COMSIG_LIVING_EARLY_UNARMED_ATTACK` - Fixes(?)(I've never seen this work) / Elementizes Monkey ability to bite while handcuffed - Monkey clever `attack paw` / `attack hand` thing is now handled the same on the human level (via `resolve_unarmed_attack`) ## Why It's Good For The Game Atomized from swing branch. I was really annoyed with these two signals, this kinda unifies the behavior between living and human mobs (they were already quite similar). One thing of note is that this will make dis-coordinated humans use `attack_paw` rather than `attack_hand`, so they'll bite people instead of punching them. I'm not sure if this is what we want, if we wanna tweak that before then I can by all means. ## Changelog 🆑 Melbert refactor: Refactored unarmed attacking mechanisms, this means dis-coordinated humans will now bite people like monkeys (like how coordinated monkeys punch people like humans?) refactor: Dis-coordinated humans smashing up machines now use their hands, rather than their paws /🆑 --------- Co-authored-by: san7890 <the@san7890.com>
29 lines
1006 B
Plaintext
29 lines
1006 B
Plaintext
/// Allows carbons with heads to attempt to bite mobs if attacking with cuffed hands / missing arms
|
|
/datum/element/human_biter
|
|
|
|
/datum/element/human_biter/Attach(datum/target)
|
|
. = ..()
|
|
if(!iscarbon(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignal(target, COMSIG_LIVING_EARLY_UNARMED_ATTACK, PROC_REF(try_bite))
|
|
|
|
/datum/element/human_biter/Detach(datum/source, ...)
|
|
. = ..()
|
|
UnregisterSignal(source, COMSIG_LIVING_EARLY_UNARMED_ATTACK)
|
|
|
|
/datum/element/human_biter/proc/try_bite(mob/living/carbon/human/source, atom/target, proximity_flag, modifiers)
|
|
SIGNAL_HANDLER
|
|
|
|
if(!proximity_flag || !source.combat_mode || LAZYACCESS(modifiers, RIGHT_CLICK) || !isliving(target))
|
|
return NONE
|
|
|
|
// If we can attack like normal, just go ahead and do that
|
|
if(source.can_unarmed_attack())
|
|
return NONE
|
|
|
|
if(target.attack_paw(source, modifiers))
|
|
return COMPONENT_CANCEL_ATTACK_CHAIN // bite successful!
|
|
|
|
return COMPONENT_SKIP_ATTACK // we will fail anyways if we try to attack normally, so skip the rest
|