Merge pull request #7173 from Carn/#6971

Resolves #6971 - non-lighting_subarea areas are now stored in list/sorte...
This commit is contained in:
tkdrg
2015-01-21 05:06:25 -03:00
5 changed files with 40 additions and 13 deletions
+16 -8
View File
@@ -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.
+3
View File
@@ -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()
+2 -2
View File
@@ -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)*/
*/
*/
+2
View File
@@ -158,6 +158,8 @@
move_turfs_to_area(turfs, A)
A.SetDynamicLighting()
A.addSorted()
interact()
return
+17 -3
View File
@@ -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!