From 711af982e4bcafe79c11382c415e84fcffa07659 Mon Sep 17 00:00:00 2001 From: TheChosenEvilOne <34602646+TheChosenEvilOne@users.noreply.github.com> Date: Sat, 3 Oct 2020 20:58:43 +0300 Subject: [PATCH] Fix loading templates in new z-levels being off by one turf (#54135) Due to how byond maps start at 1,1 and not 0,0 when loading a map that is the same size as the world the map will start loading at 0,0 in the world which is outside the map. load_map defaults the x and y offsets to 1 for a reason! Though you can load a map that is larger (257 x 257) than the world as a band aid for issue. --- code/modules/mapping/map_template.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 2375e139ff3..8e26030a53c 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -79,8 +79,8 @@ affected_turf.levelupdate() /datum/map_template/proc/load_new_z() - var/x = round((world.maxx - width)/2) - var/y = round((world.maxy - height)/2) + var/x = round((world.maxx - width) * 0.5) + 1 + var/y = round((world.maxy - height) * 0.5) + 1 var/datum/space_level/level = SSmapping.add_new_zlevel(name, list(ZTRAIT_AWAY = TRUE)) var/datum/parsed_map/parsed = load_map(file(mappath), x, y, level.z_value, no_changeturf=(SSatoms.initialized == INITIALIZATION_INSSATOMS), placeOnTop=TRUE)