Converts most other usages of block() to x/y/z format (#89290)

## About The Pull Request

The sequel to https://github.com/tgstation/tgstation/pull/89234

> someone should do the rest at some point

guess what, I'm that someone :3

## Why It's Good For The Game

Same reasoning as the previous PR:

> less cluttered code is nice, and it should in theory be more optimized
as we avoid the need to run min, max, and locate.

## Changelog

No user-facing changes
This commit is contained in:
Lucy
2025-02-07 02:44:10 +01:00
committed by GitHub
parent 25b686fb2d
commit 2ee02682f7
13 changed files with 75 additions and 90 deletions
+7 -23
View File
@@ -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)
+3 -2
View File
@@ -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)
@@ -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]