From 465049855eb352805cdae54ee7caf82956126856 Mon Sep 17 00:00:00 2001 From: mochi Date: Mon, 29 Jun 2020 01:16:52 +0200 Subject: [PATCH] Add ability to VV an object's armor easily --- code/datums/datumvars.dm | 53 +++++++++++++++++++++++++++++++++++++++ code/game/objects/objs.dm | 1 + 2 files changed, 54 insertions(+) diff --git a/code/datums/datumvars.dm b/code/datums/datumvars.dm index b2b09003934..e8d0b881ccb 100644 --- a/code/datums/datumvars.dm +++ b/code/datums/datumvars.dm @@ -819,6 +819,59 @@ message_admins("[key_name(usr)] has made [A] process normally") return TRUE + else if(href_list["modifyarmor"]) + if(!check_rights(R_DEBUG|R_ADMIN)) + return + var/obj/A = locateUID(href_list["modifyarmor"]) + if(!istype(A)) + return + A.var_edited = TRUE + var/list/armorlist = A.armor.getList() + var/list/displaylist + + var/result + do + displaylist = list() + for(var/key in armorlist) + displaylist += "[key] = [armorlist[key]]" + result = input(usr, "Select an armor type to modify..", "Modify armor") as null|anything in displaylist + "(ADD ALL)" + "(SET ALL)" + "(DONE)" + + if(result == "(DONE)") + break + else if(result == "(ADD ALL)" || result == "(SET ALL)") + var/new_amount = input(usr, result == "(ADD ALL)" ? "Enter armor to add to all types:" : "Enter new armor value for all types:", "Modify all types") as num|null + if(isnull(new_amount)) + continue + var/proper_amount = text2num(new_amount) + if(isnull(proper_amount)) + continue + for(var/key in armorlist) + armorlist[key] = (result == "(ADD ALL)" ? armorlist[key] : 0) + proper_amount + else if(result) + var/list/fields = splittext(result, " = ") + if(length(fields) != 2) + continue + var/type = fields[1] + if(isnull(armorlist[type])) + continue + var/new_amount = input(usr, "Enter new armor value for [type]:", "Modify [type]") as num|null + if(isnull(new_amount)) + continue + var/proper_amount = text2num(new_amount) + if(isnull(proper_amount)) + continue + armorlist[type] = proper_amount + while(result) + + if(!result || !A) + return TRUE + + A.armor = A.armor.setRating(armorlist["melee"], armorlist["bullet"], armorlist["laser"], armorlist["energy"], armorlist["bomb"], armorlist["bio"], armorlist["rad"], armorlist["fire"], armorlist["acid"], armorlist["magic"]) + + log_admin("[key_name(usr)] modified the armor on [A] to: melee = [armorlist["melee"]], bullet = [armorlist["bullet"]], laser = [armorlist["laser"]], energy = [armorlist["energy"]], bomb = [armorlist["bomb"]], bio = [armorlist["bio"]], rad = [armorlist["rad"]], fire = [armorlist["fire"]], acid = [armorlist["acid"]], magic = [armorlist["magic"]]") + message_admins("[key_name(usr)] modified the armor on [A] to: melee = [armorlist["melee"]], bullet = [armorlist["bullet"]], laser = [armorlist["laser"]], energy = [armorlist["energy"]], bomb = [armorlist["bomb"]], bio = [armorlist["bio"]], rad = [armorlist["rad"]], fire = [armorlist["fire"]], acid = [armorlist["acid"]], magic = [armorlist["magic"]]") + return TRUE + else if(href_list["addreagent"]) /* Made on /TG/, credit to them. */ if(!check_rights(R_DEBUG|R_ADMIN)) return diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 43244c470ff..d40c628ed90 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -347,6 +347,7 @@ a { .["Make speed process"] = "?_src_=vars;makespeedy=[UID()]" else .["Make normal process"] = "?_src_=vars;makenormalspeed=[UID()]" + .["Modify armor values"] = "?_src_=vars;modifyarmor=[UID()]" /obj/proc/check_uplink_validity() return TRUE