From e3373171f817023d77a11b64dbaaf153dd18247a Mon Sep 17 00:00:00 2001 From: Doubleumc Date: Thu, 9 May 2024 01:07:07 -0400 Subject: [PATCH] initial --- code/__DEFINES/turfs.dm | 22 +++++++++++-------- code/__HELPERS/unsorted.dm | 3 +-- code/controllers/subsystem/interior.dm | 3 +-- code/controllers/subsystem/mapping.dm | 4 +--- code/datums/components/overlay_lighting.dm | 2 +- code/datums/shuttles.dm | 6 +---- code/datums/tutorial/_tutorial.dm | 8 +------ code/game/world.dm | 8 ++----- code/modules/buildmode/submodes/area_edit.dm | 2 +- code/modules/buildmode/submodes/fill.dm | 5 ++--- code/modules/cm_tech/techtree.dm | 7 +++--- code/modules/holidays/halloween/decorators.dm | 9 ++------ code/modules/mapping/map_template.dm | 20 +++-------------- code/modules/mapping/reader.dm | 5 +---- .../space_management/space_reservation.dm | 3 +-- .../xenomorph/abilities/queen/queen_powers.dm | 2 +- code/modules/nightmare/nmtasks/mapload.dm | 4 +--- .../modules/nightmare/nmtasks/mapscheduler.dm | 3 +-- code/modules/shuttle/shuttle.dm | 8 ++----- code/modules/tents/folded_tents.dm | 3 +-- code/modules/unit_tests/unit_test.dm | 2 +- code/modules/vehicles/interior/interior.dm | 6 ++--- .../vehicles/multitile/multitile_movement.dm | 17 ++++++++------ 23 files changed, 54 insertions(+), 98 deletions(-) diff --git a/code/__DEFINES/turfs.dm b/code/__DEFINES/turfs.dm index b9a80d4ab257..158c66754e18 100644 --- a/code/__DEFINES/turfs.dm +++ b/code/__DEFINES/turfs.dm @@ -1,23 +1,27 @@ #define RANGE_TURFS(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) \ -) + block( \ + (CENTER).x-(RADIUS), (CENTER).y-(RADIUS), (CENTER).z, \ + (CENTER).x+(RADIUS), (CENTER).y+(RADIUS), (CENTER).z \ + ) #define RECT_TURFS(H_RADIUS, V_RADIUS, CENTER) \ block( \ - 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) \ + (CENTER).x-(H_RADIUS), (CENTER).y-(V_RADIUS), (CENTER).z, \ + (CENTER).x+(H_RADIUS), (CENTER).y+(V_RADIUS), (CENTER).z \ ) ///Returns all turfs in a zlevel -#define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL)) +#define Z_TURFS(ZLEVEL) block(1, 1, (ZLEVEL), world.maxx, world.maxy, (ZLEVEL)) -/// Returns a list of turfs in the rectangle specified by BOTTOM LEFT corner and height/width, checks for being outside the world border for you +/// Returns a list of turfs in the rectangle specified by BOTTOM LEFT corner and height/width #define CORNER_BLOCK(corner, width, height) CORNER_BLOCK_OFFSET(corner, width, height, 0, 0) /// Returns a list of turfs similar to CORNER_BLOCK but with offsets -#define CORNER_BLOCK_OFFSET(corner, width, height, offset_x, offset_y) ((block(locate(corner.x + offset_x, corner.y + offset_y, corner.z), locate(min(corner.x + (width - 1) + offset_x, world.maxx), min(corner.y + (height - 1) + offset_y, world.maxy), corner.z)))) +#define CORNER_BLOCK_OFFSET(corner, width, height, offset_x, offset_y) \ + block( \ + (corner).x + (offset_x), (corner).y + (offset_y), (corner).z, \ + (corner).x + ((width) - 1) + (offset_x), (corner).y + ((height) - 1) + (offset_y), (corner).z \ + ) /// Returns an outline (neighboring turfs) of the given block #define CORNER_OUTLINE(corner, width, height) ( \ diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index aa23131847d7..7e4c5676c8d1 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -729,8 +729,7 @@ if(orange) turfs -= get_turf(center) . = list() - for(var/V in turfs) - var/turf/T = V + for(var/turf/T as anything in turfs) . += T . += T.contents if(areas) diff --git a/code/controllers/subsystem/interior.dm b/code/controllers/subsystem/interior.dm index e2b845f833d7..b0bacc7d2b72 100644 --- a/code/controllers/subsystem/interior.dm +++ b/code/controllers/subsystem/interior.dm @@ -21,8 +21,7 @@ SUBSYSTEM_DEF(interior) var/list/bounds = template.load(locate(bottom_left.x + (INTERIOR_BORDER_SIZE / 2), bottom_left.y + (INTERIOR_BORDER_SIZE / 2), bottom_left.z), centered = FALSE) - var/list/turfs = block( locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) + var/list/turfs = block(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]) var/list/areas = list() for(var/turf/current_turf as anything in turfs) diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 1d137aa7d8ae..4e6da51c60f3 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -363,9 +363,7 @@ SUBSYSTEM_DEF(mapping) 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) + var/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 block) // No need to empty() these, because they just got created and are already /turf/open/space/basic. T.turf_flags = UNUSED_RESERVATION_TURF diff --git a/code/datums/components/overlay_lighting.dm b/code/datums/components/overlay_lighting.dm index 8288453f7b24..2868899dee3f 100644 --- a/code/datums/components/overlay_lighting.dm +++ b/code/datums/components/overlay_lighting.dm @@ -175,7 +175,7 @@ LAZYINITLIST(affected_turfs) if(range <= 2) //Range here is 1 because actual range of lighting mask is 1 tile even if it says that range is 2 - for(var/turf/lit_turf in RANGE_TURFS(1, current_holder.loc)) + for(var/turf/lit_turf as anything in RANGE_TURFS(1, current_holder.loc)) lit_turf.dynamic_lumcount += lum_power affected_turfs += lit_turf else diff --git a/code/datums/shuttles.dm b/code/datums/shuttles.dm index 0eba86add45d..7254ae7e98d2 100644 --- a/code/datums/shuttles.dm +++ b/code/datums/shuttles.dm @@ -58,11 +58,7 @@ . = ..() if(!.) return - var/list/turfs = block( locate(.[MAP_MINX], .[MAP_MINY], .[MAP_MINZ]), - locate(.[MAP_MAXX], .[MAP_MAXY], .[MAP_MAXZ])) - for(var/i in 1 to turfs.len) - var/turf/place = turfs[i] - + for(var/turf/place as anything in block(.[MAP_MINX], .[MAP_MINY], .[MAP_MINZ], .[MAP_MAXX], .[MAP_MAXY], .[MAP_MAXZ])) // ================== CM Change ================== // We perform atom initialization of the docking_ports BEFORE skipping space, // because our lifeboats have their corners as object props and still diff --git a/code/datums/tutorial/_tutorial.dm b/code/datums/tutorial/_tutorial.dm index f228c051a77d..ddeddddd0407 100644 --- a/code/datums/tutorial/_tutorial.dm +++ b/code/datums/tutorial/_tutorial.dm @@ -101,13 +101,7 @@ GLOBAL_LIST_EMPTY_TYPED(ongoing_tutorials, /datum/tutorial) /datum/tutorial/proc/verify_template_loaded() // We subtract 1 from x and y because the bottom left corner doesn't start at the walls. var/turf/true_bottom_left_corner = reservation.bottom_left_turfs[1] - // We subtract 1 from x and y here because the bottom left corner counts as the first tile - var/turf/top_right_corner = locate( - true_bottom_left_corner.x + initial(tutorial_template.width) - 1, - true_bottom_left_corner.y + initial(tutorial_template.height) - 1, - true_bottom_left_corner.z - ) - for(var/turf/tile as anything in block(true_bottom_left_corner, top_right_corner)) + for(var/turf/tile as anything in CORNER_BLOCK(true_bottom_left_corner, initial(tutorial_template.width), initial(tutorial_template.height))) // For some reason I'm unsure of, the template will not always fully load, leaving some tiles to be space tiles. So, we check all tiles in the (small) tutorial area // and tell start_tutorial to abort if there's any space tiles. if(istype(tile, /turf/open/space)) diff --git a/code/game/world.dm b/code/game/world.dm index 5aecfe851051..6a792d1a4e41 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -332,9 +332,7 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt")) if(!map_load_z_cutoff) return // var/area/global_area = GLOB.areas_by_type[world.area] // We're guaranteed to be touching the global area, so we'll just do this -// var/list/to_add = block( -// locate(old_max + 1, 1, 1), -// locate(maxx, maxy, map_load_z_cutoff)) +// var/list/to_add = block(old_max + 1, 1, 1, maxx, maxy, map_load_z_cutoff) // global_area.contained_turfs += to_add /world/proc/increase_max_y(new_maxy, map_load_z_cutoff = maxz) @@ -345,9 +343,7 @@ GLOBAL_LIST_INIT(reboot_sfx, file2list("config/reboot_sfx.txt")) if(!map_load_z_cutoff) return // var/area/global_area = GLOB.areas_by_type[world.area] // We're guarenteed to be touching the global area, so we'll just do this -// var/list/to_add = block( -// locate(1, old_maxy + 1, 1), -// locate(maxx, maxy, map_load_z_cutoff)) +// var/list/to_add = block(1, old_maxy + 1, 1, maxx, maxy, map_load_z_cutoff) // global_area.contained_turfs += to_add /world/proc/incrementMaxZ() diff --git a/code/modules/buildmode/submodes/area_edit.dm b/code/modules/buildmode/submodes/area_edit.dm index 3c2a07c687d3..57b82e30fd3b 100644 --- a/code/modules/buildmode/submodes/area_edit.dm +++ b/code/modules/buildmode/submodes/area_edit.dm @@ -66,7 +66,7 @@ var/choice = alert("Are you sure you want to fill area?", "Area Fill Confirmation", "Yes", "No") if(choice != "Yes") return - for(var/turf/T in block(get_turf(cornerA),get_turf(cornerB))) + for(var/turf/T as anything in block(get_turf(cornerA),get_turf(cornerB))) storedarea.contents.Add(T) log_admin("Build Mode: [key_name(c)] set the area of the region from [AREACOORD(cornerA)] through [AREACOORD(cornerB)] to [storedarea].") diff --git a/code/modules/buildmode/submodes/fill.dm b/code/modules/buildmode/submodes/fill.dm index 59142e712602..52212a9c57c5 100644 --- a/code/modules/buildmode/submodes/fill.dm +++ b/code/modules/buildmode/submodes/fill.dm @@ -49,8 +49,7 @@ if(LAZYACCESS(modifiers, LEFT_CLICK)) //rectangular if(LAZYACCESS(modifiers, CTRL_CLICK)) var/list/deletion_area = block(get_turf(cornerA),get_turf(cornerB)) - for(var/deleted_turfs in deletion_area) - var/turf/T = deleted_turfs + for(var/turf/T as anything in deletion_area) for(var/atom/movable/AM in T) qdel(AM) T.ScrapeAway(INFINITY, CHANGETURF_DEFER_CHANGE) @@ -59,7 +58,7 @@ var/choice = alert("Your selected area is [selection_size] tiles! Continue?", "Large Fill Confirmation", CONFIRM_YES, CONFIRM_NO) if(choice != CONFIRM_YES) return - for(var/turf/T in block(get_turf(cornerA),get_turf(cornerB))) + for(var/turf/T as anything in deletion_area) if(ispath(objholder,/turf)) T = T.ChangeTurf(objholder) T.setDir(BM.build_dir) diff --git a/code/modules/cm_tech/techtree.dm b/code/modules/cm_tech/techtree.dm index a027789185ef..d272c19ab5cf 100644 --- a/code/modules/cm_tech/techtree.dm +++ b/code/modules/cm_tech/techtree.dm @@ -62,9 +62,8 @@ // (The `+ 2` on both of these is 1 for a buffer tile, and 1 for the outer `/turf/closed/void`.) var/area_max_x = longest_tier * 2 + 2 var/area_max_y = length(all_techs) * 3 + 2 - for(var/t in block(locate(1, 1, zlevel.z_value), locate(area_max_x, area_max_y, zlevel.z_value))) - var/turf/pos = t - for(var/A in pos) + for(var/turf/pos as anything in block(1, 1, zlevel.z_value, area_max_x, area_max_y, zlevel.z_value)) + for(var/A as anything in pos) qdel(A) if(pos.x == area_max_x || pos.y == area_max_y) @@ -83,7 +82,7 @@ var/x_offset = (longest_tier - tier_length) + 1 var/datum/tier/T = tree_tiers[tier] - for(var/turf/pos in block(locate(x_offset, y_offset, zlevel.z_value), locate(x_offset + tier_length*2, y_offset + 2, zlevel.z_value))) + for(var/turf/pos as anything in block(x_offset, y_offset, zlevel.z_value, x_offset + tier_length*2, y_offset + 2, zlevel.z_value)) pos.ChangeTurf(/turf/open/blank) pos.color = "#000000" LAZYADD(T.tier_turfs, pos) diff --git a/code/modules/holidays/halloween/decorators.dm b/code/modules/holidays/halloween/decorators.dm index 6575ed5ba665..fb12cf96cd82 100644 --- a/code/modules/holidays/halloween/decorators.dm +++ b/code/modules/holidays/halloween/decorators.dm @@ -25,8 +25,7 @@ var/list/turf/valid_turfs = list() var/list/ground_levels = SSmapping.levels_by_trait(ZTRAIT_GROUND) for(var/ground_z in ground_levels) - var/list/turf/all_turfs = block(locate(1, 1, ground_z), locate(world.maxx, world.maxy, ground_z)) - for(var/turf/open/turf in all_turfs) + for(var/turf/open/turf in Z_TURFS(ground_z)) if(turf.is_groundmap_turf) var/valid = TRUE for(var/atom/movable/movable as anything in turf.contents) @@ -42,11 +41,7 @@ if(!length(valid_turfs)) break var/turf/considered_turf = pick(valid_turfs) - var/x_min = max(1, considered_turf.x - exclusion_range) - var/y_min = max(1, considered_turf.y - exclusion_range) - var/x_max = min(world.maxx, considered_turf.x + exclusion_range) - var/y_max = min(world.maxy, considered_turf.y + exclusion_range) - var/list/turf/denied_turfs = block(locate(x_min, y_min, considered_turf.z), locate(x_max, y_max, considered_turf.z)) + var/list/turf/denied_turfs = RANGE_TURFS(exclusion_range, considered_turf) valid_turfs -= denied_turfs picked_turfs += considered_turf diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 50a343635de9..0fe22535201e 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -48,18 +48,7 @@ var/list/obj/docking_port/stationary/ports = list() 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] - ) - ) + var/list/turfs = block(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 @@ -163,12 +152,9 @@ return /datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE) - var/turf/placement = T if(centered) - 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 RECT_TURFS(floor(width / 2), floor(height / 2), T) + return CORNER_BLOCK(T, width, height) //for your ever biggening badminnery kevinz000 diff --git a/code/modules/mapping/reader.dm b/code/modules/mapping/reader.dm index 424ab22ae4ac..6b4675e3bade 100644 --- a/code/modules/mapping/reader.dm +++ b/code/modules/mapping/reader.dm @@ -355,10 +355,7 @@ // SSmapping.build_area_turfs(z_index) 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])) - for(var/turf/T as anything in turfs) + for(var/turf/T as anything in block(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) //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_reservation.dm b/code/modules/mapping/space_management/space_reservation.dm index 3c47ac3b5c2a..63ec6485e3f3 100644 --- a/code/modules/mapping/space_management/space_reservation.dm +++ b/code/modules/mapping/space_management/space_reservation.dm @@ -131,8 +131,7 @@ if(!final) continue passing = TRUE - for(var/I in final) - var/turf/checking = I + for(var/turf/checking as anything in final) if(!(checking.turf_flags & UNUSED_RESERVATION_TURF)) passing = FALSE break diff --git a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm index 38e643e0d25c..b1d3215c2d61 100644 --- a/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm +++ b/code/modules/mob/living/carbon/xenomorph/abilities/queen/queen_powers.dm @@ -819,7 +819,7 @@ return var/list/alerts = list() - for(var/i in RANGE_TURFS(Floor(width/2), T)) + for(var/i as anything in RANGE_TURFS(Floor(width/2), T)) alerts += new /obj/effect/warning/alien(i) if(!do_after(Q, time_taken, INTERRUPT_NO_NEEDHAND, BUSY_ICON_FRIENDLY)) diff --git a/code/modules/nightmare/nmtasks/mapload.dm b/code/modules/nightmare/nmtasks/mapload.dm index a49bbbabdde5..052cb069baec 100644 --- a/code/modules/nightmare/nmtasks/mapload.dm +++ b/code/modules/nightmare/nmtasks/mapload.dm @@ -70,11 +70,9 @@ var/list/bounds = parsed.bounds if(length(bounds) < 6) return - var/list/turf_block = block( locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) var/list/area/arealist = list() var/list/atom/atomlist = list() - for(var/turf/turf as anything in turf_block) + for(var/turf/turf as anything in block(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) atomlist += turf if(turf.loc) arealist |= turf.loc diff --git a/code/modules/nightmare/nmtasks/mapscheduler.dm b/code/modules/nightmare/nmtasks/mapscheduler.dm index 34ceecafb876..b97193eadb21 100644 --- a/code/modules/nightmare/nmtasks/mapscheduler.dm +++ b/code/modules/nightmare/nmtasks/mapscheduler.dm @@ -22,8 +22,7 @@ var/list/tainted = list() for(var/list/bounds as anything in tainted_bounds) - var/list/TT = block( locate(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ]), - locate(bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ])) + var/list/TT = block(bounds[MAP_MINX], bounds[MAP_MINY], bounds[MAP_MINZ], bounds[MAP_MAXX], bounds[MAP_MAXY], bounds[MAP_MAXZ]) tainted |= TT for(var/turf/T as anything in tainted) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 5e8d1db63716..9ae7b77d6533 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -105,9 +105,7 @@ ///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) + return block(L[1], L[2], z, L[3], L[4], z) /obj/docking_port/proc/return_center_turf() var/list/L = return_coords() @@ -159,9 +157,7 @@ //Debug proc used to highlight bounding area /obj/docking_port/proc/highlight(_color) 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)) + for(var/turf/T as anything in block(L[1], L[2], z, L[3], L[4], z)) T.color = _color T.maptext = null if(_color) diff --git a/code/modules/tents/folded_tents.dm b/code/modules/tents/folded_tents.dm index fe1a748b750d..6496810f1a85 100644 --- a/code/modules/tents/folded_tents.dm +++ b/code/modules/tents/folded_tents.dm @@ -69,8 +69,7 @@ /obj/item/folded_tent/proc/get_deployment_area(turf/ref_turf) RETURN_TYPE(/list/turf) - var/turf/block_end_turf = locate(ref_turf.x + dim_x - 1, ref_turf.y + dim_y - 1, ref_turf.z) - return block(ref_turf, block_end_turf) + return CORNER_BLOCK(ref_turf, dim_x, dim_y) /obj/item/folded_tent/attack_self(mob/living/user) . = ..() diff --git a/code/modules/unit_tests/unit_test.dm b/code/modules/unit_tests/unit_test.dm index 30eae6eef44e..8d04a51bcc19 100644 --- a/code/modules/unit_tests/unit_test.dm +++ b/code/modules/unit_tests/unit_test.dm @@ -64,7 +64,7 @@ GLOBAL_VAR_INIT(focused_test, focused_test()) /datum/unit_test/Destroy() QDEL_LIST(allocated) // clear the test area - for (var/turf/turf in block(locate(1, 1, run_loc_floor_bottom_left.z), locate(world.maxx, world.maxy, run_loc_floor_bottom_left.z))) + for (var/turf/turf as anything in Z_TURFS(run_loc_floor_bottom_left.z)) for (var/content in turf.contents) if (istype(content, /obj/effect/landmark)) continue diff --git a/code/modules/vehicles/interior/interior.dm b/code/modules/vehicles/interior/interior.dm index 8fb65602c9b3..b58d73444180 100644 --- a/code/modules/vehicles/interior/interior.dm +++ b/code/modules/vehicles/interior/interior.dm @@ -118,7 +118,7 @@ var/list/passengers var/list/bounds = get_bound_turfs() - for(var/turf/T in block(bounds[1], bounds[2])) + for(var/turf/T as anything in block(bounds[1], bounds[2])) for(var/atom/A in T) if(isliving(A)) LAZYADD(passengers, A) @@ -322,7 +322,7 @@ /datum/interior/proc/find_entrances() var/list/bounds = get_bound_turfs() - for(var/turf/T in block(bounds[1], bounds[2])) + for(var/turf/T as anything in block(bounds[1], bounds[2])) var/obj/effect/landmark/interior/spawn/entrance/E = locate() in T if(E) LAZYADD(entrance_markers, E) @@ -332,6 +332,6 @@ /datum/interior/proc/handle_landmarks() var/list/bounds = get_bound_turfs() - for(var/turf/T in block(bounds[1], bounds[2])) + for(var/turf/T as anything in block(bounds[1], bounds[2])) for(var/obj/effect/landmark/interior/L in T) L.on_load(src) diff --git a/code/modules/vehicles/multitile/multitile_movement.dm b/code/modules/vehicles/multitile/multitile_movement.dm index b5f308144707..d2374912a192 100644 --- a/code/modules/vehicles/multitile/multitile_movement.dm +++ b/code/modules/vehicles/multitile/multitile_movement.dm @@ -141,15 +141,18 @@ /obj/vehicle/multitile/proc/can_move(direction) var/can_move = TRUE - var/turf/min_turf = locate(x + bound_x / world.icon_size, y + bound_y / world.icon_size, z) - var/turf/max_turf = locate(min_turf.x + (bound_width / world.icon_size) - 1, min_turf.y + (bound_height / world.icon_size) - 1, z) - var/list/old_turfs = block(min_turf, max_turf) + var/bound_x_tiles = bound_x / world.icon_size + var/bound_y_tiles = bound_y / world.icon_size + var/turf/min_turf = locate(x + bound_x_tiles, y + bound_y_tiles, z) + + var/bound_width_tiles = bound_width / world.icon_size + var/bound_height_tiles = bound_height / world.icon_size + var/list/old_turfs = CORNER_BLOCK(min_turf, bound_width_tiles, bound_height_tiles) var/turf/new_loc = get_step(src, direction) - min_turf = locate(new_loc.x + bound_x / world.icon_size, new_loc.y + bound_y / world.icon_size, z) - max_turf = locate(min_turf.x + (bound_width / world.icon_size) - 1, min_turf.y + (bound_height / world.icon_size) - 1, z) + min_turf = locate(new_loc.x + bound_x_tiles, new_loc.y + bound_y_tiles, z) - for(var/turf/T in block(min_turf, max_turf)) + for(var/turf/T as anything in CORNER_BLOCK(min_turf, bound_width_tiles, bound_height_tiles)) // only check the turfs we're moving to if(T in old_turfs) continue @@ -264,7 +267,7 @@ break var/list/bounds = interior.get_bound_turfs() - for(var/turf/T in block(bounds[1], bounds[2])) + for(var/turf/T as anything in block(bounds[1], bounds[2])) for(var/atom/movable/A in T) if(A.anchored) continue