diff --git a/code/controllers/subsystem/explosions.dm b/code/controllers/subsystem/explosions.dm index 2b61cabb860..36dbba09eae 100644 --- a/code/controllers/subsystem/explosions.dm +++ b/code/controllers/subsystem/explosions.dm @@ -635,23 +635,27 @@ ADMIN_VERB(check_bomb_impacts, R_DEBUG, "Check Bomb Impact", "See what the effec // top left to one before top right if(highest_y <= max_y) candidates += block( - locate(max(lowest_x, 1), highest_y, our_z), - locate(min(highest_x - 1, max_x), highest_y, our_z)) + lowest_x, highest_y, our_z, + highest_x - 1, highest_y, our_z + ) // top right to one before bottom right if(highest_x <= max_x) candidates += block( - locate(highest_x, min(highest_y, max_y), our_z), - locate(highest_x, max(lowest_y + 1, 1), our_z)) + highest_x, highest_y, our_z, + highest_x, lowest_y + 1, our_z + ) // bottom right to one before bottom left if(lowest_y >= 1) candidates += block( - locate(min(highest_x, max_x), lowest_y, our_z), - locate(max(lowest_x + 1, 1), lowest_y, our_z)) + highest_x, lowest_y, our_z, + lowest_x + 1, lowest_y, our_z + ) // bottom left to one before top left if(lowest_x >= 1) candidates += block( - locate(lowest_x, max(lowest_y, 1), our_z), - locate(lowest_x, min(highest_y - 1, max_y), our_z)) + lowest_x, lowest_y, our_z, + lowest_x, highest_y - 1, our_z + ) if(!do_directional) outlist += candidates diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 27bb029be15..b4184f8a34d 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -645,10 +645,11 @@ ADMIN_VERB(load_away_mission, R_FUN, "Load Away Mission", "Load a specific away if(!level_trait(z,ZTRAIT_RESERVED)) clearing_reserved_turfs = FALSE CRASH("Invalid z level prepared for reservations.") - var/turf/A = get_turf(locate(SHUTTLE_TRANSIT_BORDER,SHUTTLE_TRANSIT_BORDER,z)) - var/turf/B = get_turf(locate(world.maxx - SHUTTLE_TRANSIT_BORDER,world.maxy - SHUTTLE_TRANSIT_BORDER,z)) - var/block = block(A, B) - for(var/turf/T as anything in block) + var/list/reserved_block = block( + SHUTTLE_TRANSIT_BORDER, SHUTTLE_TRANSIT_BORDER, z, + world.maxx - SHUTTLE_TRANSIT_BORDER, world.maxy - SHUTTLE_TRANSIT_BORDER, z + ) + for(var/turf/T as anything in reserved_block) // No need to empty() these, because they just got created and are already /turf/open/space/basic. T.turf_flags = UNUSED_RESERVATION_TURF T.blocks_air = TRUE @@ -658,7 +659,7 @@ ADMIN_VERB(load_away_mission, R_FUN, "Load Away Mission", "Load a specific away if(SSatoms.initialized) SSatoms.InitializeAtoms(Z_TURFS(z)) - unused_turfs["[z]"] = block + unused_turfs["[z]"] = reserved_block reservation_ready["[z]"] = TRUE clearing_reserved_turfs = FALSE diff --git a/code/datums/elements/mirage_border.dm b/code/datums/elements/mirage_border.dm index ca7c422dd11..b7af7ee91f6 100644 --- a/code/datums/elements/mirage_border.dm +++ b/code/datums/elements/mirage_border.dm @@ -20,9 +20,10 @@ var/x = target_turf.x var/y = target_turf.y var/z = clamp(target_turf.z, 1, world.maxz) - var/turf/southwest = locate(clamp(x - (direction & WEST ? range : 0), 1, world.maxx), clamp(y - (direction & SOUTH ? range : 0), 1, world.maxy), z) - var/turf/northeast = locate(clamp(x + (direction & EAST ? range : 0), 1, world.maxx), clamp(y + (direction & NORTH ? range : 0), 1, world.maxy), z) - holder.vis_contents += block(southwest, northeast) + holder.vis_contents += block( + x - (direction & WEST ? range : 0), y - (direction & SOUTH ? range : 0), z, + x + (direction & EAST ? range : 0), y + (direction & NORTH ? range : 0), z + ) if(direction & SOUTH) holder.pixel_y -= ICON_SIZE_Y * range if(direction & WEST) diff --git a/code/datums/shuttles/_shuttle.dm b/code/datums/shuttles/_shuttle.dm index 94c20d41b73..52cb31a11fd 100644 --- a/code/datums/shuttles/_shuttle.dm +++ b/code/datums/shuttles/_shuttle.dm @@ -56,8 +56,8 @@ . = ..() if(!.) return - var/list/turfs = block( locate(.[MAP_MINX], .[MAP_MINY], .[MAP_MINZ]), - locate(.[MAP_MAXX], .[MAP_MAXY], .[MAP_MAXZ])) + var/list/turfs = block( .[MAP_MINX], .[MAP_MINY], .[MAP_MINZ], + .[MAP_MAXX], .[MAP_MAXY], .[MAP_MAXZ]) for(var/i in 1 to turfs.len) var/turf/place = turfs[i] if(isspaceturf(place)) // This assumes all shuttles are loaded in a single spot then moved to their real destination. diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 5c61186b585..d07aad057c2 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -663,13 +663,12 @@ var/list/new_locs if(is_multi_tile_object && isturf(newloc)) + var/dx = newloc.x + var/dy = newloc.y + var/dz = newloc.z new_locs = block( - newloc, - locate( - min(world.maxx, newloc.x + CEILING(bound_width / 32, 1)), - min(world.maxy, newloc.y + CEILING(bound_height / 32, 1)), - newloc.z - ) + dx, dy, dz, + dx + ceil(bound_width / 32), dy + ceil(bound_height / 32), dz ) // If this is a multi-tile object then we need to predict the new locs and check if they allow our entrance. for(var/atom/entering_loc as anything in new_locs) if(!entering_loc.Enter(src)) @@ -1155,13 +1154,12 @@ return FALSE if(is_multi_tile && isturf(destination)) + var/dx = destination.x + var/dy = destination.y + var/dz = destination.z var/list/new_locs = block( - destination, - locate( - min(world.maxx, destination.x + ROUND_UP(bound_width / ICON_SIZE_X)), - min(world.maxy, destination.y + ROUND_UP(bound_height / ICON_SIZE_Y)), - destination.z - ) + dx, dy, dz, + dx + ROUND_UP(bound_width / ICON_SIZE_X), dy + ROUND_UP(bound_height / ICON_SIZE_Y), dz ) if(old_area && old_area != destarea) old_area.Exited(src, movement_dir) diff --git a/code/game/world.dm b/code/game/world.dm index 79ba0f231e9..0633e197acc 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -456,8 +456,9 @@ GLOBAL_PROTECT(tracy_init_reason) LISTASSERTLEN(global_area.turfs_by_zlevel, map_load_z_cutoff, list()) for (var/zlevel in 1 to map_load_z_cutoff) var/list/to_add = block( - locate(old_max + 1, 1, zlevel), - locate(maxx, maxy, zlevel)) + old_max + 1, 1, zlevel, + maxx, maxy, zlevel + ) global_area.turfs_by_zlevel[zlevel] += to_add @@ -472,8 +473,9 @@ GLOBAL_PROTECT(tracy_init_reason) LISTASSERTLEN(global_area.turfs_by_zlevel, map_load_z_cutoff, list()) for (var/zlevel in 1 to map_load_z_cutoff) var/list/to_add = block( - locate(1, old_maxy + 1, 1), - locate(maxx, maxy, map_load_z_cutoff)) + 1, old_maxy + 1, 1, + maxx, maxy, map_load_z_cutoff + ) global_area.turfs_by_zlevel[zlevel] += to_add /world/proc/incrementMaxZ() diff --git a/code/modules/capture_the_flag/ctf_map_loading.dm b/code/modules/capture_the_flag/ctf_map_loading.dm index 4c2f6b319e0..9e23d617473 100644 --- a/code/modules/capture_the_flag/ctf_map_loading.dm +++ b/code/modules/capture_the_flag/ctf_map_loading.dm @@ -14,16 +14,8 @@ GLOBAL_DATUM(ctf_spawner, /obj/effect/landmark/ctf) /obj/effect/landmark/ctf/Destroy() if(map_bounds) for(var/turf/ctf_turf in block( - locate( - map_bounds[MAP_MINX], - map_bounds[MAP_MINY], - map_bounds[MAP_MINZ], - ), - locate( - map_bounds[MAP_MAXX], - map_bounds[MAP_MAXY], - map_bounds[MAP_MAXZ], - ) + map_bounds[MAP_MINX], map_bounds[MAP_MINY], map_bounds[MAP_MINZ], + map_bounds[MAP_MAXX], map_bounds[MAP_MAXY], map_bounds[MAP_MAXZ] )) ctf_turf.empty() GLOB.ctf_spawner = null diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 950f3e2809e..0f6ff85eed9 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -61,17 +61,9 @@ var/list/area/areas = list() var/list/turfs = block( - locate( - bounds[MAP_MINX], - bounds[MAP_MINY], - bounds[MAP_MINZ] - ), - locate( - bounds[MAP_MAXX], - bounds[MAP_MAXY], - bounds[MAP_MAXZ] - ) - ) + bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], + bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ] + ) for(var/turf/current_turf as anything in turfs) var/area/current_turfs_area = current_turf.loc areas |= current_turfs_area @@ -114,17 +106,9 @@ //calculate all turfs inside the border var/list/template_and_bordering_turfs = block( - locate( - max(bounds[MAP_MINX]-1, 1), - max(bounds[MAP_MINY]-1, 1), - bounds[MAP_MINZ] - ), - locate( - min(bounds[MAP_MAXX]+1, world.maxx), - min(bounds[MAP_MAXY]+1, world.maxy), - bounds[MAP_MAXZ] - ) - ) + bounds[MAP_MINX]-1, bounds[MAP_MINY]-1, bounds[MAP_MINZ], + bounds[MAP_MAXX]+1, bounds[MAP_MAXY]+1, bounds[MAP_MAXZ] + ) for(var/turf/affected_turf as anything in template_and_bordering_turfs) affected_turf.air_update_turf(TRUE, TRUE) affected_turf.levelupdate() @@ -230,7 +214,7 @@ var/turf/corner = locate(placement.x - round(width/2), placement.y - round(height/2), placement.z) if(corner) placement = corner - return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z)) + return block(placement.x, placement.y, placement.z, placement.x+width-1, placement.y+height-1, placement.z) /// Takes in a type path, locates an instance of that type in the cached map, and calculates its offset from the origin of the map, returns this offset in the form list(x, y). /datum/map_template/proc/discover_offset(obj/marker) diff --git a/code/modules/mapping/reader.dm b/code/modules/mapping/reader.dm index 10d506f8c48..1efcf71676e 100644 --- a/code/modules/mapping/reader.dm +++ b/code/modules/mapping/reader.dm @@ -350,8 +350,9 @@ if(!no_changeturf) var/list/turfs = block( - locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) + bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], + bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ] + ) for(var/turf/T as anything in turfs) //we do this after we load everything in. if we don't, we'll have weird atmos bugs regarding atmos adjacent turfs T.AfterChange(CHANGETURF_IGNORE_AIR) diff --git a/code/modules/mapping/space_management/space_transition.dm b/code/modules/mapping/space_management/space_transition.dm index b61897dd7b6..e5db045e92d 100644 --- a/code/modules/mapping/space_management/space_transition.dm +++ b/code/modules/mapping/space_management/space_transition.dm @@ -131,9 +131,10 @@ continue var/zlevelnumber = level.z_value for(var/side in 1 to 4) - var/turf/beginning = locate(x_pos_beginning[side], y_pos_beginning[side], zlevelnumber) - var/turf/ending = locate(x_pos_ending[side], y_pos_ending[side], zlevelnumber) - var/list/turfblock = block(beginning, ending) + var/list/turfblock = block( + x_pos_beginning[side], y_pos_beginning[side], zlevelnumber, + x_pos_ending[side], y_pos_ending[side], zlevelnumber + ) var/dirside = 2**(side-1) var/x_target = x_pos_transition[side] == 1 ? 0 : x_pos_transition[side] var/y_target = y_pos_transition[side] == 1 ? 0 : y_pos_transition[side] diff --git a/code/modules/procedural_mapping/mapGenerators/repair.dm b/code/modules/procedural_mapping/mapGenerators/repair.dm index da086773591..e33f3e1f0cc 100644 --- a/code/modules/procedural_mapping/mapGenerators/repair.dm +++ b/code/modules/procedural_mapping/mapGenerators/repair.dm @@ -50,8 +50,9 @@ require_area_resort() var/list/generation_turfs = block( - locate(bounds[MAP_MINX], bounds[MAP_MINY], SSmapping.station_start), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], z_offset - 1)) + bounds[MAP_MINX], bounds[MAP_MINY], SSmapping.station_start, + bounds[MAP_MAXX], bounds[MAP_MAXY], z_offset - 1 + ) for(var/turf/gen_turf as anything in generation_turfs) atoms += gen_turf for(var/atom in gen_turf) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index dbb4fc5386b..28b2516fda8 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -109,10 +109,11 @@ ///returns turfs within our projected rectangle in no particular order /obj/docking_port/proc/return_turfs() - var/list/L = return_coords() - var/turf/T0 = locate(L[1],L[2],z) - var/turf/T1 = locate(L[3],L[4],z) - return block(T0,T1) + var/list/coords = return_coords() + return block( + coords[1], coords[2], z, + coords[3], coords[4], z + ) ///returns turfs within our projected rectangle in a specific order.this ensures that turfs are copied over in the same order, regardless of any rotation /obj/docking_port/proc/return_ordered_turfs(_x, _y, _z, _dir) @@ -147,17 +148,15 @@ /obj/docking_port/proc/highlight(_color = "#f00") SetInvisibility(INVISIBILITY_NONE) SET_PLANE_IMPLICIT(src, GHOST_PLANE) - var/list/L = return_coords() - var/turf/T0 = locate(L[1],L[2],z) - var/turf/T1 = locate(L[3],L[4],z) - for(var/turf/T in block(T0,T1)) + var/list/coords = return_coords() + for(var/turf/T in block(coords[1], coords[2], z, coords[3], coords[4], z)) T.color = _color LAZYINITLIST(T.atom_colours) T.maptext = null if(_color) - var/turf/T = locate(L[1], L[2], z) + var/turf/T = locate(coords[1], coords[2], z) T.color = "#0f0" - T = locate(L[3], L[4], z) + T = locate(coords[3], coords[4], z) T.color = "#00f" #endif diff --git a/code/modules/transport/transport_module.dm b/code/modules/transport/transport_module.dm index 2c02b507bf2..83fd824bd6a 100644 --- a/code/modules/transport/transport_module.dm +++ b/code/modules/transport/transport_module.dm @@ -304,15 +304,16 @@ var/x_offset = ROUND_UP(bound_width / ICON_SIZE_X) - 1 //how many tiles our horizontally farthest edge is from us var/y_offset = ROUND_UP(bound_height / ICON_SIZE_Y) - 1 //how many tiles our vertically farthest edge is from us + var/destination_x = destination.x + var/destination_y = destination.y + var/destination_z = destination.z //the x coordinate of the edge furthest from our future destination, which would be our right hand side - var/back_edge_x = destination.x + x_offset//if we arent multitile this should just be destination.x - var/upper_edge_y = destination.y + y_offset - - var/turf/upper_right_corner = locate(min(world.maxx, back_edge_x), min(world.maxy, upper_edge_y), destination.z) + var/back_edge_x = destination_x + x_offset//if we arent multitile this should just be destination.x + var/upper_edge_y = destination_y + y_offset var/list/dest_locs = block( - destination, - upper_right_corner + destination_x, destination_y, destination_z, + back_edge_x, upper_edge_y, destination_z ) var/list/entering_locs = dest_locs - locs