diff --git a/code/__DEFINES/turfs.dm b/code/__DEFINES/turfs.dm index 73a36c5b2aa..14911e1ddbd 100644 --- a/code/__DEFINES/turfs.dm +++ b/code/__DEFINES/turfs.dm @@ -10,9 +10,12 @@ //supposedly the fastest way to do this according to https://gist.github.com/Giacom/be635398926bb463b42a ///Returns a list of turf in a square #define RANGE_TURFS(RADIUS, CENTER) \ + RECT_TURFS(RADIUS, RADIUS, CENTER) + +#define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \ block( \ - locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \ - locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \ + locate(max(CENTER.x-(H_RADIUS),1), max(CENTER.y-(V_RADIUS),1), CENTER.z), \ + locate(min(CENTER.x+(H_RADIUS),world.maxx), min(CENTER.y+(V_RADIUS),world.maxy), CENTER.z) \ ) ///Returns all turfs in a zlevel diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index d827d3ceb9a..43f7a5d6f40 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -115,18 +115,21 @@ attack_self(usr) //this is not the proper way, but neither of the old update procs work! it's too ancient and I'm tired shush. -/obj/item/areaeditor/blueprints/proc/get_images(turf/T, viewsize) +/obj/item/areaeditor/blueprints/proc/get_images(turf/central_turf, viewsize) . = list() - for(var/turf/TT in RANGE_TURFS(viewsize, T)) - if(TT.blueprint_data) - . += TT.blueprint_data + var/list/dimensions = getviewsize(viewsize) + var/horizontal_radius = dimensions[1] / 2 + var/vertical_radius = dimensions[2] / 2 + for(var/turf/nearby_turf as anything in RECT_TURFS(horizontal_radius, vertical_radius, central_turf)) + if(nearby_turf.blueprint_data) + . += nearby_turf.blueprint_data /obj/item/areaeditor/blueprints/proc/set_viewer(mob/user, message = "") if(user?.client) if(viewing) clear_viewer() viewing = user.client - showing = get_images(get_turf(user), viewing.view) + showing = get_images(get_turf(viewing.eye || user), viewing.view) viewing.images |= showing if(message) to_chat(user, message) diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 4f4603a9b81..5ad6115bccf 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -525,6 +525,8 @@ GLOBAL_LIST_EMPTY(station_turfs) /turf/proc/add_blueprints(atom/movable/AM) var/image/I = new + I.plane = GAME_PLANE + I.layer = OBJ_LAYER I.appearance = AM.appearance I.appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM I.loc = src