mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-11 10:11:09 +00:00
Done using this command sed -Ei 's/(\s*\S+)\s*\t+/\1 /g' code/**/*.dm We have countless examples in the codebase with this style gone wrong, and defines and such being on hideously different levels of indentation. Fixing this to keep the alignment involves tainting the blames of code your PR doesn't need to be touching at all. And ultimately, it's hideous. There are some files that this sed makes uglier. I can fix these when they are pointed out, but I believe this is ultimately for the greater good of readability. I'm more concerned with if any strings relied on this. Hi codeowners! Co-authored-by: Jared-Fogle <35135081+Jared-Fogle@users.noreply.github.com>
62 lines
2.0 KiB
Plaintext
62 lines
2.0 KiB
Plaintext
///Add to an object if you want to be able to be hidden under tiles
|
|
/datum/element/undertile
|
|
element_flags = ELEMENT_BESPOKE | COMPONENT_DUPE_HIGHLANDER
|
|
id_arg_index = 2
|
|
|
|
///the invisiblity trait applied, like TRAIT_T_RAY_VISIBLE
|
|
var/invisibility_trait
|
|
///level of invisibility applied when under a tile. Could be INVISIBILITY_OBSERVER if you still want it to be visible to ghosts
|
|
var/invisibility_level
|
|
///an overlay for the tile if we wish to apply that
|
|
var/tile_overlay
|
|
///whether we use alpha or not. TRUE uses ALPHA_UNDERTILE because otherwise we have 200 different instances of this element for different alphas
|
|
var/use_alpha
|
|
///We will switch between anchored and unanchored. for stuff like satchels that shouldn't be pullable under tiles but are otherwise unanchored
|
|
var/use_anchor
|
|
|
|
/datum/element/undertile/Attach(datum/target, invisibility_trait, invisibility_level = INVISIBILITY_MAXIMUM, tile_overlay, use_alpha = TRUE, use_anchor = FALSE)
|
|
. = ..()
|
|
if(!ismovable(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
RegisterSignal(target, COMSIG_OBJ_HIDE, .proc/hide)
|
|
|
|
src.invisibility_trait = invisibility_trait
|
|
src.invisibility_level = invisibility_level
|
|
src.tile_overlay = tile_overlay
|
|
src.use_alpha = use_alpha
|
|
src.use_anchor = use_anchor
|
|
|
|
///called when a tile has been covered or uncovered
|
|
/datum/element/undertile/proc/hide(atom/movable/source, covered)
|
|
SIGNAL_HANDLER
|
|
|
|
source.invisibility = covered ? invisibility_level : 0
|
|
|
|
var/turf/T = get_turf(source)
|
|
|
|
if(covered)
|
|
if(invisibility_trait)
|
|
ADD_TRAIT(source, invisibility_trait, TRAIT_GENERIC)
|
|
if(tile_overlay)
|
|
T.add_overlay(tile_overlay)
|
|
if(use_alpha)
|
|
source.alpha = ALPHA_UNDERTILE
|
|
if(use_anchor)
|
|
source.set_anchored(TRUE)
|
|
|
|
else
|
|
if(invisibility_trait)
|
|
REMOVE_TRAIT(source, invisibility_trait, TRAIT_GENERIC)
|
|
if(tile_overlay)
|
|
T.overlays -= tile_overlay
|
|
if(use_alpha)
|
|
source.alpha = 255
|
|
if(use_anchor)
|
|
source.set_anchored(FALSE)
|
|
|
|
/datum/element/undertile/Detach(atom/movable/AM, visibility_trait, invisibility_level = INVISIBILITY_MAXIMUM)
|
|
. = ..()
|
|
|
|
hide(AM, FALSE)
|