#define ICON_SIZE 32 // Draws a box showing the limits of movement while scanning something. // Only the client supplied will see the box. /obj/item/device/cataloguer/proc/draw_box(atom/A, box_size, client/C) . = list() // Things moved with pixel_[x|y] will move the box, so this is to correct that. var/pixel_x_correction = -A.pixel_x var/pixel_y_correction = -A.pixel_y // First, place the bottom-left corner. . += draw_line(A, SOUTHWEST, (-box_size * ICON_SIZE) + pixel_x_correction, (-box_size * ICON_SIZE) + pixel_y_correction, C) // Make a line on the bottom, going right. for(var/i = 1 to (box_size * 2) - 1) var/x_displacement = (-box_size * ICON_SIZE) + (ICON_SIZE * i) + pixel_x_correction var/y_displacement = (-box_size * ICON_SIZE) + pixel_y_correction . += draw_line(A, SOUTH, x_displacement, y_displacement, C) // Bottom-right corner. . += draw_line(A, SOUTHEAST, (box_size * ICON_SIZE) + pixel_x_correction, (-box_size * ICON_SIZE) + pixel_y_correction, C) // Second line, for the right side going up. for(var/i = 1 to (box_size * 2) - 1) var/x_displacement = (box_size * ICON_SIZE) + pixel_x_correction var/y_displacement = (-box_size * ICON_SIZE) + (ICON_SIZE * i) + pixel_y_correction . += draw_line(A, EAST, x_displacement, y_displacement, C) // Top-right corner. . += draw_line(A, NORTHEAST, (box_size * ICON_SIZE) + pixel_x_correction, (box_size * ICON_SIZE) + pixel_y_correction, C) // Third line, for the top, going right. for(var/i = 1 to (box_size * 2) - 1) var/x_displacement = (-box_size * ICON_SIZE) + (ICON_SIZE * i) + pixel_x_correction var/y_displacement = (box_size * ICON_SIZE) + pixel_y_correction . += draw_line(A, NORTH, x_displacement, y_displacement, C) // Top-left corner. . += draw_line(A, NORTHWEST, (-box_size * ICON_SIZE) + pixel_x_correction, (box_size * ICON_SIZE) + pixel_y_correction, C) // Fourth and last line, for the left side going up. for(var/i = 1 to (box_size * 2) - 1) var/x_displacement = (-box_size * ICON_SIZE) + pixel_x_correction var/y_displacement = (-box_size * ICON_SIZE) + (ICON_SIZE * i) + pixel_y_correction . += draw_line(A, WEST, x_displacement, y_displacement, C) #undef ICON_SIZE // Draws an individual segment of the box. /obj/item/device/cataloguer/proc/draw_line(atom/A, line_dir, line_pixel_x, line_pixel_y, client/C) var/image/line = image(icon = 'icons/effects/effects.dmi', loc = A, icon_state = "stripes", dir = line_dir) line.pixel_x = line_pixel_x line.pixel_y = line_pixel_y line.plane = PLANE_FULLSCREEN // It's technically a HUD element but it doesn't need to show above item slots. line.appearance_flags = RESET_TRANSFORM|RESET_COLOR|RESET_ALPHA|NO_CLIENT_COLOR|TILE_BOUND line.alpha = 125 C.images += line return line // Removes the box that was generated before from the client. /obj/item/device/cataloguer/proc/delete_box(list/box_segments, client/C) for(var/i in box_segments) C.images -= i qdel(i) /obj/item/device/cataloguer/proc/color_box(list/box_segments, new_color, new_time) for(var/i in box_segments) animate(i, color = new_color, time = new_time)