diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm
index 84e6a800056..8d564b565ea 100644
--- a/code/datums/helper_datums/map_template.dm
+++ b/code/datums/helper_datums/map_template.dm
@@ -28,7 +28,7 @@
/datum/map_template/proc/load(turf/T, centered = FALSE)
if(centered)
- T = locate(T.x - width/2 , T.y - height/2 , T.z)
+ T = locate(T.x - round(width/2) , T.y - round(height/2) , T.z)
if(!T)
return
if(T.x+width > world.maxx)
@@ -36,14 +36,14 @@
if(T.y+height > world.maxy)
return
- maploader.load_map(get_file(), T.x, T.y, T.z)
+ maploader.load_map(get_file(), T.x-1, T.y-1, T.z)
//initialize things that are normally initialized after map load
var/list/obj/machinery/atmospherics/atmos_machines = list()
var/list/obj/structure/cable/cables = list()
var/list/atom/atoms = list()
- for(var/L in block(T,locate(T.x+width, T.y+height, T.z)))
+ for(var/L in block(T,locate(T.x+width-1, T.y+height-1, T.z)))
var/turf/B = L
for(var/A in B)
atoms += A
@@ -70,10 +70,10 @@
/datum/map_template/proc/get_affected_turfs(turf/T, centered = FALSE)
var/turf/placement = T
if(centered)
- var/turf/corner = locate(placement.x - width/2, placement.y - height/2, placement.z)
+ 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, placement.y + height, placement.z))
+ return block(placement, locate(placement.x+width-1, placement.y+height-1, placement.z))
/proc/preloadTemplates(path = "_maps/templates/") //see master controller setup
diff --git a/code/modules/admin/verbs/map_template_loadverb.dm b/code/modules/admin/verbs/map_template_loadverb.dm
index 2801c0477c9..5c536fff54f 100644
--- a/code/modules/admin/verbs/map_template_loadverb.dm
+++ b/code/modules/admin/verbs/map_template_loadverb.dm
@@ -2,19 +2,23 @@
set category = "Debug"
set name = "Map template - Place"
- var/map = input(usr, "Choose a Map Template to place at your CURRENT LOCATION","Place Map Template") as null|anything in map_templates
- if(!map)
- return
+
+ var/datum/map_template/template
var/turf/T = get_turf(mob)
if(!T)
return
- var/datum/map_template/template
-
template = map_templates[map]
- template.load(T)
- message_admins("[key_name_admin(usr)] has placed a map template ([template.name]) at (JMP)")
+
+ var/list/preview = list()
+ for(var/turf/S in template.get_affected_turfs(T,centered = TRUE))
+ preview += image('icons/turf/overlays.dmi',S,"greenOverlay")
+ usr.client.images += preview
+ if(alert(usr,"Confirm location.","Template Confirm","Yes","No") == "Yes")
+ template.load(T, centered = TRUE)
+ message_admins("[key_name_admin(usr)] has placed a map template ([template.name]) at (JMP)")
+ usr.client.images -= preview
/client/proc/map_template_upload()
set category = "Debug"