diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 274867f4300..aad6401421c 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -816,15 +816,23 @@ Turf and target are seperate in case you want to teleport some distance from a t if(A.vars.Find(lowertext(varname))) return 1 else return 0 -//Returns: all the areas in the world -/proc/return_areas() - . = list() - for(var/area/A in world) - . += A +//Returns sortedAreas list if populated +//else populates the list first before returning it +/proc/returnSortedAreas() + if(!sortedAreas.len) + for(var/area/A in world) + if(!A.contents.len) + continue + if(A.lighting_subarea) + continue + sortedAreas.Add(A) -//Returns: all the areas in the world, sorted. -/proc/return_sorted_areas() - return sortNames(return_areas()) + sortTim(sortedAreas, /proc/cmp_name_asc) + return sortedAreas + +/area/proc/addSorted() + sortedAreas.Add(src) + sortTim(sortedAreas, /proc/cmp_name_asc) //Takes: Area type as text string or as typepath OR an instance of the area. //Returns: A list of all areas of that type in the world. diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index c908ec38450..802facfd5e4 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -47,3 +47,6 @@ var/list/emergencyresponseteamspawn = list() //away missions var/list/awaydestinations = list() //a list of landmarks that the warpgate can take you to + + //used by jump-to-area etc. Updated by area/updateName() +var/list/sortedAreas = list() diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index c70e912e6b0..023212155f7 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -42,13 +42,13 @@ ..() -// spawn(15) power_change() // all machines set to current power level, also updates lighting icon InitializeLighting() blend_mode = BLEND_MULTIPLY // Putting this in the constructure so that it stops the icons being screwed up in the map editor. + /area/proc/poweralert(var/state, var/obj/source as obj) if (state != poweralm) poweralm = state @@ -395,4 +395,4 @@ if(ismob(bug)) continue qdel(bug)*/ -*/ +*/ diff --git a/code/game/objects/items/blueprints.dm b/code/game/objects/items/blueprints.dm index 5f57615b107..a7df044de11 100644 --- a/code/game/objects/items/blueprints.dm +++ b/code/game/objects/items/blueprints.dm @@ -158,6 +158,8 @@ move_turfs_to_area(turfs, A) A.SetDynamicLighting() + A.addSorted() + interact() return diff --git a/code/modules/admin/verbs/adminjump.dm b/code/modules/admin/verbs/adminjump.dm index 0b9cdb13469..571b683c704 100644 --- a/code/modules/admin/verbs/adminjump.dm +++ b/code/modules/admin/verbs/adminjump.dm @@ -1,4 +1,4 @@ -/client/proc/Jump(var/area/A in return_sorted_areas()) +/client/proc/Jump(area/A in returnSortedAreas()) set name = "Jump to Area" set desc = "Area to jump to" set category = "Admin" @@ -6,7 +6,21 @@ src << "Only administrators may use this command." return - usr.loc = pick(get_area_turfs(A)) + if(!A) + return + + var/list/turfs = list() + for(var/area/Ar in A.related) + for(var/turf/T in Ar) + if(T.density) + continue + turfs.Add(T) + + var/turf/T = pick_n_take(turfs) + if(!T) + src << "Nowhere to jump to!" + return + usr.loc = T log_admin("[key_name(usr)] jumped to [A]") message_admins("[key_name_admin(usr)] jumped to [A]") feedback_add_details("admin_verb","JA") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -124,7 +138,7 @@ if(!src.holder) src << "Only administrators may use this command." return - var/area/A = input(usr, "Pick an area.", "Pick an area") in return_sorted_areas() + var/area/A = input(usr, "Pick an area.", "Pick an area") in returnSortedAreas() if(A) M.loc = pick(get_area_turfs(A)) feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!