mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-16 10:35:41 +01:00
read-only alist support for VV (#95501)
## About The Pull Request This adds experimental read-only support for `/alist`s in VV. I'm not quite sure how to add support for properly changing alists, but this is better than nothing at least. ### Before <img width="474" height="262" alt="image" src="https://github.com/user-attachments/assets/8701fc64-855b-429e-88d1-f6607000b2c8" /> ### After <img width="943" height="539" alt="2026-03-23 (1774313721) ~ dreamseeker" src="https://github.com/user-attachments/assets/cb6caf2a-19fd-49a9-b228-1bccb2c315f3" /> ## Why It's Good For The Game Should be able to at least view alists with VV. ## Changelog 🆑 admin: View Variables can now properly view alists, altho it cannot edit them. /🆑
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
/// Get displayed variable in VV variable list
|
||||
/proc/debug_variable(name, value, level, datum/owner, sanitize = TRUE, display_flags = NONE) //if D is a list, name will be index, and value will be assoc value.
|
||||
if(owner)
|
||||
if(islist(owner))
|
||||
if(isalist(owner))
|
||||
. = "<li style='backgroundColor:white'>(READ ONLY) "
|
||||
else if(islist(owner))
|
||||
var/list/list_owner = owner
|
||||
var/index = name
|
||||
if (isnull(value))
|
||||
@@ -64,6 +66,18 @@
|
||||
var/datum/datum_value = value
|
||||
return datum_value.debug_variable_value(name, level, owner, sanitize, display_flags)
|
||||
|
||||
if(isalist(value))
|
||||
var/alist/alist_value = value
|
||||
var/list/items = list()
|
||||
|
||||
var/link_vars = "Vars=[REF(value)]"
|
||||
|
||||
if (!(display_flags & VV_ALWAYS_CONTRACT_LIST) && alist_value.len > 0 && alist_value.len <= VV_NORMAL_LIST_NO_EXPAND_THRESHOLD)
|
||||
for(var/key, val in alist_value)
|
||||
items += debug_variable(key, val, level + 1, sanitize = sanitize)
|
||||
return "<a href='byond://?_src_=vars;[HrefToken()];[link_vars]'>/alist ([alist_value.len])</a><ul>[items.Join()]</ul>"
|
||||
return "<a href='byond://?_src_=vars;[HrefToken()];[link_vars]'>/alist ([alist_value.len])</a>"
|
||||
|
||||
if(islist(value) || (name in GLOB.vv_special_lists)) // Some special lists aren't detectable as a list through istype
|
||||
var/list/list_value = value
|
||||
var/list/items = list()
|
||||
|
||||
Reference in New Issue
Block a user