diff --git a/code/datums/components/spooky.dm b/code/datums/elements/spooky.dm similarity index 79% rename from code/datums/components/spooky.dm rename to code/datums/elements/spooky.dm index b53aae93acd..5162dd3f2d0 100644 --- a/code/datums/components/spooky.dm +++ b/code/datums/elements/spooky.dm @@ -1,10 +1,20 @@ -/datum/component/spooky +/datum/element/spooky + element_flags = ELEMENT_DETACH|ELEMENT_BESPOKE + id_arg_index = 2 var/too_spooky = TRUE //will it spawn a new instrument? -/datum/component/spooky/Initialize() - RegisterSignal(parent, COMSIG_ITEM_ATTACK, .proc/spectral_attack) +/datum/element/spooky/Attach(datum/target, too_spooky = TRUE) + . = ..() + if(!isitem(target)) + return ELEMENT_INCOMPATIBLE + src.too_spooky = too_spooky + RegisterSignal(target, COMSIG_ITEM_ATTACK, .proc/spectral_attack) -/datum/component/spooky/proc/spectral_attack(datum/source, mob/living/carbon/C, mob/user) +/datum/element/spooky/Detach(datum/source) + UnregisterSignal(source, COMSIG_ITEM_ATTACK) + return ..() + +/datum/element/spooky/proc/spectral_attack(datum/source, mob/living/carbon/C, mob/user) SIGNAL_HANDLER if(ishuman(user)) //this weapon wasn't meant for mortals. @@ -36,7 +46,7 @@ C.Jitter(15) C.stuttering = 20 -/datum/component/spooky/proc/spectral_change(mob/living/carbon/human/H, mob/user) +/datum/element/spooky/proc/spectral_change(mob/living/carbon/human/H, mob/user) if((H.getStaminaLoss() > 95) && (!istype(H.dna.species, /datum/species/skeleton)) && (!istype(H.dna.species, /datum/species/golem)) && (!istype(H.dna.species, /datum/species/android)) && (!istype(H.dna.species, /datum/species/jelly))) H.Paralyze(20) H.set_species(/datum/species/skeleton) @@ -55,7 +65,7 @@ to_chat(H, span_boldnotice("A new life and identity has begun. Help your fellow skeletons into bringing out the spooky-pocalypse. You haven't forgotten your past life, and are still beholden to past loyalties.")) change_name(H) //time for a new name! -/datum/component/spooky/proc/change_name(mob/living/carbon/human/H) +/datum/element/spooky/proc/change_name(mob/living/carbon/human/H) var/t = sanitize_name(stripped_input(H, "Enter your new skeleton name", H.real_name, null, MAX_NAME_LEN)) if(!t) t = "spooky skeleton" diff --git a/code/modules/instruments/items.dm b/code/modules/instruments/items.dm index cc0a34447e0..e9ed23ffda9 100644 --- a/code/modules/instruments/items.dm +++ b/code/modules/instruments/items.dm @@ -181,7 +181,7 @@ /obj/item/instrument/trumpet/spectral/Initialize() . = ..() - AddComponent(/datum/component/spooky) + AddElement(/datum/element/spooky) /obj/item/instrument/trumpet/spectral/attack(mob/living/carbon/C, mob/user) playsound (src, 'sound/runtime/instruments/trombone/En4.mid', 100,1,-1) @@ -205,7 +205,7 @@ /obj/item/instrument/saxophone/spectral/Initialize() . = ..() - AddComponent(/datum/component/spooky) + AddElement(/datum/element/spooky) /obj/item/instrument/saxophone/spectral/attack(mob/living/carbon/C, mob/user) playsound (src, 'sound/runtime/instruments/saxophone/En4.mid', 100,1,-1) @@ -229,7 +229,7 @@ /obj/item/instrument/trombone/spectral/Initialize() . = ..() - AddComponent(/datum/component/spooky) + AddElement(/datum/element/spooky) /obj/item/instrument/trombone/spectral/attack(mob/living/carbon/C, mob/user) playsound (src, 'sound/runtime/instruments/trombone/Cn4.mid', 100,1,-1) diff --git a/tgstation.dme b/tgstation.dme index dc5e30a2dad..7bf7031c62d 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -574,7 +574,6 @@ #include "code\datums\components\spawner.dm" #include "code\datums\components\spill.dm" #include "code\datums\components\spinny.dm" -#include "code\datums\components\spooky.dm" #include "code\datums\components\squeak.dm" #include "code\datums\components\stationloving.dm" #include "code\datums\components\stationstuck.dm" @@ -738,6 +737,7 @@ #include "code\datums\elements\simple_flying.dm" #include "code\datums\elements\skittish.dm" #include "code\datums\elements\snail_crawl.dm" +#include "code\datums\elements\spooky.dm" #include "code\datums\elements\squashable.dm" #include "code\datums\elements\squish.dm" #include "code\datums\elements\strippable.dm"