Files
Bubberstation/code/datums/elements/honkspam.dm
SkyratBot d79a997673 [MIRROR] Traits given by Elements now have element trait as their source. [MDB IGNORE] (#9110)
* Traits given by Elements now have element trait as their source. (#62134)

Hopefully the code is more organized and consistent this way.

* Traits given by Elements now have element trait as their source.

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
2021-10-28 18:23:44 -04:00

22 lines
784 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(type))
playsound(source.loc, 'sound/items/bikehorn.ogg', 50, TRUE)
addtimer(TRAIT_CALLBACK_REMOVE(source, TRAIT_HONKSPAMMING, ELEMENT_TRAIT(type)), 2 SECONDS)