Files
Bubberstation/code/datums/elements/ELEMENT_TEMPLATE.md
Jeremiah 9db2f6916b Sets prettier to run on the repo (#91379)
## About The Pull Request
Prettier (an auto formatter) is set to only run within the tgui folder
currently. This removes that limitation, allowing it to automatically
format all supported files in the repo (.js, .html, .yml
[etc](https://prettier.io/docs/))

I made a few exceptions for bundled and generated files
## Why It's Good For The Game
I'm of the opinion that code should look uniform and am lazy enough to
want CTRL-S to format files without having to think beyond that
## Changelog
2025-05-29 21:23:59 -07:00

25 lines
825 B
Markdown

# Template file for your new element
See \_element.dm for detailed explanations
```dm
/datum/element/myelement
element_flags = ELEMENT_BESPOKE | ELEMENT_COMPLEX_DETACH | ELEMENT_DETACH_ON_HOST_DESTROY | ELEMENT_NOTAREALFLAG // code/__DEFINES/dcs/flags.dm
//argument_hash_start_idx = 2 // Use with ELEMENT_BESPOKE
var/list/myvar = list()
/datum/element/myelement/Attach(datum/target)
if(!ismovable(target))
return COMPONENT_INCOMPATIBLE
RegisterSignal(target, COMSIG_MOVABLE_MOVED, myproc)
to_chat(target, "Hey, you're in your element.")
/datum/element/myelement/Detach(datum/source)
UnregisterSignal(source, COMSIG_MOVABLE_MOVED)
to_chat(source, "You feel way out of your element.")
/datum/element/myelement/proc/myproc(datum/source)
SIGNAL_HANDLER
playsound(source, 'sound/effects/gong.ogg', 50, TRUE)
```