Files
GS13NG/code/datums/components/mirage_border.dm
Jordan Brown 5994a9fd0b Merge pull request #37342 from ninjanomnom/vis-border
Makes it possible to see tiles past z transitions
2018-04-26 15:25:36 -05:00

38 lines
1.4 KiB
Plaintext

/datum/component/mirage_border
var/obj/effect/abstract/mirage_holder/holder
/datum/component/mirage_border/Initialize(turf/target, direction, range=world.view)
if(!isturf(parent))
return COMPONENT_INCOMPATIBLE
if(!target || !istype(target) || !direction)
. = COMPONENT_INCOMPATIBLE
CRASH("[type] improperly instanced with the following args: target=\[[target]\], direction=\[[direction]\], range=\[[range]\]")
holder = new(parent)
var/x = target.x
var/y = target.y
var/z = target.z
var/turf/southwest = locate(CLAMP(x - (direction & WEST ? range : 0), 1, world.maxx), CLAMP(y - (direction & SOUTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
var/turf/northeast = locate(CLAMP(x + (direction & EAST ? range : 0), 1, world.maxx), CLAMP(y + (direction & NORTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
//holder.vis_contents += block(southwest, northeast) // This doesnt work because of beta bug memes
for(var/i in block(southwest, northeast))
holder.vis_contents += i
if(direction & SOUTH)
holder.pixel_y -= world.icon_size * range
if(direction & WEST)
holder.pixel_x -= world.icon_size * range
/datum/component/mirage_border/Destroy()
QDEL_NULL(holder)
return ..()
/datum/component/mirage_border/OnTransfer(atom/thing)
if(!isturf(thing))
return COMPONENT_INCOMPATIBLE
holder.forceMove(thing)
/obj/effect/abstract/mirage_holder
name = "Mirage holder"
mouse_opacity = MOUSE_OPACITY_TRANSPARENT