/
cult_eyes.dm
53 lines (47 loc) · 1.81 KB
/
cult_eyes.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* # Cult eyes element
*
* Applies and removes the glowing cult eyes
*/
/datum/element/cult_eyes
/datum/element/cult_eyes/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_eyes))
addtimer(CALLBACK(src, PROC_REF(set_eyes), target), initial_delay)
/**
* Cult eye setter proc
*
* Changes the eye color, and adds the glowing eye trait to the mob.
*/
/datum/element/cult_eyes/proc/set_eyes(mob/living/target)
SIGNAL_HANDLER
if(!IS_CULTIST(target))
target.RemoveElement(/datum/element/cult_eyes)
return
ADD_TRAIT(target, TRAIT_UNNATURAL_RED_GLOWY_EYES, CULT_TRAIT)
if (ishuman(target))
var/mob/living/carbon/human/human_parent = target
human_parent.eye_color_left = BLOODCULT_EYE
human_parent.eye_color_right = BLOODCULT_EYE
human_parent.dna.update_ui_block(DNA_EYE_COLOR_LEFT_BLOCK)
human_parent.dna.update_ui_block(DNA_EYE_COLOR_RIGHT_BLOCK)
human_parent.update_body()
/**
* Detach proc
*
* Removes the eye color, and trait from the mob
*/
/datum/element/cult_eyes/Detach(mob/living/target, ...)
REMOVE_TRAIT(target, TRAIT_UNNATURAL_RED_GLOWY_EYES, CULT_TRAIT)
if (ishuman(target))
var/mob/living/carbon/human/human_parent = target
human_parent.eye_color_left = initial(human_parent.eye_color_left)
human_parent.eye_color_right = initial(human_parent.eye_color_right)
human_parent.dna.update_ui_block(DNA_EYE_COLOR_LEFT_BLOCK)
human_parent.dna.update_ui_block(DNA_EYE_COLOR_RIGHT_BLOCK)
human_parent.update_body()
UnregisterSignal(target, list(COMSIG_CHANGELING_TRANSFORM, COMSIG_HUMAN_MONKEYIZE, COMSIG_MONKEY_HUMANIZE))
return ..()