From 5ae69c25e63aa004037a9f64082b182d37f04fad Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Thu, 12 Dec 2013 23:22:11 +0300 Subject: [PATCH 1/6] VV now allows read-only stuff without edit perm Also removes links you do not have permissions to use --- code/datums/datumvars.dm | 270 +++++++++++++++++++++++---------------- 1 file changed, 159 insertions(+), 111 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 7f25b86cb5b..fe8fbebc845 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -1,4 +1,3 @@ - // reference: /client/proc/modify_variables(var/atom/O, var/param_var_name = null, var/autodetect_class = 0) client @@ -173,27 +172,56 @@ client if(istype(D,/atom)) var/atom/A = D if(isliving(A)) - body += "[D]" - if(A.dir) - body += "
<< [dir2text(A.dir)] >>" - var/mob/living/M = A - body += "
[M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" - body += {" -
- BRUTE:[M.getBruteLoss()] - FIRE:[M.getFireLoss()] - TOXIN:[M.getToxLoss()] - OXY:[M.getOxyLoss()] - CLONE:[M.getCloneLoss()] - BRAIN:[M.getBrainLoss()] - + if(check_rights(R_VAREDIT)) + body += "[D]" + if(A.dir) + body += "
<< [dir2text(A.dir)] >>" + var/mob/living/M = A + body += "
[M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" + body += {" +
+ BRUTE:[M.getBruteLoss()] + FIRE:[M.getFireLoss()] + TOXIN:[M.getToxLoss()] + OXY:[M.getOxyLoss()] + CLONE:[M.getCloneLoss()] + BRAIN:[M.getBrainLoss()] + - "} + "} + + else + body += "[D]" + if(A.dir) + body += "
<<[dir2text(A.dir)]>>" + var/mob/living/M = A + body += "
[M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" + body += {" +
+ BRUTE:[M.getBruteLoss()] + FIRE:[M.getFireLoss()] + TOXIN:[M.getToxLoss()] + OXY:[M.getOxyLoss()] + CLONE:[M.getCloneLoss()] + BRAIN:[M.getBrainLoss()] + + + + "} + else - body += "[D]" - if(A.dir) - body += "
<< [dir2text(A.dir)] >>" + if(check_rights(R_VAREDIT)) + body += "[D]" + if(A.dir) + body += "
<< [dir2text(A.dir)] >>" + + else + body += "[D]" + if(A.dir) + body += "
<<[dir2text(A.dir)]>>" + + else body += "[D]" @@ -240,42 +268,58 @@ client body += "" if(ismob(D)) body += "" - - body += "" - - if(ismob(D)) - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" body += "" - if(ishuman(D)) + if(check_rights(R_REJUVINATE)) + body += "" + + + + + if(check_rights(R_VAREDIT)) + if(ismob(D)) body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - if(isobj(D)) - body += "" - if(isobj(D) || ismob(D) || isturf(D)) - body += "" - body += "" + body += "" + body += "" + body += "" + body += "" + if(check_rights(R_BUILDMODE)) + body += "" + + if(check_rights(R_FUN)) + body += "" + body += "" + body += "" + + if(ishuman(D)) + if(check_rights(R_SPAWN)) + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + + + if(isobj(D) || ismob(D) || isturf(D)) + if(check_rights(R_FUN)) + body += "" + body += "" + body += "" + + if(isobj(D)) + if(check_rights(R_DEBUG|R_SERVER)) + body += "" + body += "" + body += "" body += "
" - - body += "E - Edit, tries to determine the variable type by itself.
" - body += "C - Change, asks you for the var type first.
" - body += "M - Mass modify: changes this variable for all objects of this type.

" + if(check_rights(R_VAREDIT)) + body += "E - Edit, tries to determine the variable type by itself.
" + body += "C - Change, asks you for the var type first.
" + body += "M - Mass modify: changes this variable for all objects of this type.

" body += "
Search:

" @@ -326,7 +370,7 @@ client proc/debug_variable(name, value, level, var/datum/DA = null) var/html = "" - if(DA) + if(DA & check_rights(R_VAREDIT)) html += "
  • (E) (C) (M) " else html += "
  • " @@ -402,12 +446,63 @@ client //This should all be moved over to datum/admins/Topic() or something ~Carn if( (usr.client != src) || !src.holder ) return - if(!check_rights(R_VAREDIT)) - return if(href_list["Vars"]) debug_variables(locate(href_list["Vars"])) //~CARN: for renaming mobs (updates their name, real_name, mind.name, their ID/PDA and datacore records). + + if(href_list["datumrefresh"]) + var/datum/DAT = locate(href_list["datumrefresh"]) + if(!istype(DAT, /datum)) + return + src.debug_variables(DAT) + + else if(href_list["mob_player_panel"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["mob_player_panel"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.holder.show_player_panel(M) + href_list["datumrefresh"] = href_list["mob_player_panel"] + + else if(href_list["godmode"]) + if(!check_rights(R_REJUVINATE)) return + + var/mob/M = locate(href_list["godmode"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.cmd_admin_godmode(M) + href_list["datumrefresh"] = href_list["godmode"] + + else if(href_list["mark_object"]) + if(!check_rights(0)) return + + var/datum/D = locate(href_list["mark_object"]) + if(!istype(D)) + usr << "This can only be done to instances of type /datum" + return + + src.holder.marked_datum = D + href_list["datumrefresh"] = href_list["mark_object"] + + else if(href_list["regenerateicons"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["regenerateicons"]) + if(!ismob(M)) + usr << "This can only be done to instances of type /mob" + return + M.regenerate_icons() + +//Needs +VAREDIT past this point + + if(!check_rights(R_VAREDIT)) return + else if(href_list["rename"]) if(!check_rights(0)) return @@ -453,17 +548,6 @@ client cmd_mass_modify_object_variables(A, href_list["varnamemass"]) - else if(href_list["mob_player_panel"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["mob_player_panel"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.holder.show_player_panel(M) - href_list["datumrefresh"] = href_list["mob_player_panel"] - else if(href_list["give_spell"]) if(!check_rights(0)) return @@ -487,7 +571,7 @@ client href_list["datumrefresh"] = href_list["give_spell"] else if(href_list["ninja"]) - if(!check_rights(0)) return + if(!check_rights(R_FUN)) return var/mob/M = locate(href_list["ninja"]) if(!istype(M)) @@ -497,19 +581,8 @@ client src.cmd_admin_ninjafy(M) href_list["datumrefresh"] = href_list["ninja"] - else if(href_list["godmode"]) - if(!check_rights(R_REJUVINATE)) return - - var/mob/M = locate(href_list["godmode"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.cmd_admin_godmode(M) - href_list["datumrefresh"] = href_list["godmode"] - else if(href_list["gib"]) - if(!check_rights(0)) return + if(!check_rights(R_FUN)) return var/mob/M = locate(href_list["gib"]) if(!istype(M)) @@ -552,7 +625,7 @@ client usr.client.cmd_assume_direct_control(M) else if(href_list["make_skeleton"]) - if(!check_rights(0)) return + if(!check_rights(R_FUN)) return var/mob/living/carbon/human/H = locate(href_list["make_skeleton"]) if(!istype(H)) @@ -606,7 +679,7 @@ client message_admins("\blue [key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") else if(href_list["explode"]) - if(!check_rights(0)) return + if(!check_rights(R_FUN)) return var/atom/A = locate(href_list["explode"]) if(!isobj(A) && !ismob(A) && !isturf(A)) @@ -617,7 +690,7 @@ client href_list["datumrefresh"] = href_list["explode"] else if(href_list["emp"]) - if(!check_rights(0)) return + if(!check_rights(R_FUN)) return var/atom/A = locate(href_list["emp"]) if(!isobj(A) && !ismob(A) && !isturf(A)) @@ -627,17 +700,6 @@ client src.cmd_admin_emp(A) href_list["datumrefresh"] = href_list["emp"] - else if(href_list["mark_object"]) - if(!check_rights(0)) return - - var/datum/D = locate(href_list["mark_object"]) - if(!istype(D)) - usr << "This can only be done to instances of type /datum" - return - - src.holder.marked_datum = D - href_list["datumrefresh"] = href_list["mark_object"] - else if(href_list["rotatedatum"]) if(!check_rights(0)) return @@ -652,7 +714,7 @@ client href_list["datumrefresh"] = href_list["rotatedatum"] else if(href_list["makehuman"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/monkey/Mo = locate(href_list["makehuman"]) if(!istype(Mo)) @@ -666,7 +728,7 @@ client holder.Topic(href, list("humanone"=href_list["makehuman"])) else if(href_list["makemonkey"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["makemonkey"]) if(!istype(H)) @@ -680,7 +742,7 @@ client holder.Topic(href, list("monkeyone"=href_list["makemonkey"])) else if(href_list["makerobot"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["makerobot"]) if(!istype(H)) @@ -694,7 +756,7 @@ client holder.Topic(href, list("makerobot"=href_list["makerobot"])) else if(href_list["makealien"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["makealien"]) if(!istype(H)) @@ -708,7 +770,7 @@ client holder.Topic(href, list("makealien"=href_list["makealien"])) else if(href_list["makeslime"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["makeslime"]) if(!istype(H)) @@ -722,7 +784,7 @@ client holder.Topic(href, list("makeslime"=href_list["makeslime"])) else if(href_list["makeai"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["makeai"]) if(!istype(H)) @@ -736,7 +798,7 @@ client holder.Topic(href, list("makeai"=href_list["makeai"])) else if(href_list["setmutantrace"]) - if(!check_rights(0)) return + if(!check_rights(R_SPAWN)) return var/mob/living/carbon/human/H = locate(href_list["setmutantrace"]) if(!istype(H)) @@ -755,15 +817,6 @@ client H.update_body() H.update_hair() - else if(href_list["regenerateicons"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["regenerateicons"]) - if(!ismob(M)) - usr << "This can only be done to instances of type /mob" - return - M.regenerate_icons() - else if(href_list["adjustDamage"] && href_list["mobToDamage"]) if(!check_rights(0)) return @@ -794,11 +847,6 @@ client message_admins("\blue [key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") href_list["datumrefresh"] = href_list["mobToDamage"] - if(href_list["datumrefresh"]) - var/datum/DAT = locate(href_list["datumrefresh"]) - if(!istype(DAT, /datum)) - return - src.debug_variables(DAT) return From 17f6441f5e31b6fc2c39da068c629f333c300c46 Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Thu, 12 Dec 2013 23:32:48 +0300 Subject: [PATCH 2/6] Oops --- code/datums/datumvars.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index fe8fbebc845..ad6a74a8997 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -370,7 +370,7 @@ client proc/debug_variable(name, value, level, var/datum/DA = null) var/html = "" - if(DA & check_rights(R_VAREDIT)) + if(DA && check_rights(R_VAREDIT)) html += "
  • (E) (C) (M) " else html += "
  • " From 193656347fbe0c6aeb71f4d1bd2b2573752f463b Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Thu, 12 Dec 2013 23:49:15 +0300 Subject: [PATCH 3/6] Oh that's how it works --- code/datums/datumvars.dm | 704 +++++++++++++++++++-------------------- 1 file changed, 352 insertions(+), 352 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index ad6a74a8997..2a5e9d84fe3 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -172,7 +172,7 @@ client if(istype(D,/atom)) var/atom/A = D if(isliving(A)) - if(check_rights(R_VAREDIT)) + if(check_rights(R_VAREDIT,0)) body += "[D]" if(A.dir) body += "
    << [dir2text(A.dir)] >>" @@ -211,7 +211,7 @@ client "} else - if(check_rights(R_VAREDIT)) + if(check_rights(R_VAREDIT,0)) body += "[D]" if(A.dir) body += "
    << [dir2text(A.dir)] >>" @@ -269,29 +269,29 @@ client if(ismob(D)) body += "" body += "" - if(check_rights(R_REJUVINATE)) + if(check_rights(R_REJUVINATE,0)) body += "" - if(check_rights(R_VAREDIT)) + if(check_rights(R_VAREDIT,0)) if(ismob(D)) body += "" body += "" body += "" body += "" body += "" - if(check_rights(R_BUILDMODE)) + if(check_rights(R_BUILDMODE,0)) body += "" - if(check_rights(R_FUN)) + if(check_rights(R_FUN,0)) body += "" body += "" body += "" if(ishuman(D)) - if(check_rights(R_SPAWN)) + if(check_rights(R_SPAWN,0)) body += "" body += "" body += "" @@ -302,13 +302,13 @@ client if(isobj(D) || ismob(D) || isturf(D)) - if(check_rights(R_FUN)) + if(check_rights(R_FUN,0)) body += "" body += "" body += "" if(isobj(D)) - if(check_rights(R_DEBUG|R_SERVER)) + if(check_rights(R_DEBUG|R_SERVER,0)) body += "" body += "" @@ -316,7 +316,7 @@ client body += "" body += "
    " - if(check_rights(R_VAREDIT)) + if(check_rights(R_VAREDIT,0)) body += "E - Edit, tries to determine the variable type by itself.
    " body += "C - Change, asks you for the var type first.
    " body += "M - Mass modify: changes this variable for all objects of this type.

    " @@ -370,7 +370,7 @@ client proc/debug_variable(name, value, level, var/datum/DA = null) var/html = "" - if(DA && check_rights(R_VAREDIT)) + if(DA && check_rights(R_VAREDIT,0)) html += "
  • (E) (C) (M) " else html += "
  • " @@ -501,351 +501,351 @@ client //Needs +VAREDIT past this point - if(!check_rights(R_VAREDIT)) return + if(check_rights(R_VAREDIT,0)) - else if(href_list["rename"]) - if(!check_rights(0)) return + if(href_list["rename"]) + if(!check_rights(0)) return - var/mob/M = locate(href_list["rename"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null),1,MAX_NAME_LEN) - if( !new_name || !M ) return - - message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].") - M.fully_replace_character_name(M.real_name,new_name) - href_list["datumrefresh"] = href_list["rename"] - - else if(href_list["varnameedit"] && href_list["datumedit"]) - if(!check_rights(0)) return - - var/D = locate(href_list["datumedit"]) - if(!istype(D,/datum) && !istype(D,/client)) - usr << "This can only be used on instances of types /client or /datum" - return - - modify_variables(D, href_list["varnameedit"], 1) - - else if(href_list["varnamechange"] && href_list["datumchange"]) - if(!check_rights(0)) return - - var/D = locate(href_list["datumchange"]) - if(!istype(D,/datum) && !istype(D,/client)) - usr << "This can only be used on instances of types /client or /datum" - return - - modify_variables(D, href_list["varnamechange"], 0) - - else if(href_list["varnamemass"] && href_list["datummass"]) - if(!check_rights(0)) return - - var/atom/A = locate(href_list["datummass"]) - if(!istype(A)) - usr << "This can only be used on instances of type /atom" - return - - cmd_mass_modify_object_variables(A, href_list["varnamemass"]) - - else if(href_list["give_spell"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["give_spell"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.give_spell(M) - href_list["datumrefresh"] = href_list["give_spell"] - - else if(href_list["give_disease"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["give_disease"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.give_disease(M) - href_list["datumrefresh"] = href_list["give_spell"] - - else if(href_list["ninja"]) - if(!check_rights(R_FUN)) return - - var/mob/M = locate(href_list["ninja"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.cmd_admin_ninjafy(M) - href_list["datumrefresh"] = href_list["ninja"] - - else if(href_list["gib"]) - if(!check_rights(R_FUN)) return - - var/mob/M = locate(href_list["gib"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - src.cmd_admin_gib(M) - - else if(href_list["build_mode"]) - if(!check_rights(R_BUILDMODE)) return - - var/mob/M = locate(href_list["build_mode"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - togglebuildmode(M) - href_list["datumrefresh"] = href_list["build_mode"] - - else if(href_list["drop_everything"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["drop_everything"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - if(usr.client) - usr.client.cmd_admin_drop_everything(M) - - else if(href_list["direct_control"]) - if(!check_rights(0)) return - - var/mob/M = locate(href_list["direct_control"]) - if(!istype(M)) - usr << "This can only be used on instances of type /mob" - return - - if(usr.client) - usr.client.cmd_assume_direct_control(M) - - else if(href_list["make_skeleton"]) - if(!check_rights(R_FUN)) return - - var/mob/living/carbon/human/H = locate(href_list["make_skeleton"]) - if(!istype(H)) - usr << "This can only be used on instances of type /mob/living/carbon/human" - return - - H.makeSkeleton() - href_list["datumrefresh"] = href_list["make_skeleton"] - - else if(href_list["delall"]) - if(!check_rights(R_DEBUG|R_SERVER)) return - - var/obj/O = locate(href_list["delall"]) - if(!isobj(O)) - usr << "This can only be used on instances of type /obj" - return - - var/action_type = alert("Strict type ([O.type]) or type and all subtypes?",,"Strict type","Type and subtypes","Cancel") - if(action_type == "Cancel" || !action_type) - return - - if(alert("Are you really sure you want to delete all objects of type [O.type]?",,"Yes","No") != "Yes") - return - - if(alert("Second confirmation required. Delete?",,"Yes","No") != "Yes") - return - - var/O_type = O.type - switch(action_type) - if("Strict type") - var/i = 0 - for(var/obj/Obj in world) - if(Obj.type == O_type) - i++ - del(Obj) - if(!i) - usr << "No objects of this type exist" - return - log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ") - message_admins("\blue [key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ") - if("Type and subtypes") - var/i = 0 - for(var/obj/Obj in world) - if(istype(Obj,O_type)) - i++ - del(Obj) - if(!i) - usr << "No objects of this type exist" - return - log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") - message_admins("\blue [key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") - - else if(href_list["explode"]) - if(!check_rights(R_FUN)) return - - var/atom/A = locate(href_list["explode"]) - if(!isobj(A) && !ismob(A) && !isturf(A)) - usr << "This can only be done to instances of type /obj, /mob and /turf" - return - - src.cmd_admin_explosion(A) - href_list["datumrefresh"] = href_list["explode"] - - else if(href_list["emp"]) - if(!check_rights(R_FUN)) return - - var/atom/A = locate(href_list["emp"]) - if(!isobj(A) && !ismob(A) && !isturf(A)) - usr << "This can only be done to instances of type /obj, /mob and /turf" - return - - src.cmd_admin_emp(A) - href_list["datumrefresh"] = href_list["emp"] - - else if(href_list["rotatedatum"]) - if(!check_rights(0)) return - - var/atom/A = locate(href_list["rotatedatum"]) - if(!istype(A)) - usr << "This can only be done to instances of type /atom" - return - - switch(href_list["rotatedir"]) - if("right") A.dir = turn(A.dir, -45) - if("left") A.dir = turn(A.dir, 45) - href_list["datumrefresh"] = href_list["rotatedatum"] - - else if(href_list["makehuman"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/monkey/Mo = locate(href_list["makehuman"]) - if(!istype(Mo)) - usr << "This can only be done to instances of type /mob/living/carbon/monkey" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!Mo) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("humanone"=href_list["makehuman"])) - - else if(href_list["makemonkey"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["makemonkey"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("monkeyone"=href_list["makemonkey"])) - - else if(href_list["makerobot"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["makerobot"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("makerobot"=href_list["makerobot"])) - - else if(href_list["makealien"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["makealien"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("makealien"=href_list["makealien"])) - - else if(href_list["makeslime"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["makeslime"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("makeslime"=href_list["makeslime"])) - - else if(href_list["makeai"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["makeai"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return - if(!H) - usr << "Mob doesn't exist anymore" - return - holder.Topic(href, list("makeai"=href_list["makeai"])) - - else if(href_list["setmutantrace"]) - if(!check_rights(R_SPAWN)) return - - var/mob/living/carbon/human/H = locate(href_list["setmutantrace"]) - if(!istype(H)) - usr << "This can only be done to instances of type /mob/living/carbon/human" - return - - var/new_mutantrace = input("Please choose a new mutantrace","Mutantrace",null) as null|anything in list("NONE","golem","lizard","slime","plant","shadow", "fly", "skeleton") - switch(new_mutantrace) - if(null) return - if("NONE") new_mutantrace = "" - if(!H) - usr << "Mob doesn't exist anymore" - return - if(H.dna) - H.dna.mutantrace = new_mutantrace - H.update_body() - H.update_hair() - - else if(href_list["adjustDamage"] && href_list["mobToDamage"]) - if(!check_rights(0)) return - - var/mob/living/L = locate(href_list["mobToDamage"]) - if(!istype(L)) return - - var/Text = href_list["adjustDamage"] - - var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num - - if(!L) - usr << "Mob doesn't exist anymore" - return - - switch(Text) - if("brute") L.adjustBruteLoss(amount) - if("fire") L.adjustFireLoss(amount) - if("toxin") L.adjustToxLoss(amount) - if("oxygen")L.adjustOxyLoss(amount) - if("brain") L.adjustBrainLoss(amount) - if("clone") L.adjustCloneLoss(amount) - else - usr << "You caused an error. DEBUG: Text:[Text] Mob:[L]" + var/mob/M = locate(href_list["rename"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" return - if(amount != 0) - log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") - message_admins("\blue [key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") - href_list["datumrefresh"] = href_list["mobToDamage"] + var/new_name = copytext(sanitize(input(usr,"What would you like to name this mob?","Input a name",M.real_name) as text|null),1,MAX_NAME_LEN) + if( !new_name || !M ) return + + message_admins("Admin [key_name_admin(usr)] renamed [key_name_admin(M)] to [new_name].") + M.fully_replace_character_name(M.real_name,new_name) + href_list["datumrefresh"] = href_list["rename"] + + else if(href_list["varnameedit"] && href_list["datumedit"]) + if(!check_rights(0)) return + + var/D = locate(href_list["datumedit"]) + if(!istype(D,/datum) && !istype(D,/client)) + usr << "This can only be used on instances of types /client or /datum" + return + + modify_variables(D, href_list["varnameedit"], 1) + + else if(href_list["varnamechange"] && href_list["datumchange"]) + if(!check_rights(0)) return + + var/D = locate(href_list["datumchange"]) + if(!istype(D,/datum) && !istype(D,/client)) + usr << "This can only be used on instances of types /client or /datum" + return + + modify_variables(D, href_list["varnamechange"], 0) + + else if(href_list["varnamemass"] && href_list["datummass"]) + if(!check_rights(0)) return + + var/atom/A = locate(href_list["datummass"]) + if(!istype(A)) + usr << "This can only be used on instances of type /atom" + return + + cmd_mass_modify_object_variables(A, href_list["varnamemass"]) + + else if(href_list["give_spell"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["give_spell"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.give_spell(M) + href_list["datumrefresh"] = href_list["give_spell"] + + else if(href_list["give_disease"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["give_disease"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.give_disease(M) + href_list["datumrefresh"] = href_list["give_spell"] + + else if(href_list["ninja"]) + if(!check_rights(R_FUN)) return + + var/mob/M = locate(href_list["ninja"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.cmd_admin_ninjafy(M) + href_list["datumrefresh"] = href_list["ninja"] + + else if(href_list["gib"]) + if(!check_rights(R_FUN)) return + + var/mob/M = locate(href_list["gib"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + src.cmd_admin_gib(M) + + else if(href_list["build_mode"]) + if(!check_rights(R_BUILDMODE)) return + + var/mob/M = locate(href_list["build_mode"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + togglebuildmode(M) + href_list["datumrefresh"] = href_list["build_mode"] + + else if(href_list["drop_everything"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["drop_everything"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + if(usr.client) + usr.client.cmd_admin_drop_everything(M) + + else if(href_list["direct_control"]) + if(!check_rights(0)) return + + var/mob/M = locate(href_list["direct_control"]) + if(!istype(M)) + usr << "This can only be used on instances of type /mob" + return + + if(usr.client) + usr.client.cmd_assume_direct_control(M) + + else if(href_list["make_skeleton"]) + if(!check_rights(R_FUN)) return + + var/mob/living/carbon/human/H = locate(href_list["make_skeleton"]) + if(!istype(H)) + usr << "This can only be used on instances of type /mob/living/carbon/human" + return + + H.makeSkeleton() + href_list["datumrefresh"] = href_list["make_skeleton"] + + else if(href_list["delall"]) + if(!check_rights(R_DEBUG|R_SERVER)) return + + var/obj/O = locate(href_list["delall"]) + if(!isobj(O)) + usr << "This can only be used on instances of type /obj" + return + + var/action_type = alert("Strict type ([O.type]) or type and all subtypes?",,"Strict type","Type and subtypes","Cancel") + if(action_type == "Cancel" || !action_type) + return + + if(alert("Are you really sure you want to delete all objects of type [O.type]?",,"Yes","No") != "Yes") + return + + if(alert("Second confirmation required. Delete?",,"Yes","No") != "Yes") + return + + var/O_type = O.type + switch(action_type) + if("Strict type") + var/i = 0 + for(var/obj/Obj in world) + if(Obj.type == O_type) + i++ + del(Obj) + if(!i) + usr << "No objects of this type exist" + return + log_admin("[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ") + message_admins("\blue [key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) ") + if("Type and subtypes") + var/i = 0 + for(var/obj/Obj in world) + if(istype(Obj,O_type)) + i++ + del(Obj) + if(!i) + usr << "No objects of this type exist" + return + log_admin("[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") + message_admins("\blue [key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) ") + + else if(href_list["explode"]) + if(!check_rights(R_FUN)) return + + var/atom/A = locate(href_list["explode"]) + if(!isobj(A) && !ismob(A) && !isturf(A)) + usr << "This can only be done to instances of type /obj, /mob and /turf" + return + + src.cmd_admin_explosion(A) + href_list["datumrefresh"] = href_list["explode"] + + else if(href_list["emp"]) + if(!check_rights(R_FUN)) return + + var/atom/A = locate(href_list["emp"]) + if(!isobj(A) && !ismob(A) && !isturf(A)) + usr << "This can only be done to instances of type /obj, /mob and /turf" + return + + src.cmd_admin_emp(A) + href_list["datumrefresh"] = href_list["emp"] + + else if(href_list["rotatedatum"]) + if(!check_rights(0)) return + + var/atom/A = locate(href_list["rotatedatum"]) + if(!istype(A)) + usr << "This can only be done to instances of type /atom" + return + + switch(href_list["rotatedir"]) + if("right") A.dir = turn(A.dir, -45) + if("left") A.dir = turn(A.dir, 45) + href_list["datumrefresh"] = href_list["rotatedatum"] + + else if(href_list["makehuman"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/monkey/Mo = locate(href_list["makehuman"]) + if(!istype(Mo)) + usr << "This can only be done to instances of type /mob/living/carbon/monkey" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!Mo) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("humanone"=href_list["makehuman"])) + + else if(href_list["makemonkey"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["makemonkey"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!H) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("monkeyone"=href_list["makemonkey"])) + + else if(href_list["makerobot"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["makerobot"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!H) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("makerobot"=href_list["makerobot"])) + + else if(href_list["makealien"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["makealien"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!H) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("makealien"=href_list["makealien"])) + + else if(href_list["makeslime"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["makeslime"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!H) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("makeslime"=href_list["makeslime"])) + + else if(href_list["makeai"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["makeai"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + if(alert("Confirm mob type change?",,"Transform","Cancel") != "Transform") return + if(!H) + usr << "Mob doesn't exist anymore" + return + holder.Topic(href, list("makeai"=href_list["makeai"])) + + else if(href_list["setmutantrace"]) + if(!check_rights(R_SPAWN)) return + + var/mob/living/carbon/human/H = locate(href_list["setmutantrace"]) + if(!istype(H)) + usr << "This can only be done to instances of type /mob/living/carbon/human" + return + + var/new_mutantrace = input("Please choose a new mutantrace","Mutantrace",null) as null|anything in list("NONE","golem","lizard","slime","plant","shadow", "fly", "skeleton") + switch(new_mutantrace) + if(null) return + if("NONE") new_mutantrace = "" + if(!H) + usr << "Mob doesn't exist anymore" + return + if(H.dna) + H.dna.mutantrace = new_mutantrace + H.update_body() + H.update_hair() + + else if(href_list["adjustDamage"] && href_list["mobToDamage"]) + if(!check_rights(0)) return + + var/mob/living/L = locate(href_list["mobToDamage"]) + if(!istype(L)) return + + var/Text = href_list["adjustDamage"] + + var/amount = input("Deal how much damage to mob? (Negative values here heal)","Adjust [Text]loss",0) as num + + if(!L) + usr << "Mob doesn't exist anymore" + return + + switch(Text) + if("brute") L.adjustBruteLoss(amount) + if("fire") L.adjustFireLoss(amount) + if("toxin") L.adjustToxLoss(amount) + if("oxygen")L.adjustOxyLoss(amount) + if("brain") L.adjustBrainLoss(amount) + if("clone") L.adjustCloneLoss(amount) + else + usr << "You caused an error. DEBUG: Text:[Text] Mob:[L]" + return + + if(amount != 0) + log_admin("[key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") + message_admins("\blue [key_name(usr)] dealt [amount] amount of [Text] damage to [L] ") + href_list["datumrefresh"] = href_list["mobToDamage"] return From 9412c6222497bf800bd449bfaba160d11e72c60f Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Fri, 13 Dec 2013 00:05:05 +0300 Subject: [PATCH 4/6] Final pass --- code/datums/datumvars.dm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index 2a5e9d84fe3..e2b6f49dc4a 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -194,7 +194,7 @@ client else body += "[D]" if(A.dir) - body += "
    <<[dir2text(A.dir)]>>" + body += "
    [dir2text(A.dir)]" var/mob/living/M = A body += "
    [M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" body += {" @@ -219,7 +219,7 @@ client else body += "[D]" if(A.dir) - body += "
    <<[dir2text(A.dir)]>>" + body += "
    [dir2text(A.dir)]" else @@ -449,8 +449,6 @@ client if(href_list["Vars"]) debug_variables(locate(href_list["Vars"])) - //~CARN: for renaming mobs (updates their name, real_name, mind.name, their ID/PDA and datacore records). - if(href_list["datumrefresh"]) var/datum/DAT = locate(href_list["datumrefresh"]) if(!istype(DAT, /datum)) @@ -503,6 +501,9 @@ client if(check_rights(R_VAREDIT,0)) + + //~CARN: for renaming mobs (updates their name, real_name, mind.name, their ID/PDA and datacore records). + if(href_list["rename"]) if(!check_rights(0)) return From c08fe3caf59a87d0b09055b0dd512cab0c0744ff Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Fri, 13 Dec 2013 01:16:56 +0400 Subject: [PATCH 5/6] Cleaning up --- code/datums/datumvars.dm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index e2b6f49dc4a..b53463e5c34 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -266,12 +266,13 @@ client body += "" + if(ismob(D)) body += "" body += "" if(check_rights(R_REJUVINATE,0)) body += "" - + @@ -284,7 +285,7 @@ client body += "" if(check_rights(R_BUILDMODE,0)) body += "" - + if(check_rights(R_FUN,0)) body += "" body += "" @@ -299,14 +300,14 @@ client body += "" body += "" body += "" - + if(isobj(D) || ismob(D) || isturf(D)) if(check_rights(R_FUN,0)) body += "" body += "" body += "" - + if(isobj(D)) if(check_rights(R_DEBUG|R_SERVER,0)) body += "" @@ -316,6 +317,7 @@ client body += "" body += "
    " + if(check_rights(R_VAREDIT,0)) body += "E - Edit, tries to determine the variable type by itself.
    " body += "C - Change, asks you for the var type first.
    " @@ -503,7 +505,7 @@ client //~CARN: for renaming mobs (updates their name, real_name, mind.name, their ID/PDA and datacore records). - + if(href_list["rename"]) if(!check_rights(0)) return From 72e8d36fe596fbf3976708e7d477f22d64c750eb Mon Sep 17 00:00:00 2001 From: Alek2ander Date: Fri, 13 Dec 2013 19:37:07 +0300 Subject: [PATCH 6/6] Reverted links getting disabled when client lacks permissions for them --- code/datums/datumvars.dm | 145 +++++++++++++-------------------------- 1 file changed, 49 insertions(+), 96 deletions(-) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index b53463e5c34..8982f59174e 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -172,56 +172,27 @@ client if(istype(D,/atom)) var/atom/A = D if(isliving(A)) - if(check_rights(R_VAREDIT,0)) - body += "[D]" - if(A.dir) - body += "
    << [dir2text(A.dir)] >>" - var/mob/living/M = A - body += "
    [M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" - body += {" -
    - BRUTE:[M.getBruteLoss()] - FIRE:[M.getFireLoss()] - TOXIN:[M.getToxLoss()] - OXY:[M.getOxyLoss()] - CLONE:[M.getCloneLoss()] - BRAIN:[M.getBrainLoss()] - + body += "[D]" + if(A.dir) + body += "
    << [dir2text(A.dir)] >>" + var/mob/living/M = A + body += "
    [M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" + body += {" +
    + BRUTE:[M.getBruteLoss()] + FIRE:[M.getFireLoss()] + TOXIN:[M.getToxLoss()] + OXY:[M.getOxyLoss()] + CLONE:[M.getCloneLoss()] + BRAIN:[M.getBrainLoss()] + - "} - - else - body += "[D]" - if(A.dir) - body += "
    [dir2text(A.dir)]" - var/mob/living/M = A - body += "
    [M.ckey ? M.ckey : "No ckey"] / [M.real_name ? M.real_name : "No real name"]" - body += {" -
    - BRUTE:[M.getBruteLoss()] - FIRE:[M.getFireLoss()] - TOXIN:[M.getToxLoss()] - OXY:[M.getOxyLoss()] - CLONE:[M.getCloneLoss()] - BRAIN:[M.getBrainLoss()] - - - - "} - + "} else - if(check_rights(R_VAREDIT,0)) - body += "[D]" - if(A.dir) - body += "
    << [dir2text(A.dir)] >>" - - else - body += "[D]" - if(A.dir) - body += "
    [dir2text(A.dir)]" - - + body += "[D]" + if(A.dir) + body += "
    << [dir2text(A.dir)] >>" else body += "[D]" @@ -266,62 +237,44 @@ client body += "" - if(ismob(D)) body += "" + + body += "" + + if(ismob(D)) + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" body += "" - if(check_rights(R_REJUVINATE,0)) - body += "" - - - - - if(check_rights(R_VAREDIT,0)) - if(ismob(D)) + if(ishuman(D)) body += "" - body += "" - body += "" - body += "" - body += "" - if(check_rights(R_BUILDMODE,0)) - body += "" - - if(check_rights(R_FUN,0)) - body += "" - body += "" - body += "" - - if(ishuman(D)) - if(check_rights(R_SPAWN,0)) - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - body += "" - - - if(isobj(D) || ismob(D) || isturf(D)) - if(check_rights(R_FUN,0)) - body += "" - body += "" - body += "" - - if(isobj(D)) - if(check_rights(R_DEBUG|R_SERVER,0)) - body += "" - body += "" - + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + body += "" + if(isobj(D)) + body += "" + if(isobj(D) || ismob(D) || isturf(D)) + body += "" + body += "" body += "" body += "
    " - if(check_rights(R_VAREDIT,0)) - body += "E - Edit, tries to determine the variable type by itself.
    " - body += "C - Change, asks you for the var type first.
    " - body += "M - Mass modify: changes this variable for all objects of this type.

    " + body += "E - Edit, tries to determine the variable type by itself.
    " + body += "C - Change, asks you for the var type first.
    " + body += "M - Mass modify: changes this variable for all objects of this type.

    " body += "
    Search:

    " @@ -372,7 +325,7 @@ client proc/debug_variable(name, value, level, var/datum/DA = null) var/html = "" - if(DA && check_rights(R_VAREDIT,0)) + if(DA) html += "
  • (E) (C) (M) " else html += "
  • " @@ -501,7 +454,7 @@ client //Needs +VAREDIT past this point - if(check_rights(R_VAREDIT,0)) + else if(check_rights(R_VAREDIT)) //~CARN: for renaming mobs (updates their name, real_name, mind.name, their ID/PDA and datacore records).