mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-21 04:57:57 +01:00
Merge pull request #13852 from RemieRichards/AdminQuickMapDrop
Map Template Load Verb + Maploader Improvements
This commit is contained in:
@@ -135,7 +135,9 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/cmd_display_del_log,
|
||||
/client/proc/reset_latejoin_spawns,
|
||||
/client/proc/create_outfits,
|
||||
/client/proc/debug_huds
|
||||
/client/proc/debug_huds,
|
||||
/client/proc/map_template_load,
|
||||
/client/proc/map_template_upload
|
||||
)
|
||||
var/list/admin_verbs_possess = list(
|
||||
/proc/possess,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
/client/proc/map_template_load()
|
||||
set category = "Debug"
|
||||
set name = "Map template - Place"
|
||||
|
||||
var/turf/T = get_turf(mob)
|
||||
if(!T)
|
||||
return
|
||||
|
||||
var/list/filelist = flist("_maps/templates/")
|
||||
filelist |= map_template_uploads
|
||||
|
||||
var/map = input(usr, "Choose a Map Template to place at your CURRENT LOCATION","Place Map Template") as null|anything in filelist
|
||||
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()
|
||||
|
||||
|
||||
/client/proc/map_template_upload()
|
||||
set category = "Debug"
|
||||
set name = "Map Template - Upload"
|
||||
|
||||
var/map = input(usr, "Choose a Map Template to upload to template storage","Upload Map Template") as null|file
|
||||
if(!map)
|
||||
return
|
||||
if(copytext("[map]",-4) != ".dmm")
|
||||
usr << "Bad map file: [map]"
|
||||
return
|
||||
|
||||
map_template_uploads |= file(map)
|
||||
message_admins("<span class='adminnotice'>[key_name_admin(usr)] has uploaded a map template ([map])</span>")
|
||||
@@ -81,7 +81,9 @@ var/global/dmm_suite/preloader/_preloader = null
|
||||
|
||||
//fill the current square using the model map
|
||||
xcrd=0
|
||||
for(var/mpos=1;mpos<=x_depth;mpos+=key_len)
|
||||
|
||||
|
||||
for(var/mpos in 1 to x_depth step key_len)
|
||||
xcrd++
|
||||
var/model_key = copytext(grid_line,mpos,mpos+key_len)
|
||||
parse_grid(grid_models[model_key],xcrd+x_offset,ycrd+y_offset,zcrd+z_offset)
|
||||
@@ -175,7 +177,9 @@ var/global/dmm_suite/preloader/_preloader = null
|
||||
_preloader = new(members_attributes[index])//preloader for assigning set variables on atom creation
|
||||
|
||||
instance = locate(members[index])
|
||||
instance.contents.Add(locate(xcrd,ycrd,zcrd))
|
||||
var/turf/crds = locate(xcrd,ycrd,zcrd)
|
||||
if(crds)
|
||||
instance.contents.Add(crds)
|
||||
|
||||
if(_preloader && instance)
|
||||
_preloader.load(instance)
|
||||
@@ -191,17 +195,18 @@ var/global/dmm_suite/preloader/_preloader = null
|
||||
//instanciate the first /turf
|
||||
var/turf/T = instance_atom(members[first_turf_index],members_attributes[first_turf_index],xcrd,ycrd,zcrd)
|
||||
|
||||
//if others /turf are presents, simulates the underlays piling effect
|
||||
index = first_turf_index + 1
|
||||
while(index <= members.len)
|
||||
turfs_underlays.Insert(1,image(T.icon,null,T.icon_state,T.layer,T.dir))//add the current turf image to the underlays list
|
||||
var/turf/UT = instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd)//instance new turf
|
||||
add_underlying_turf(UT,T,turfs_underlays)//simulates the DMM piling effect
|
||||
T = UT
|
||||
index++
|
||||
if(T)
|
||||
//if others /turf are presents, simulates the underlays piling effect
|
||||
index = first_turf_index + 1
|
||||
while(index <= members.len)
|
||||
turfs_underlays.Insert(1,image(T.icon,null,T.icon_state,T.layer,T.dir))//add the current turf image to the underlays list
|
||||
var/turf/UT = instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd)//instance new turf
|
||||
add_underlying_turf(UT,T,turfs_underlays)//simulates the DMM piling effect
|
||||
T = UT
|
||||
index++
|
||||
|
||||
//finally instance all remainings objects/mobs
|
||||
for(index=1,index < first_turf_index,index++)
|
||||
for(index in 1 to first_turf_index-1)
|
||||
instance_atom(members[index],members_attributes[index],xcrd,ycrd,zcrd)
|
||||
|
||||
////////////////
|
||||
@@ -213,7 +218,9 @@ var/global/dmm_suite/preloader/_preloader = null
|
||||
var/atom/instance
|
||||
_preloader = new(attributes, path)
|
||||
|
||||
instance = new path (locate(x,y,z))//first preloader pass
|
||||
var/turf/T = locate(x,y,z)
|
||||
if(T)
|
||||
instance = new path (T)//first preloader pass
|
||||
|
||||
if(_preloader && instance)//second preloader pass, for those atoms that don't ..() in New()
|
||||
_preloader.load(instance)
|
||||
|
||||
@@ -227,11 +227,11 @@ swapmap
|
||||
S["areas"] << areas
|
||||
for(n in 1 to areas.len) areas[areas[n]]=n
|
||||
var/oldcd=S.cd
|
||||
for(z=z1,z<=z2,++z)
|
||||
for(z in z1 to z2)
|
||||
S.cd="[z-z1+1]"
|
||||
for(y=y1,y<=y2,++y)
|
||||
for(y in y1 to y2)
|
||||
S.cd="[y-y1+1]"
|
||||
for(x=x1,x<=x2,++x)
|
||||
for(x in x1 to x2)
|
||||
S.cd="[x-x1+1]"
|
||||
var/turf/T=locate(x,y,z)
|
||||
S["type"] << T.type
|
||||
@@ -270,11 +270,11 @@ swapmap
|
||||
locked=1
|
||||
AllocateSwapMap() // adjust x1,y1,z1 - x2,y2,z2 coords
|
||||
var/oldcd=S.cd
|
||||
for(z=z1,z<=z2,++z)
|
||||
for(z in z1 to z2)
|
||||
S.cd="[z-z1+1]"
|
||||
for(y=y1,y<=y2,++y)
|
||||
for(y in y1 to y2)
|
||||
S.cd="[y-y1+1]"
|
||||
for(x=x1,x<=x2,++x)
|
||||
for(x in x1 to x2)
|
||||
S.cd="[x-x1+1]"
|
||||
var/tp
|
||||
S["type"]>>tp
|
||||
|
||||
@@ -49,9 +49,9 @@ dmm_suite{
|
||||
var/list/templates[0]
|
||||
var/template_buffer = {""}
|
||||
var/dmm_text = {""}
|
||||
for(var/pos_z=nw.z;pos_z<=se.z;pos_z++){
|
||||
for(var/pos_y=nw.y;pos_y>=se.y;pos_y--){
|
||||
for(var/pos_x=nw.x;pos_x<=se.x;pos_x++){
|
||||
for(var/pos_z in nw.z to se.z){
|
||||
for(var/pos_y in nw.y to se.y){
|
||||
for(var/pos_x in nw.x to se.x){
|
||||
var/turf/test_turf = locate(pos_x,pos_y,pos_z)
|
||||
var/test_template = make_template(test_turf, flags)
|
||||
var/template_number = templates.Find(test_template)
|
||||
@@ -67,7 +67,7 @@ dmm_suite{
|
||||
}
|
||||
var/key_length = round/*floor*/(log(letter_digits.len,templates.len-1)+1)
|
||||
var/list/keys[templates.len]
|
||||
for(var/key_pos=1;key_pos<=templates.len;key_pos++){
|
||||
for(var/key_pos in 1 to templates.len){
|
||||
keys[key_pos] = get_model_key(key_pos,key_length)
|
||||
dmm_text += {""[keys[key_pos]]" = ([templates[key_pos]])\n"}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ dmm_suite{
|
||||
get_model_key(var/which as num, var/key_length as num){
|
||||
var/key = ""
|
||||
var/working_digit = which-1
|
||||
for(var/digit_pos=key_length;digit_pos>=1;digit_pos--){
|
||||
for(var/digit_pos in key_length to 1 step -1){
|
||||
var/place_value = round/*floor*/(working_digit/(letter_digits.len**(digit_pos-1)))
|
||||
working_digit-=place_value*(letter_digits.len**(digit_pos-1))
|
||||
key = "[key][letter_digits[place_value+1]]"
|
||||
|
||||
Reference in New Issue
Block a user