TGUIfies some VV actions, replaces the actions dropdown with a searchable one (#95480)

This commit is contained in:
SmArtKar
2026-03-29 21:47:29 -04:00
committed by GitHub
parent 1ee927a447
commit 11fbb59049
20 changed files with 274 additions and 227 deletions
+5 -5
View File
@@ -421,13 +421,13 @@ ADMIN_VERB(remove_spell, R_FUN, "Remove Spell", ADMIN_VERB_NO_DESCRIPTION, ADMIN
BLACKBOX_LOG_ADMIN_VERB("Remove Spell")
ADMIN_VERB(give_disease, R_FUN, "Give Disease", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, mob/living/victim)
var/datum/disease/D = input(user, "Choose the disease to give to that guy", "ACHOO") as null|anything in sort_list(SSdisease.diseases, GLOBAL_PROC_REF(cmp_typepaths_asc))
if(!D)
var/datum/disease/disease = tgui_input_list(user, "Choose the disease to give to that guy", "ACHOO", sort_list(SSdisease.diseases, GLOBAL_PROC_REF(cmp_typepaths_asc)))
if(!disease)
return
victim.ForceContractDisease(new D, FALSE, TRUE)
victim.ForceContractDisease(new disease, FALSE, TRUE)
BLACKBOX_LOG_ADMIN_VERB("Give Disease")
log_admin("[key_name(user)] gave [key_name(victim)] the disease [D].")
message_admins(span_adminnotice("[key_name_admin(user)] gave [key_name_admin(victim)] the disease [D]."))
log_admin("[key_name(user)] gave [key_name(victim)] the disease [disease].")
message_admins(span_adminnotice("[key_name_admin(user)] gave [key_name_admin(victim)] the disease [disease]."))
ADMIN_VERB_AND_CONTEXT_MENU(object_say, R_FUN, "OSay", ADMIN_VERB_NO_DESCRIPTION, ADMIN_CATEGORY_HIDDEN, obj/speaker in world)
var/message = tgui_input_text(user, "What do you want the message to be?", "Make Sound", encode = FALSE)
+8 -8
View File
@@ -181,7 +181,7 @@ ADMIN_VERB(cmd_give_direct_control, R_ADMIN, "Give Direct Control", "Give direct
if(M.ckey)
if(tgui_alert(user,"This mob is being controlled by [M.key]. Are you sure you wish to give someone else control of it? [M.key] will be made a ghost.",,list("Yes","No")) != "Yes")
return
var/client/newkey = input(user, "Pick the player to put in control.", "New player") as null|anything in sort_list(GLOB.clients)
var/client/newkey = tgui_input_list(user, "Pick the player to put in control.", "New player", sort_list(GLOB.clients))
if(isnull(newkey))
return
var/mob/oldmob = newkey.mob
@@ -413,7 +413,7 @@ ADMIN_VERB(cmd_admin_areatest_all, R_DEBUG, "Test Areas (ALL)", "Tests the areas
var/datum/outfit/O = path //not much to initalize here but whatever
outfits[initial(O.name)] = path
var/dresscode = input("Select outfit", "Robust quick dress shop") as null|anything in baseoutfits + sort_list(outfits)
var/dresscode = tgui_input_list(usr, "Select outfit", "Robust quick dress shop", baseoutfits + sort_list(outfits, GLOBAL_PROC_REF(cmp_typepaths_asc)))
if (isnull(dresscode))
return
@@ -427,7 +427,7 @@ ADMIN_VERB(cmd_admin_areatest_all, R_DEBUG, "Test Areas (ALL)", "Tests the areas
var/datum/outfit/O = path
job_outfits[initial(O.name)] = path
dresscode = input("Select job equipment", "Robust quick dress shop") as null|anything in sort_list(job_outfits)
dresscode = tgui_input_list(usr, "Select job equipment", "Robust quick dress shop", sort_list(job_outfits, GLOBAL_PROC_REF(cmp_typepaths_asc)))
dresscode = job_outfits[dresscode]
if(isnull(dresscode))
return
@@ -439,7 +439,7 @@ ADMIN_VERB(cmd_admin_areatest_all, R_DEBUG, "Test Areas (ALL)", "Tests the areas
var/datum/outfit/O = path
plasmaman_outfits[initial(O.name)] = path
dresscode = input("Select plasmeme equipment", "Robust quick dress shop") as null|anything in sort_list(plasmaman_outfits)
dresscode = tgui_input_list(usr, "Select plasmeme equipment", "Robust quick dress shop", sort_list(plasmaman_outfits, GLOBAL_PROC_REF(cmp_typepaths_asc)))
dresscode = plasmaman_outfits[dresscode]
if(isnull(dresscode))
return
@@ -448,7 +448,7 @@ ADMIN_VERB(cmd_admin_areatest_all, R_DEBUG, "Test Areas (ALL)", "Tests the areas
var/list/custom_names = list()
for(var/datum/outfit/D in GLOB.custom_outfits)
custom_names[D.name] = D
var/selected_name = input("Select outfit", "Robust quick dress shop") as null|anything in sort_list(custom_names)
var/selected_name = tgui_input_list(usr, "Select outfit", "Robust quick dress shop", sort_list(custom_names, GLOBAL_PROC_REF(cmp_typepaths_asc)))
dresscode = custom_names[selected_name]
if(isnull(dresscode))
return
@@ -621,12 +621,12 @@ ADMIN_VERB(place_ruin, R_DEBUG, "Spawn Ruin", "Attempt to randomly place a speci
return
var/datum/map_template/ruin/template = data[1]
if (exists[template])
var/response = tgui_alert(user,"There is already a [template] in existence.", "Spawn Ruin", list("Jump", "Place Another", "Cancel"))
var/response = tgui_alert(user,"There is already a [template] in existence.", "Spawn Ruin", list("Jump", "Place Another"))
if (!response)
return
if (response == "Jump")
user.mob.forceMove(get_turf(exists[template]))
return
else if (response == "Cancel")
return
var/len = GLOB.ruin_landmarks.len
seedRuins(SSmapping.levels_by_trait(data[2]), max(1, template.cost), data[3], list(ruinname = template))
@@ -8,7 +8,7 @@
set category = "Debug"
var/list/infusions = list()
for(var/datum/infuser_entry/path as anything in subtypesof(/datum/infuser_entry))
for(var/datum/infuser_entry/path as anything in sort_list(subtypesof(/datum/infuser_entry), GLOBAL_PROC_REF(cmp_typepaths_asc)))
var/str = "[initial(path.name)] ([path])"
infusions[str] = path
@@ -1,13 +1,14 @@
ADMIN_VERB_VISIBILITY(manipulate_organs, ADMIN_VERB_VISIBLITY_FLAG_MAPPING_DEBUG)
ADMIN_VERB(manipulate_organs, R_DEBUG, "Manipulate Organs", "Manipulate the organs of a living carbon.", ADMIN_CATEGORY_DEBUG, mob/living/carbon/carbon_victim in world)
var/operation = tgui_input_list(user, "Select organ operation", "Organ Manipulation", list("add organ", "add implant", "drop organ/implant", "remove organ/implant"))
var/operation = tgui_input_list(user, "Select organ operation", "Organ Manipulation", list("Add organ", "Add implant", "Drop organ/implant", "Remove organ/implant"))
if (isnull(operation))
return
var/list/organs = list()
switch(operation)
if("add organ")
for(var/path in subtypesof(/obj/item/organ))
if("Add organ")
// BYOND actually cares about order of addition in assoc lists, as long as its not an alist
for(var/path in sort_list(subtypesof(/obj/item/organ), GLOBAL_PROC_REF(cmp_typepaths_asc)))
var/dat = replacetext("[path]", "/obj/item/organ/", ":")
organs[dat] = path
@@ -22,8 +23,8 @@ ADMIN_VERB(manipulate_organs, R_DEBUG, "Manipulate Organs", "Manipulate the orga
log_admin("[key_name(user)] has added organ [organ_to_grant.type] to [key_name(carbon_victim)]")
message_admins("[key_name_admin(user)] has added organ [organ_to_grant.type] to [ADMIN_LOOKUPFLW(carbon_victim)]")
if("add implant")
for(var/path in subtypesof(/obj/item/implant))
if("Add implant")
for(var/path in sort_list(subtypesof(/obj/item/implant), GLOBAL_PROC_REF(cmp_typepaths_asc)))
var/dat = replacetext("[path]", "/obj/item/implant/", ":")
organs[dat] = path
@@ -41,7 +42,7 @@ ADMIN_VERB(manipulate_organs, R_DEBUG, "Manipulate Organs", "Manipulate the orga
log_admin("[key_name(user)] has added implant [implant_to_grant.type] to [key_name(carbon_victim)]")
message_admins("[key_name_admin(user)] has added implant [implant_to_grant.type] to [ADMIN_LOOKUPFLW(carbon_victim)]")
if("drop organ/implant", "remove organ/implant")
if("Drop organ/implant", "Remove organ/implant")
for(var/obj/item/organ/user_organs as anything in carbon_victim.organs)
organs["[user_organs.name] ([user_organs.type])"] = user_organs
@@ -70,7 +71,7 @@ ADMIN_VERB(manipulate_organs, R_DEBUG, "Manipulate Organs", "Manipulate the orga
organ_to_modify.forceMove(get_turf(carbon_victim))
if(operation == "remove organ/implant")
if(operation == "Remove organ/implant")
qdel(organ_to_modify)
else if(implant_holder) // Put the implant in case.
var/obj/item/implantcase/case = new(get_turf(carbon_victim))
@@ -68,7 +68,7 @@
SHOULD_CALL_PARENT(FALSE)
. = list()
VV_DROPDOWN_OPTION("", "---")
VV_DROPDOWN_OPTION("", "--- /appearance_mirror ---")
VV_DROPDOWN_OPTION(VV_HK_CALLPROC, "Call Proc")
VV_DROPDOWN_OPTION(VV_HK_MARK, "Mark Object")
VV_DROPDOWN_OPTION(VV_HK_TAG, "Tag Datum")
@@ -88,7 +88,6 @@ ADMIN_VERB_ONLY_CONTEXT_MENU(debug_variables, R_NONE, "View Variables", datum/th
var/list/dropdownoptions
if (islist)
dropdownoptions = list(
"---",
"Add Item" = VV_HREF_TARGETREF_INTERNAL(refid, VV_HK_LIST_ADD),
"Remove Nulls" = VV_HREF_TARGETREF_INTERNAL(refid, VV_HK_LIST_ERASE_NULLS),
"Remove Dupes" = VV_HREF_TARGETREF_INTERNAL(refid, VV_HK_LIST_ERASE_DUPES),
@@ -100,7 +99,7 @@ ADMIN_VERB_ONLY_CONTEXT_MENU(debug_variables, R_NONE, "View Variables", datum/th
for(var/i in 1 to length(dropdownoptions))
var/name = dropdownoptions[i]
var/link = dropdownoptions[name]
dropdownoptions[i] = "<option value[link? "='[link]'":""]>[name]</option>"
dropdownoptions[i] = "<a style='display:none;' [link? "href='[link]'":""]>[name]</a>"
else
dropdownoptions = thing.vv_get_dropdown()
@@ -231,6 +230,37 @@ ADMIN_VERB_ONLY_CONTEXT_MENU(debug_variables, R_NONE, "View Variables", datum/th
var idx = what.indexOf(':');
document.getElementById(what.substr(0, idx)).innerHTML = what.substr(idx + 1);
}
function hideDropdown() {
var div = document.getElementById("vvDropdownDiv");
var a = div.getElementsByTagName("a");
for (i = 0; i < a.length; i++) {
a\[i\].style.display = "none";
}
var input = document.getElementById("vvDropdownInput");
input.value = "";
}
function filterDropdown() {
var input = document.getElementById("vvDropdownInput");
var filter = input.value.toUpperCase();
var div = document.getElementById("vvDropdownDiv");
var a = div.getElementsByTagName("a");
for (i = 0; i < a.length; i++) {
txtValue = a\[i\].textContent || a\[i\].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
a\[i\].style.display = "";
} else {
a\[i\].style.display = "none";
}
}
}
function delayHide() {
// Unfortunately required for links to work consistently when the input loses focus from a click
setTimeout(() => {hideDropdown();}, 150)
}
</script>
<div align='center'>
<table width='100%'>
@@ -259,14 +289,12 @@ ADMIN_VERB_ONLY_CONTEXT_MENU(debug_variables, R_NONE, "View Variables", datum/th
<div align='center'>
<a id='refresh_link' href='byond://?_src_=vars;
datumrefresh=[refid];[HrefToken()]'>Refresh</a>
<form>
<select name="file" size="1"
onchange="handle_dropdown(this)"
onmouseclick="this.focus()">
<option value selected>Select option</option>
<div class="dropdown-content">
<input type="text" placeholder="Select Action" id="vvDropdownInput" onkeyup="filterDropdown()" onselect="filterDropdown()" onfocus="filterDropdown()" onblur="delayHide()">
<div id="vvDropdownDiv" class="dropdown-options">
[dropdownoptions.Join()]
</select>
</form>
</div>
</div>
</div>
</td>
</tr>