Files
Bubberstation/code/datums/elements/haunted.dm
SkyratBot 105bf2d87d [MIRROR] Adds a new revenant spell, Haunt Object, which imbues nearby objects with ghostly energy [MDB IGNORE] (#16012)
* Adds a new revenant spell, Haunt Object, which imbues nearby objects with ghostly energy

* Fixes the merge conflict

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2022-09-08 17:46:25 +00:00

28 lines
1015 B
Plaintext

///Attaching this element to something will make it float, get a special ai controller, and gives it a spooky outline.
/datum/element/haunted
element_flags = ELEMENT_DETACH
/datum/element/haunted/Attach(datum/target, haunt_color = "#f8f8ff")
. = ..()
if(!isitem(target))
return ELEMENT_INCOMPATIBLE
var/obj/item/master = target
if(istype(master.ai_controller, /datum/ai_controller/haunted))
return ELEMENT_INCOMPATIBLE
//Make em look spooky
master.add_filter("haunt_glow", 2, list("type" = "outline", "color" = haunt_color, "size" = 1))
master.ai_controller = new /datum/ai_controller/haunted(master)
master.AddElement(/datum/element/movetype_handler)
ADD_TRAIT(master, TRAIT_MOVE_FLYING, ELEMENT_TRAIT(type))
/datum/element/haunted/Detach(datum/source)
. = ..()
var/atom/movable/master = source
master.remove_filter("haunt_glow")
QDEL_NULL(master.ai_controller)
REMOVE_TRAIT(master, TRAIT_MOVE_FLYING, ELEMENT_TRAIT(type))
master.RemoveElement(/datum/element/movetype_handler)
return ..()