Files
Bubberstation/code/datums/components/punchcooldown.dm
SSensum13 4722bf017e Some ITEM_SLOT bitflags fixes. (#92441)
## About The Pull Request

This PR fixes wrong usage of bitflags in a few places, where instead of
bitfields lists were used.

## Why It's Good For The Game

It will help prevent problems that can be a thing in the future,
improving consistency of the codebase.
2025-08-11 13:20:50 -05:00

35 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_HAND_ITEM_ATTACK)
mobtype = /mob/living/carbon
proctype = PROC_REF(reducecooldown)
valid_slots = 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)
var/obj/item/used_item = M.get_active_held_item()
if((M.combat_mode && isliving(target)) || (used_item & HAND_ITEM))
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