Files
Bubberstation/code/datums/elements/haunted.dm
SkyratBot d46cde8eae [MIRROR] Adds the Hauntium material, which turns any item into a ghost (with AI) (#2918)
* Adds the Hauntium material, which turns any item into a ghost (with AI) (#55728)

* Adds the Hauntium material, which turns any item into a ghost (with AI)

Co-authored-by: Qustinnus <Floydje123@hotmail.com>
2021-01-28 03:06:55 +01:00

26 lines
891 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)
. = ..()
if(!isitem(target))
return COMPONENT_INCOMPATIBLE
//Make em look spooky
var/obj/item/master = target
master.add_filter("haunt_glow", 2, list("type" = "outline", "color" = "#f8f8ff", "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)
/datum/element/haunted/Detach(datum/source, force)
. = ..()
var/atom/movable/master = source
master.remove_filter("haunt_glow")
QDEL_NULL(master.ai_controller)
REMOVE_TRAIT(master, TRAIT_MOVE_FLYING, ELEMENT_TRAIT)
master.RemoveElement(/datum/element/movetype_handler)
return ..()