Files
Bubberstation/code/datums/elements/cult_halo.dm
T
YesterdaysPromiseandGitHub 8eb3b51ad9 /icons/ folder cleansing crusade part 3 (#83420)
## About The Pull Request

In my effort to make the /icons/ folder cleaner and more intuitive
instead of having to rely on recalling names of stuff and looking them
up in code to find them for poor sods such as myself, plus in spurt of
complusion to organize stuff, here goes. I've tracked all changes in
commit descriptions. A lot still to be done, but I know these waves go
over dozens of files making things slow, so went lighter on it.
Destroyed useless impostor files taking up space and cleaned a stray
pixel on my way.

## Why It's Good For The Game

Cleaner /icons/ file means saner spriters, less time spent. Stray pixels
and impostor files (ones which are copies of actually used ones
elsewhere) are not good.

## Changelog

🆑
image: Cleaned a single stray pixel in a single frame of a bite
telegraphing accidentaly found while re-organizing the files.
/🆑
2024-05-25 21:08:08 -07:00

54 lines
1.7 KiB
Plaintext

/**
* # Cult halo element
*
* Applies and removes the cult halo
*/
/datum/element/cult_halo
/datum/element/cult_halo/Attach(datum/target, initial_delay = 20 SECONDS)
. = ..()
if (!isliving(target))
return ELEMENT_INCOMPATIBLE
// Register signals for mob transformation to prevent premature halo removal
RegisterSignals(target, list(COMSIG_CHANGELING_TRANSFORM, COMSIG_MONKEY_HUMANIZE, COMSIG_HUMAN_MONKEYIZE), PROC_REF(set_halo))
addtimer(CALLBACK(src, PROC_REF(set_halo), target), initial_delay)
/**
* Halo setter proc
*
* Adds the cult halo overlays, and adds the halo trait to the mob.
*/
/datum/element/cult_halo/proc/set_halo(mob/living/target)
SIGNAL_HANDLER
if(!IS_CULTIST(target))
target.RemoveElement(/datum/element/cult_halo)
return
ADD_TRAIT(target, TRAIT_CULT_HALO, CULT_TRAIT)
var/mutable_appearance/new_halo_overlay = mutable_appearance('icons/mob/effects/halo.dmi', "halo[rand(1, 6)]", -HALO_LAYER)
if (ishuman(target))
var/mob/living/carbon/human/human_parent = target
new /obj/effect/temp_visual/cult/sparks(get_turf(human_parent), human_parent.dir)
human_parent.overlays_standing[HALO_LAYER] = new_halo_overlay
human_parent.apply_overlay(HALO_LAYER)
else
target.add_overlay(new_halo_overlay)
/**
* Detach proc
*
* Removes the halo overlays, and trait from the mob
*/
/datum/element/cult_halo/Detach(mob/living/target, ...)
REMOVE_TRAIT(target, TRAIT_CULT_HALO, CULT_TRAIT)
if (ishuman(target))
var/mob/living/carbon/human/human_parent = target
human_parent.remove_overlay(HALO_LAYER)
human_parent.update_body()
else
target.cut_overlay(HALO_LAYER)
UnregisterSignal(target, list(COMSIG_CHANGELING_TRANSFORM, COMSIG_HUMAN_MONKEYIZE, COMSIG_MONKEY_HUMANIZE))
return ..()