Merge pull request #11729 from Ghommie/Ghommie-cit666
Ports the VV Refactor by Kevinz.
This commit is contained in:
@@ -213,9 +213,78 @@
|
||||
|
||||
/obj/vv_get_dropdown()
|
||||
. = ..()
|
||||
.["Delete all of type"] = "?_src_=vars;[HrefToken()];delall=[REF(src)]"
|
||||
.["Osay"] = "?_src_=vars;[HrefToken()];osay[REF(src)]"
|
||||
.["Modify armor values"] = "?_src_=vars;[HrefToken()];modarmor=[REF(src)]"
|
||||
VV_DROPDOWN_OPTION("", "---")
|
||||
VV_DROPDOWN_OPTION(VV_HK_MASS_DEL_TYPE, "Delete all of type")
|
||||
VV_DROPDOWN_OPTION(VV_HK_OSAY, "Object Say")
|
||||
VV_DROPDOWN_OPTION(VV_HK_ARMOR_MOD, "Modify armor values")
|
||||
|
||||
/obj/vv_do_topic(list/href_list)
|
||||
if(!(. = ..()))
|
||||
return
|
||||
if(href_list[VV_HK_OSAY])
|
||||
if(check_rights(R_FUN, FALSE))
|
||||
usr.client.object_say(src)
|
||||
if(href_list[VV_HK_ARMOR_MOD])
|
||||
var/list/pickerlist = list()
|
||||
var/list/armorlist = armor.getList()
|
||||
|
||||
for (var/i in armorlist)
|
||||
pickerlist += list(list("value" = armorlist[i], "name" = i))
|
||||
|
||||
var/list/result = presentpicker(usr, "Modify armor", "Modify armor: [src]", Button1="Save", Button2 = "Cancel", Timeout=FALSE, inputtype = "text", values = pickerlist)
|
||||
|
||||
if (islist(result))
|
||||
if (result["button"] != 2) // If the user pressed the cancel button
|
||||
// text2num conveniently returns a null on invalid values
|
||||
armor = armor.setRating(melee = text2num(result["values"]["melee"]),\
|
||||
bullet = text2num(result["values"]["bullet"]),\
|
||||
laser = text2num(result["values"]["laser"]),\
|
||||
energy = text2num(result["values"]["energy"]),\
|
||||
bomb = text2num(result["values"]["bomb"]),\
|
||||
bio = text2num(result["values"]["bio"]),\
|
||||
rad = text2num(result["values"]["rad"]),\
|
||||
fire = text2num(result["values"]["fire"]),\
|
||||
acid = text2num(result["values"]["acid"]))
|
||||
log_admin("[key_name(usr)] modified the armor on [src] ([type]) to melee: [armor.melee], bullet: [armor.bullet], laser: [armor.laser], energy: [armor.energy], bomb: [armor.bomb], bio: [armor.bio], rad: [armor.rad], fire: [armor.fire], acid: [armor.acid]")
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] modified the armor on [src] ([type]) to melee: [armor.melee], bullet: [armor.bullet], laser: [armor.laser], energy: [armor.energy], bomb: [armor.bomb], bio: [armor.bio], rad: [armor.rad], fire: [armor.fire], acid: [armor.acid]</span>")
|
||||
if(href_list[VV_HK_MASS_DEL_TYPE])
|
||||
if(check_rights(R_DEBUG|R_SERVER))
|
||||
var/action_type = alert("Strict type ([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 [type]?",,"Yes","No") != "Yes")
|
||||
return
|
||||
|
||||
if(alert("Second confirmation required. Delete?",,"Yes","No") != "Yes")
|
||||
return
|
||||
|
||||
var/O_type = type
|
||||
switch(action_type)
|
||||
if("Strict type")
|
||||
var/i = 0
|
||||
for(var/obj/Obj in world)
|
||||
if(Obj.type == O_type)
|
||||
i++
|
||||
qdel(Obj)
|
||||
CHECK_TICK
|
||||
if(!i)
|
||||
to_chat(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("<span class='notice'>[key_name(usr)] deleted all objects of type [O_type] ([i] objects deleted) </span>")
|
||||
if("Type and subtypes")
|
||||
var/i = 0
|
||||
for(var/obj/Obj in world)
|
||||
if(istype(Obj,O_type))
|
||||
i++
|
||||
qdel(Obj)
|
||||
CHECK_TICK
|
||||
if(!i)
|
||||
to_chat(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("<span class='notice'>[key_name(usr)] deleted all objects of type or subtype of [O_type] ([i] objects deleted) </span>")
|
||||
|
||||
/obj/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
Reference in New Issue
Block a user