From c0c7f7482cb2b61ac3dc3e495f515cd0081967c9 Mon Sep 17 00:00:00 2001 From: "baloh.matevz" Date: Wed, 21 Sep 2011 22:17:55 +0000 Subject: [PATCH] - All edit var and mass edit var inputs now have cancel buttons - And when I say all I mean all except for when you want to add to lists, those don't have cancel buttons because those procs are confusing. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2246 316c924e-a436-60f5-8080-3fe189b3f50e --- code/modules/admin/verbs/massmodvar.dm | 28 +++++++---- code/modules/admin/verbs/modifyvariables.dm | 55 ++++++++++++--------- 2 files changed, 49 insertions(+), 34 deletions(-) diff --git a/code/modules/admin/verbs/massmodvar.dm b/code/modules/admin/verbs/massmodvar.dm index be19c13e14a..33589208732 100644 --- a/code/modules/admin/verbs/massmodvar.dm +++ b/code/modules/admin/verbs/massmodvar.dm @@ -7,13 +7,15 @@ if(A && A.type) if(typesof(A.type)) - switch(input("Strict object type detection?") in list("Strictly this type","This type and subtypes", "Cancel")) + switch(input("Strict object type detection?") as null|anything in list("Strictly this type","This type and subtypes", "Cancel")) if("Strictly this type") method = 0 if("This type and subtypes") method = 1 if("Cancel") return + if(null) + return src.massmodify_variables(A, var_name, method) @@ -164,8 +166,9 @@ return .(O.vars[variable]) if("text") - O.vars[variable] = input("Enter new text:","Text",\ - O.vars[variable]) as text + var/new_value = input("Enter new text:","Text",O.vars[variable]) as text|null + if(new_value == null) return + O.vars[variable] = new_value if(method) if(istype(O, /mob)) @@ -200,7 +203,8 @@ if("num") var/new_value = input("Enter new number:","Num",\ - O.vars[variable]) as num + O.vars[variable]) as num|null + if(new_value == null) return if(variable=="luminosity") O.sd_SetLuminosity(new_value) @@ -258,8 +262,10 @@ A.vars[variable] = O.vars[variable] if("type") - O.vars[variable] = input("Enter type:","Type",O.vars[variable]) \ - in typesof(/obj,/mob,/area,/turf) + var/new_value + new_value = input("Enter type:","Type",O.vars[variable]) as null|anything in typesof(/obj,/mob,/area,/turf) + if(new_value == null) return + O.vars[variable] = new_value if(method) if(istype(O, /mob)) for(var/mob/M in world) @@ -292,8 +298,9 @@ A.vars[variable] = O.vars[variable] if("file") - O.vars[variable] = input("Pick file:","File",O.vars[variable]) \ - as file + var/new_value = input("Pick file:","File",O.vars[variable]) as null|file + if(new_value == null) return + O.vars[variable] = new_value if(method) if(istype(O, /mob)) @@ -327,8 +334,9 @@ A.vars[variable] = O.vars[variable] if("icon") - O.vars[variable] = input("Pick icon:","Icon",O.vars[variable]) \ - as icon + var/new_value = input("Pick icon:","Icon",O.vars[variable]) as null|icon + if(new_value == null) return + O.vars[variable] = new_value if(method) if(istype(O, /mob)) for(var/mob/M in world) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index bead10ea4df..219d76ec20b 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -34,25 +34,25 @@ switch(class) if("text") - var_value = input("Enter new text:","Text") as text + var_value = input("Enter new text:","Text") as null|text if("num") - var_value = input("Enter new number:","Num") as num + var_value = input("Enter new number:","Num") as null|num if("type") - var_value = input("Enter type:","Type") in typesof(/obj,/mob,/area,/turf) + var_value = input("Enter type:","Type") as null|anything in typesof(/obj,/mob,/area,/turf) if("reference") - var_value = input("Select reference:","Reference") as mob|obj|turf|area in world + var_value = input("Select reference:","Reference") as null|mob|obj|turf|area in world if("mob reference") - var_value = input("Select reference:","Reference") as mob in world + var_value = input("Select reference:","Reference") as null|mob in world if("file") - var_value = input("Pick file:","File") as file + var_value = input("Pick file:","File") as null|file if("icon") - var_value = input("Pick icon:","Icon") as icon + var_value = input("Pick icon:","Icon") as null|icon if("marked datum") var_value = holder.marked_datum @@ -444,37 +444,44 @@ return .(O.vars[variable]) if("text") - O.vars[variable] = input("Enter new text:","Text",\ - O.vars[variable]) as text + var/var_new = input("Enter new text:","Text",O.vars[variable]) as null|text + if(var_new==null) return + O.vars[variable] = var_new if("num") if(variable=="luminosity") - var/new_value = input("Enter new number:","Num",\ - O.vars[variable]) as num - O.sd_SetLuminosity(new_value) + var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num + if(var_new == null) return + O.sd_SetLuminosity(var_new) else - O.vars[variable] = input("Enter new number:","Num",\ - O.vars[variable]) as num + var/var_new = input("Enter new number:","Num",O.vars[variable]) as null|num + if(var_new==null) return + O.vars[variable] = var_new if("type") - O.vars[variable] = input("Enter type:","Type",O.vars[variable]) \ - in typesof(/obj,/mob,/area,/turf) + var/var_new = input("Enter type:","Type",O.vars[variable]) as null|anything in typesof(/obj,/mob,/area,/turf) + if(var_new==null) return + O.vars[variable] = var_new if("reference") - O.vars[variable] = input("Select reference:","Reference",\ - O.vars[variable]) as mob|obj|turf|area in world + var/var_new = input("Select reference:","Reference",O.vars[variable]) as null|mob|obj|turf|area in world + if(var_new==null) return + O.vars[variable] = var_new if("mob reference") - O.vars[variable] = input("Select reference:","Reference",\ - O.vars[variable]) as mob in world + var/var_new = input("Select reference:","Reference",O.vars[variable]) as null|mob in world + if(var_new==null) return + O.vars[variable] = var_new if("file") - O.vars[variable] = input("Pick file:","File",O.vars[variable]) \ - as file + var/var_new = input("Pick file:","File",O.vars[variable]) as null|file + if(var_new==null) return + O.vars[variable] = var_new if("icon") - O.vars[variable] = input("Pick icon:","Icon",O.vars[variable]) \ - as icon + var/var_new = input("Pick icon:","Icon",O.vars[variable]) as null|icon + if(var_new==null) return + O.vars[variable] = var_new if("marked datum") O.vars[variable] = holder.marked_datum