Files
Bubberstation/code/datums/components/punchcooldown.dm
MrMelbert 9664d24c13 Refactors UnarmedAttack so we don't have like 4 Unarmed Attack signals, kills two more snowflake species procs (#78991)
## 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>
2023-10-15 22:25:19 -06:00

34 lines
1.4 KiB
Plaintext

///Your favourite Jojoke. Used for the gloves of the north star.
/datum/component/wearertargeting/punchcooldown
signals = list(COMSIG_LIVING_UNARMED_ATTACK, COMSIG_LIVING_SLAP_MOB)
mobtype = /mob/living/carbon
proctype = PROC_REF(reducecooldown)
valid_slots = list(ITEM_SLOT_GLOVES)
///The warcry this generates
var/warcry = "AT"
/datum/component/wearertargeting/punchcooldown/Initialize()
. = ..()
if(. == COMPONENT_INCOMPATIBLE)
return
RegisterSignal(parent, COMSIG_ITEM_ATTACK_SELF, PROC_REF(changewarcry))
///Called on COMSIG_LIVING_UNARMED_ATTACK. Yells the warcry and and reduces punch cooldown.
/datum/component/wearertargeting/punchcooldown/proc/reducecooldown(mob/living/carbon/M, atom/target)
if((M.combat_mode && isliving(target)) || istype(M.get_active_held_item(), /obj/item/hand_item/slapper))
M.changeNext_move(CLICK_CD_RAPID)
if(warcry)
M.say(warcry, ignore_spam = TRUE, forced = "north star warcry")
///Called on COMSIG_ITEM_ATTACK_SELF. Allows you to change the warcry.
/datum/component/wearertargeting/punchcooldown/proc/changewarcry(datum/source, mob/user)
SIGNAL_HANDLER
INVOKE_ASYNC(src, PROC_REF(do_changewarcry), user)
/datum/component/wearertargeting/punchcooldown/proc/do_changewarcry(mob/user)
var/input = tgui_input_text(user, "What do you want your battlecry to be?", "Battle Cry", max_length = 6)
if(!QDELETED(src) && !QDELETED(user) && !user.Adjacent(parent))
return
if(input)
warcry = input