Fixes shuttles loading improperly in templates

Adds template datum and preloader
This commit is contained in:
AnturK
2016-01-28 23:12:09 +01:00
parent b1327480eb
commit 8999db80b4
7 changed files with 111 additions and 38 deletions
@@ -1,4 +1,3 @@
/client/proc/map_template_load()
set category = "Debug"
set name = "Map template - Place"
@@ -7,30 +6,15 @@
if(!T)
return
var/list/filelist = flist("_maps/templates/")
filelist |= map_template_uploads
var/datum/map_template/template
var/map = input(usr, "Choose a Map Template to place at your CURRENT LOCATION","Place Map Template") as null|anything in filelist
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/mapfile
if(map in map_template_uploads) //in the cache, not the template folder
mapfile = map
else
mapfile = file("_maps/templates/[map]")
if(isfile(mapfile))
maploader.load_map(mapfile, T.x, T.y, T.z)
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has placed a map template ([map]) at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>(JMP)</a></span>")
else
usr << "Bad map file: [map]"
//A list of map files that have been uploaded by admins
//It's NOT persistent between rounds
var/global/list/map_template_uploads = list()
template = map_templates[map]
template.load(T)
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has placed a map template ([template.name]) at <A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[T.x];Y=[T.y];Z=[T.z]'>(JMP)</a></span>")
/client/proc/map_template_upload()
set category = "Debug"
@@ -43,5 +27,6 @@ var/global/list/map_template_uploads = list()
usr << "Bad map file: [map]"
return
map_template_uploads |= file(map)
var/datum/map_template/M = new(map=map, rename="[map]")
map_templates[M.name] = M
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has uploaded a map template ([map])</span>")