From d55f08551904569d18231affccf0dd3217524de8 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Mon, 5 Sep 2011 22:44:20 +0000 Subject: [PATCH] New mapping verb. Count objects level and Count objects all. Allows you to enter a path and in the case of Count objects level also a z-level number. This proc will count the number of objects that there are on the level. The commands can be found in mapping debug, so it's game master only. The commands go to the top-level container (just below turf) to see what item you have. Unfortunately some coders (AGOURI!!) sometimes don't spawn items properly (SUIT STORAGE UNITS!!), making the items exist, but not on the actual z-level. They are not located in contents, nor do they have the loc variable set. The loc variable of them is null, yet they exist. Count objects all will find them while Count objects level won't. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2138 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/verbs/mapping.dm | 72 ++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm index a0e280320ef..a87e2320a7a 100644 --- a/code/modules/admin/verbs/mapping.dm +++ b/code/modules/admin/verbs/mapping.dm @@ -119,4 +119,74 @@ var/intercom_range_display_status = 0 src.verbs += /client/proc/intercom_view //-errorage src.verbs += /client/proc/air_status //Air things src.verbs += /client/proc/Cell //More air things - src.verbs += /client/proc/atmosscan //check plumbing \ No newline at end of file + src.verbs += /client/proc/atmosscan //check plumbing + src.verbs += /client/proc/count_objects_on_z_level + src.verbs += /client/proc/count_objects_all + + count_objects_on_z_level() + set category = "Mapping" + set name = "Count Objects On Level" + var/level = input("Which z-level?","Level?") as text + if(!level) return + var/num_level = text2num(level) + if(!num_level) return + if(!isnum(num_level)) return + + var/type_text = input("Which type path?","Path?") as text + if(!type_text) return + var/type_path = text2path(type_text) + if(!type_path) return + + var/count = 0 + + var/list/atom/atom_list = list() + + for(var/atom/A in world) + if(istype(A,type_path)) + var/atom/B = A + while(!(isturf(B.loc))) + if(B && B.loc) + B = B.loc + else + break + if(B) + if(B.z == num_level) + count++ + atom_list += A + /* + var/atom/temp_atom + for(var/i = 0; i <= (atom_list.len/10); i++) + var/line = "" + for(var/j = 1; j <= 10; j++) + if(i*10+j <= atom_list.len) + temp_atom = atom_list[i*10+j] + line += " no.[i+10+j]@\[[temp_atom.x], [temp_atom.y], [temp_atom.z]\]; " + world << line*/ + + world << "There are [count] objects of type [type_path] on z-level [num_level]" + + count_objects_all() + set category = "Mapping" + set name = "Count Objects All" + + var/type_text = input("Which type path?","") as text + if(!type_text) return + var/type_path = text2path(type_text) + if(!type_path) return + + var/count = 0 + + for(var/atom/A in world) + if(istype(A,type_path)) + count++ + /* + var/atom/temp_atom + for(var/i = 0; i <= (atom_list.len/10); i++) + var/line = "" + for(var/j = 1; j <= 10; j++) + if(i*10+j <= atom_list.len) + temp_atom = atom_list[i*10+j] + line += " no.[i+10+j]@\[[temp_atom.x], [temp_atom.y], [temp_atom.z]\]; " + world << line*/ + + world << "There are [count] objects of type [type_path] in the game world" \ No newline at end of file