Merge pull request #15687 from AnturK/template_improvements

Template loading improvements
This commit is contained in:
tkdrg
2016-02-25 16:29:10 -03:00
6 changed files with 51 additions and 27 deletions
@@ -2,19 +2,24 @@
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
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
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>")
var/list/preview = list()
for(var/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("<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>")
usr.client.images -= preview
/client/proc/map_template_upload()
set category = "Debug"
+18 -10
View File
@@ -174,17 +174,17 @@ var/global/dmm_suite/preloader/_preloader = new
//first instance the /area and remove it from the members list
index = members.len
var/atom/instance
_preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
if(members[index] != /area/template_noop)
var/atom/instance
_preloader.setup(members_attributes[index])//preloader for assigning set variables on atom creation
instance = locate(members[index])
var/turf/crds = locate(xcrd,ycrd,zcrd)
if(crds)
instance.contents.Add(crds)
if(use_preloader && instance)
_preloader.load(instance)
instance = locate(members[index])
var/turf/crds = locate(xcrd,ycrd,zcrd)
if(crds)
instance.contents.Add(crds)
if(use_preloader && instance)
_preloader.load(instance)
members.Remove(members[index])
//then instance the /turf and, if multiple tiles are presents, simulates the DMM underlays piling effect
@@ -194,7 +194,9 @@ var/global/dmm_suite/preloader/_preloader = new
first_turf_index++
//instanciate the first /turf
var/turf/T = instance_atom(members[first_turf_index],members_attributes[first_turf_index],xcrd,ycrd,zcrd)
var/turf/T
if(members[first_turf_index] != /turf/template_noop)
T = instance_atom(members[first_turf_index],members_attributes[first_turf_index],xcrd,ycrd,zcrd)
if(T)
//if others /turf are presents, simulates the underlays piling effect
@@ -350,3 +352,9 @@ var/global/dmm_suite/preloader/_preloader = new
for(var/attribute in attributes)
what.vars[attribute] = attributes[attribute]
use_preloader = FALSE
/area/template_noop
name = "Area Passthrough"
/turf/template_noop
name = "Turf Passthrough"