mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-03 13:32:17 +00:00
22 lines
772 B
Plaintext
22 lines
772 B
Plaintext
/// Attachable to items. Plays a bikehorn sound whenever attack_self is called (with a cooldown).
|
|
/datum/element/honkspam
|
|
element_flags = ELEMENT_DETACH
|
|
|
|
/datum/element/honkspam/Attach(datum/target)
|
|
. = ..()
|
|
if(!isitem(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
RegisterSignal(target, COMSIG_ITEM_ATTACK_SELF, .proc/interact)
|
|
|
|
/datum/element/honkspam/Detach(datum/source)
|
|
UnregisterSignal(source, COMSIG_ITEM_ATTACK_SELF)
|
|
return ..()
|
|
|
|
/datum/element/honkspam/proc/interact(obj/item/source, mob/user)
|
|
SIGNAL_HANDLER
|
|
if(HAS_TRAIT(source, TRAIT_HONKSPAMMING))
|
|
return
|
|
ADD_TRAIT(source, TRAIT_HONKSPAMMING, ELEMENT_TRAIT)
|
|
playsound(source.loc, 'sound/items/bikehorn.ogg', 50, TRUE)
|
|
addtimer(TRAIT_CALLBACK_REMOVE(source, TRAIT_HONKSPAMMING, ELEMENT_TRAIT), 2 SECONDS)
|