diff --git a/hyperstation/code/datums/elements/spooky.dm b/hyperstation/code/datums/elements/spooky.dm new file mode 100644 index 000000000..793f0f555 --- /dev/null +++ b/hyperstation/code/datums/elements/spooky.dm @@ -0,0 +1,38 @@ +//A spooky element, this can be added to pretty much anything, take your pick. It is effectively harmless however. +//target.AddElement(/datum/element/spooky) for example. + +/datum/element/spooky + element_flags = ELEMENT_DETACH + var/datum/C + +/datum/element/spooky/Attach(datum/target) + . = ..() + /* + if(!iscarbon(target)) + return ELEMENT_INCOMPATIBLE //keeping this uncommented would make it so it only works with carbons, which is not really needed unless one adds procs that require the user to be a carbon in the future. + */ + C = target + START_PROCESSING(SSobj, src) + +/datum/element/spooky/Detach(datum/source, force) + . = ..() + STOP_PROCESSING(SSobj, src) + +/datum/element/spooky/process() + var/spookythings = rand(120) + switch(spookythings) + if(119 to 120) //Plays a spooky ambient sound as long as one hasn't been played in a while. + var/sound = pick(SPOOKY) + for(var/mob/living/carbon/L in view(6, C)) + if(L.client && !L.client.played) + SEND_SOUND(L, sound(sound, repeat = 0, wait = 0, volume = 35, channel = CHANNEL_AMBIENCE)) + L.client.played = TRUE + addtimer(CALLBACK(L.client, /client/proc/ResetAmbiencePlayed), 600) + if(65 to 70) //Lights flicker. + var/obj/machinery/light/L = locate(/obj/machinery/light) in view(4, C) + if(L) + L.flicker() + if(1 to 5) //Very small chance to cause an unburnt tile to change to its burnt sprite. + var/turf/open/floor/T = locate(/turf/open/floor) in view(4, C) + if(T && prob(5) && !isplatingturf(T) && !istype(T, /turf/open/floor/engine/cult) && !T.burnt) + T.burn_tile() diff --git a/tgstation.dme b/tgstation.dme index 9ed36015b..3a965943c 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -3097,6 +3097,7 @@ #include "hyperstation\code\datums\components\crafting\bounties.dm" #include "hyperstation\code\datums\components\crafting\recipes.dm" #include "hyperstation\code\datums\elements\holder_micro.dm" +#include "hyperstation\code\datums\elements\spooky.dm" #include "hyperstation\code\datums\mood_events\events.dm" #include "hyperstation\code\datums\ruins\lavaland.dm" #include "hyperstation\code\datums\traits\good.dm"