mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-20 04:17:33 +01:00
Various VV work and fixes (#19288)
Refactored various procs used by VV: Header generation, dropdown menu generation, moved various things around, some defines. Fixed VV to be able to edit associative lists. Fixed VV to be able to make a list ex nihilo on a var. Removed various dropdown menus that didn't exist anymore and were doing nothing. Fixed add verb option to not wipe the already existing verbs of the mob. Fixed a runtime error on some lists view building that were not handled correctly. Fixed an issue with build mode not having the correct permissions for devs. Fixed an issue with editing a list referenced by a key in another list via the edit referenced object option. Added DF_VAR_EDITED flag.
This commit is contained in:
@@ -744,7 +744,7 @@ var/list/admin_verbs_cciaa = list(
|
||||
set name = "Toggle Build Mode Self"
|
||||
set category = "Special Verbs"
|
||||
|
||||
if(!check_rights(R_ADMIN))
|
||||
if(!check_rights(R_ADMIN|R_SPAWN))
|
||||
return
|
||||
var/datum/click_handler/handler = mob.GetClickHandler()
|
||||
if(handler.type == /datum/click_handler/build_mode)
|
||||
|
||||
@@ -165,7 +165,13 @@ var/list/VVdynamic_lock = list(
|
||||
|
||||
/client/proc/mod_list(var/list/L, atom/O, original_name, objectvar)
|
||||
if(!check_rights(R_VAREDIT|R_DEV)) return
|
||||
if(!istype(L,/list)) to_chat(src, "Not a List.")
|
||||
if(!islist(L))
|
||||
//May the omnissiah forgive me for this
|
||||
if(tgui_alert(usr, "Not a list, make it a list?", "Make list", list("Yes", "No")) == "Yes")
|
||||
O.vars[objectvar] = list()
|
||||
L = O.vars[objectvar]
|
||||
else
|
||||
return
|
||||
|
||||
if(L.len > 1000)
|
||||
var/confirm = alert(src, "The list you're trying to edit is very long, continuing may crash the server.", "Warning", "Continue", "Abort")
|
||||
@@ -314,7 +320,10 @@ var/list/VVdynamic_lock = list(
|
||||
L[L.Find(variable)] = variable
|
||||
|
||||
if("edit referenced object")
|
||||
modify_variables(variable)
|
||||
if(islist(L?[variable]))
|
||||
mod_list(L[variable], O, original_name, objectvar)
|
||||
else
|
||||
modify_variables(variable)
|
||||
|
||||
if("DELETE FROM LIST")
|
||||
world.log << "### ListVarEdit by [src]: [O.type] [objectvar]: REMOVED=[html_encode("[variable]")]"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/datum/proc/get_view_variables_header()
|
||||
return "<b>[src]</b>"
|
||||
|
||||
/atom/get_view_variables_header()
|
||||
return {"
|
||||
/atom/vv_get_header()
|
||||
. = ..()
|
||||
. += {"
|
||||
<a href='?_src_=vars;datumedit=[REF(src)];varnameedit=name'><b>[src]</b></a>
|
||||
<br><font size='1'>
|
||||
<a href='?_src_=vars;rotatedatum=[REF(src)];rotatedir=left'><<</a>
|
||||
@@ -11,10 +9,10 @@
|
||||
</font>
|
||||
"}
|
||||
|
||||
/mob/living/get_view_variables_header()
|
||||
return {"
|
||||
<a href='?_src_=vars;rename=[REF(src)]'><b>[src]</b></a><font size='1'>
|
||||
<br><a href='?_src_=vars;rotatedatum=[REF(src)];rotatedir=left'><<</a> <a href='?_src_=vars;datumedit=[REF(src)];varnameedit=dir'>[dir2text(dir)]</a> <a href='?_src_=vars;rotatedatum=[REF(src)];rotatedir=right'>>></a>
|
||||
/mob/living/vv_get_header()
|
||||
. = ..()
|
||||
. += {"
|
||||
<br><font size='1'>
|
||||
<br><a href='?_src_=vars;datumedit=[REF(src)];varnameedit=ckey'>[ckey ? ckey : "No ckey"]</a> / <a href='?_src_=vars;datumedit=[REF(src)];varnameedit=real_name'>[real_name ? real_name : "No real name"]</a>
|
||||
<br>
|
||||
BRUTE:<a href='?_src_=vars;mobToDamage=[REF(src)];adjustDamage=brute'>[getBruteLoss()]</a>
|
||||
@@ -26,60 +24,47 @@
|
||||
</font>
|
||||
"}
|
||||
|
||||
/datum/proc/get_view_variables_options()
|
||||
return ""
|
||||
/mob/vv_get_dropdown()
|
||||
. = ..()
|
||||
VV_DROPDOWN_OPTION("mob_player_panel", "Show player panel")
|
||||
VV_DROPDOWN_OPTION("", "---")
|
||||
VV_DROPDOWN_OPTION("give_spell", "Give Spell")
|
||||
VV_DROPDOWN_OPTION("godmode", "Toggle Godmode")
|
||||
|
||||
/mob/get_view_variables_options()
|
||||
return ..() + {"
|
||||
<option value='?_src_=vars;mob_player_panel=[REF(src)]'>Show player panel</option>
|
||||
<option>---</option>
|
||||
<option value='?_src_=vars;give_spell=[REF(src)]'>Give Spell</option>
|
||||
<option value='?_src_=vars;give_disease2=[REF(src)]'>Give Disease</option>
|
||||
<option value='?_src_=vars;give_disease=[REF(src)]'>Give TG-style Disease</option>
|
||||
<option value='?_src_=vars;godmode=[REF(src)]'>Toggle Godmode</option>
|
||||
<option value='?_src_=vars;build_mode=[REF(src)]'>Toggle Build Mode</option>
|
||||
VV_DROPDOWN_OPTION("make_skeleton", "Make 2spooky")
|
||||
|
||||
<option value='?_src_=vars;ninja=[REF(src)]'>Make Space Ninja</option>
|
||||
<option value='?_src_=vars;make_skeleton=[REF(src)]'>Make 2spooky</option>
|
||||
VV_DROPDOWN_OPTION("direct_control", "Assume Direct Control")
|
||||
VV_DROPDOWN_OPTION("drop_everything", "Drop Everything")
|
||||
|
||||
<option value='?_src_=vars;direct_control=[REF(src)]'>Assume Direct Control</option>
|
||||
<option value='?_src_=vars;drop_everything=[REF(src)]'>Drop Everything</option>
|
||||
VV_DROPDOWN_OPTION("regenerateicons", "Regenerate Icons")
|
||||
VV_DROPDOWN_OPTION("addlanguage", "Add Language")
|
||||
VV_DROPDOWN_OPTION("remlanguage", "Remove Language")
|
||||
VV_DROPDOWN_OPTION("addorgan", "Add Organ")
|
||||
VV_DROPDOWN_OPTION("remorgan", "Remove Organ")
|
||||
|
||||
<option value='?_src_=vars;regenerateicons=[REF(src)]'>Regenerate Icons</option>
|
||||
<option value='?_src_=vars;addlanguage=[REF(src)]'>Add Language</option>
|
||||
<option value='?_src_=vars;remlanguage=[REF(src)]'>Remove Language</option>
|
||||
<option value='?_src_=vars;addorgan=[REF(src)]'>Add Organ</option>
|
||||
<option value='?_src_=vars;remorgan=[REF(src)]'>Remove Organ</option>
|
||||
VV_DROPDOWN_OPTION("addverb", "Add Verb")
|
||||
VV_DROPDOWN_OPTION("remverb", "Remove Verb")
|
||||
VV_DROPDOWN_OPTION("", "---")
|
||||
VV_DROPDOWN_OPTION("gib", "Gib")
|
||||
VV_DROPDOWN_OPTION("dust", "Turn to dust")
|
||||
VV_DROPDOWN_OPTION("explode", "Trigger explosion")
|
||||
VV_DROPDOWN_OPTION("emp", "Trigger EM pulse")
|
||||
|
||||
<option value='?_src_=vars;fix_nano=[REF(src)]'>Fix NanoUI</option>
|
||||
/mob/living/carbon/human/vv_get_dropdown()
|
||||
. = ..()
|
||||
VV_DROPDOWN_OPTION("setspecies", "Set Species")
|
||||
VV_DROPDOWN_OPTION("makeai", "Make AI")
|
||||
VV_DROPDOWN_OPTION("makerobot", "Make cyborg")
|
||||
VV_DROPDOWN_OPTION("makemonkey", "Make monkey")
|
||||
VV_DROPDOWN_OPTION("makeslime", "Make slime")
|
||||
|
||||
<option value='?_src_=vars;addverb=[REF(src)]'>Add Verb</option>
|
||||
<option value='?_src_=vars;remverb=[REF(src)]'>Remove Verb</option>
|
||||
<option>---</option>
|
||||
<option value='?_src_=vars;gib=[REF(src)]'>Gib</option>
|
||||
<option value='?_src_=vars;dust=[REF(src)]'>Turn to dust</option>
|
||||
<option value='?_src_=vars;explode=[REF(src)]'>Trigger explosion</option>
|
||||
<option value='?_src_=vars;emp=[REF(src)]'>Trigger EM pulse</option>
|
||||
"}
|
||||
/obj/vv_get_dropdown()
|
||||
. = ..()
|
||||
VV_DROPDOWN_OPTION("delall", "Delete all of type")
|
||||
VV_DROPDOWN_OPTION("explode", "Trigger explosion")
|
||||
VV_DROPDOWN_OPTION("emp", "Trigger EM pulse")
|
||||
|
||||
/mob/living/carbon/human/get_view_variables_options()
|
||||
return ..() + {"
|
||||
<option value='?_src_=vars;setspecies=[REF(src)]'>Set Species</option>
|
||||
<option value='?_src_=vars;makeai=[REF(src)]'>Make AI</option>
|
||||
<option value='?_src_=vars;makerobot=[REF(src)]'>Make cyborg</option>
|
||||
<option value='?_src_=vars;makemonkey=[REF(src)]'>Make monkey</option>
|
||||
<option value='?_src_=vars;makeslime=[REF(src)]'>Make slime</option>
|
||||
"}
|
||||
|
||||
/obj/get_view_variables_options()
|
||||
return ..() + {"
|
||||
<option value='?_src_=vars;delall=[REF(src)]'>Delete all of type</option>
|
||||
<option value='?_src_=vars;explode=[REF(src)]'>Trigger explosion</option>
|
||||
<option value='?_src_=vars;emp=[REF(src)]'>Trigger EM pulse</option>
|
||||
"}
|
||||
|
||||
/turf/get_view_variables_options()
|
||||
return ..() + {"
|
||||
<option value='?_src_=vars;explode=[REF(src)]'>Trigger explosion</option>
|
||||
<option value='?_src_=vars;emp=[REF(src)]'>Trigger EM pulse</option>
|
||||
"}
|
||||
/turf/vv_get_dropdown()
|
||||
. = ..()
|
||||
VV_DROPDOWN_OPTION("explode", "Trigger explosion")
|
||||
VV_DROPDOWN_OPTION("emp", "Trigger EM pulse")
|
||||
|
||||
@@ -29,30 +29,30 @@
|
||||
|
||||
href_list["datumrefresh"] = href_list["rename"]
|
||||
|
||||
else if(href_list["varnameedit"] && href_list["datumedit"])
|
||||
else if(href_list["varnameedit"] && href_list[VV_HK_BASIC_EDIT])
|
||||
if(!check_rights(R_VAREDIT|R_DEV)) return
|
||||
|
||||
var/D = locate(href_list["datumedit"])
|
||||
var/D = locate(href_list[VV_HK_BASIC_EDIT])
|
||||
if(!istype(D,/datum) && !istype(D,/client))
|
||||
to_chat(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"])
|
||||
else if(href_list["varnamechange"] && href_list[VV_HK_BASIC_CHANGE])
|
||||
if(!check_rights(R_VAREDIT|R_DEV)) return
|
||||
|
||||
var/D = locate(href_list["datumchange"])
|
||||
var/D = locate(href_list[VV_HK_BASIC_CHANGE])
|
||||
if(!istype(D,/datum) && !istype(D,/client))
|
||||
to_chat(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"])
|
||||
else if(href_list["varnamemass"] && href_list[VV_HK_BASIC_MASSEDIT])
|
||||
if(!check_rights(R_VAREDIT|R_DEV)) return
|
||||
|
||||
var/atom/A = locate(href_list["datummass"])
|
||||
var/atom/A = locate(href_list[VV_HK_BASIC_MASSEDIT])
|
||||
if(!istype(A))
|
||||
to_chat(usr, "This can only be used on instances of type /atom")
|
||||
return
|
||||
@@ -230,16 +230,16 @@
|
||||
src.cmd_admin_emp(A)
|
||||
href_list["datumrefresh"] = href_list["emp"]
|
||||
|
||||
else if(href_list["mark_object"])
|
||||
else if(href_list[VV_HK_MARK])
|
||||
if(!check_rights(0)) return
|
||||
|
||||
var/datum/D = locate(href_list["mark_object"])
|
||||
var/datum/D = locate(href_list[VV_HK_MARK])
|
||||
if(!istype(D))
|
||||
to_chat(usr, "This can only be done to instances of type /datum")
|
||||
return
|
||||
|
||||
src.holder.marked_datum = D
|
||||
href_list["datumrefresh"] = href_list["mark_object"]
|
||||
href_list["datumrefresh"] = href_list[VV_HK_MARK]
|
||||
|
||||
else if(href_list["rotatedatum"])
|
||||
if(!check_rights(0)) return
|
||||
@@ -395,7 +395,7 @@
|
||||
possibleverbs += typesof(/mob/living/silicon/proc,/mob/living/silicon/robot/proc,/mob/living/silicon/robot/verb)
|
||||
if(/mob/living/silicon/ai)
|
||||
possibleverbs += typesof(/mob/living/silicon/proc,/mob/living/silicon/ai/proc,/mob/living/silicon/ai/verb)
|
||||
remove_verb(H, H.verbs)
|
||||
possibleverbs -= H.verbs
|
||||
possibleverbs += "Cancel" // ...And one for the bottom
|
||||
|
||||
var/verb = input("Select a verb!", "Verbs",null) as anything in possibleverbs
|
||||
@@ -507,8 +507,8 @@
|
||||
message_admins(SPAN_NOTICE("[key_name(usr)] dealt [amount] amount of [Text] damage to [L]"))
|
||||
href_list["datumrefresh"] = href_list["mobToDamage"]
|
||||
|
||||
else if(href_list["call_proc"])
|
||||
var/datum/D = locate(href_list["call_proc"])
|
||||
else if(href_list[VV_HK_CALLPROC])
|
||||
var/datum/D = locate(href_list[VV_HK_CALLPROC])
|
||||
if(istype(D) || istype(D, /client)) // can call on clients too, not just datums
|
||||
callproc_targetpicked(1, D)
|
||||
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
/var/list/view_variables_hide_vars = list("bound_x", "bound_y", "bound_height", "bound_width", "bounds", "parent_type", "step_x", "step_y", "step_size")
|
||||
// Variables not to expand the lists of. Vars is pointless to expand, and overlays/underlays cannot be expanded.
|
||||
/var/list/view_variables_dont_expand = list("overlays", "underlays", "vars", "screen", "our_overlays", "priority_overlays", "queued_overlays")
|
||||
// Variables that runtime if you try to test associativity of the lists they contain by indexing
|
||||
/var/list/view_variables_no_assoc = list("verbs", "contents", "vis_contents")
|
||||
|
||||
// Acceptable 'in world', as VV would be incredibly hampered otherwise
|
||||
/client/proc/debug_variables(datum/D in world)
|
||||
@@ -14,31 +12,37 @@
|
||||
set name = "View Variables"
|
||||
debug_variables_open(D)
|
||||
|
||||
/client/proc/debug_variables_open(var/datum/D, var/search = "")
|
||||
/client/proc/debug_variables_open(datum/thing, search = "")
|
||||
if(!check_rights(0))
|
||||
return
|
||||
|
||||
if(!D)
|
||||
if(!thing)
|
||||
return
|
||||
|
||||
var/static/list/blacklist = list(/datum/configuration)
|
||||
if(is_type_in_list(D,blacklist))
|
||||
if(is_type_in_list(thing,blacklist))
|
||||
return
|
||||
|
||||
var/islist = islist(thing) || (!isdatum(thing) && hascall(thing, "Cut")) // Some special lists dont count as lists, but can be detected by if they have list procs
|
||||
|
||||
var/icon/sprite
|
||||
if(istype(D, /atom))
|
||||
var/atom/A = D
|
||||
if(istype(thing, /atom))
|
||||
var/atom/A = thing
|
||||
if(A.icon && A.icon_state)
|
||||
sprite = icon(A.icon, A.icon_state)
|
||||
send_rsc(usr, sprite, "view_vars_sprite.png")
|
||||
|
||||
send_rsc(usr, 'code/js/view_variables.js', "view_variables.js")
|
||||
|
||||
var/list/header = islist ? list("<b>/list</b>") : thing.vv_get_header()
|
||||
|
||||
var/list/dropdownoptions = thing.vv_get_dropdown()
|
||||
|
||||
var/html = {"
|
||||
<html>
|
||||
<head>
|
||||
<script src='view_variables.js'></script>
|
||||
<title>[D] ([REF(D)] - [D.type])</title>
|
||||
<title>[thing] ([REF(thing)] - [thing.type])</title>
|
||||
<style>
|
||||
body { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; font-size: 10pt; }
|
||||
.key, .type, .value { font-family: "Fira Code", Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 9pt; }
|
||||
@@ -52,16 +56,16 @@
|
||||
<td width='50%'>
|
||||
<table align='center' width='100%'><tr>
|
||||
[sprite ? "<td><img src='view_vars_sprite.png'></td>" : ""]
|
||||
<td><div align='center'>[D.get_view_variables_header()]</div></td>
|
||||
<td><div align='center'>[header.Join()]</div></td>
|
||||
</tr></table>
|
||||
<div align='center'>
|
||||
<b><font size='1'>[replacetext("[get_debug_type(D)]", "/", "/<wbr>")]</font></b>
|
||||
[holder.marked_datum == D ? "<br/><font size='1' color='red'><b>Marked Object</b></font>" : ""]
|
||||
<b><font size='1'>[replacetext("[get_debug_type(thing)]", "/", "/<wbr>")]</font></b>
|
||||
[holder.marked_datum == thing ? "<br/><font size='1' color='red'><b>Marked Object</b></font>" : ""]
|
||||
</div>
|
||||
</td>
|
||||
<td width='50%'>
|
||||
<div align='center'>
|
||||
<a id='refresh' data-initial-href='?_src_=vars;datumrefresh=[REF(D)];search=' href='?_src_=vars;datumrefresh=[REF(D)];search=[search]'>Refresh</a>
|
||||
<a id='refresh' data-initial-href='?_src_=vars;datumrefresh=[REF(thing)];search=' href='?_src_=vars;datumrefresh=[REF(thing)];search=[search]'>Refresh</a>
|
||||
<form>
|
||||
<select name='file'
|
||||
size='1'
|
||||
@@ -70,10 +74,7 @@
|
||||
onmouseclick='this.focus()'
|
||||
style='background-color:#ffffff'>
|
||||
<option>Select option</option>
|
||||
<option />
|
||||
<option value='?_src_=vars;mark_object=[REF(D)]'>Mark Object</option>
|
||||
<option value='?_src_=vars;call_proc=[REF(D)]'>Call Proc</option>
|
||||
[D.get_view_variables_options()]
|
||||
[dropdownoptions.Join()]
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
@@ -105,13 +106,13 @@
|
||||
</tr></table>
|
||||
<hr/>
|
||||
<ol id='vars'>
|
||||
[make_view_variables_var_list(D)]
|
||||
[make_view_variables_var_list(thing)]
|
||||
</ol>
|
||||
</body>
|
||||
</html>
|
||||
"}
|
||||
|
||||
usr << browse(html, "window=variables[REF(D)];size=520x720")
|
||||
usr << browse(html, "window=variables[REF(thing)];size=520x720")
|
||||
|
||||
|
||||
/proc/make_view_variables_var_list(datum/D)
|
||||
@@ -155,18 +156,19 @@
|
||||
vtext = "<a href='?_src_=vars;Vars=[REF(C)]'>[REF(C)]</a> - [C] ([C.type])"
|
||||
else if(islist(value))
|
||||
var/list/L = value
|
||||
vtext = "([L.len])"
|
||||
if(!(varname in view_variables_dont_expand) && L.len > 0 && L.len < 100)
|
||||
vtext = "/list ([length(L)])"
|
||||
if(!(varname in view_variables_dont_expand) && length(L) > 0 && length(L) < 100)
|
||||
extra += "<ul>"
|
||||
for (var/index = 1 to L.len)
|
||||
for(var/index = 1 to length(L))
|
||||
var/entry = L[index]
|
||||
if(!isnum(entry) && !isnull(entry) && !(varname in view_variables_no_assoc) && L[entry] != null)
|
||||
extra += "<li>[index]: [make_view_variables_value(D, entry)] -> [make_view_variables_value(D, L[entry])]</li>"
|
||||
else
|
||||
extra += "<li>[index]: [make_view_variables_value(D, entry)]</li>"
|
||||
if(IS_NORMAL_LIST(L) && IS_VALID_ASSOC_KEY(entry))
|
||||
if(!isnull(L[entry]))
|
||||
extra += "<li>[index]: [make_view_variables_value(entry)] -> [make_view_variables_value(L[entry])]</li>"
|
||||
else
|
||||
extra += "<li>[index]: [make_view_variables_value(entry)]</li>"
|
||||
extra += "</ul>"
|
||||
else if(L.len >= 100)
|
||||
vtext = "([L.len]): <ul><li><a href='?_src_=vars;datumview=[REF(L)];varnameview=[varname];original_datum=[REF(D)]'>List too large to display, click to view.</a></ul>"
|
||||
else if(length(L) >= 100)
|
||||
vtext = "([length(L)]): <ul><li><a href='?_src_=vars;datumview=[REF(L)];varnameview=[varname]'>List too large to display, click to view.</a></ul>"
|
||||
|
||||
else
|
||||
vtext = "[value]"
|
||||
@@ -177,6 +179,7 @@
|
||||
var/ecm = null
|
||||
|
||||
if(D)
|
||||
//These are the VV_HK_BASIC_* defines
|
||||
ecm = {"
|
||||
(<a href='?_src_=vars;datumedit=[REF(D)];varnameedit=[varname]'>E</a>)
|
||||
(<a href='?_src_=vars;datumchange=[REF(D)];varnamechange=[varname]'>C</a>)
|
||||
|
||||
Reference in New Issue
Block a user