mirror of
https://github.com/SPLURT-Station/S.P.L.U.R.T-Station-13.git
synced 2025-12-10 18:02:57 +00:00
44 lines
1.5 KiB
Plaintext
44 lines
1.5 KiB
Plaintext
/datum/component/mirage_border
|
|
can_transfer = TRUE
|
|
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 || !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/PreTransfer()
|
|
holder.moveToNullspace()
|
|
|
|
/datum/component/mirage_border/PostTransfer()
|
|
if(!isturf(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
holder.forceMove(parent)
|
|
|
|
/obj/effect/abstract/mirage_holder
|
|
name = "Mirage holder"
|
|
anchored = TRUE
|
|
plane = PLANE_SPACE
|
|
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
|