mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2026-08-18 01:17:03 +01:00
<!-- Write **BELOW** The Headers and **ABOVE** The comments else it may not be viewable. --> <!-- You can view Contributing.MD for a detailed description of the pull request process. --> ## About The Pull Request title <!-- Describe The Pull Request. Please be sure every change is documented or this can delay review and even discourage maintainers from merging your PR! --> ## Why It's Good For The Game <!-- Argue for the merits of your changes and how they benefit the game, especially if they are controversial and/or far reaching. If you can't actually explain WHY what you are doing will improve the game, then it probably isn't good for the game in the first place. --> ## Changelog <!-- If your PR modifies aspects of the game that can be concretely observed by players or admins you should add a changelog. If your change does NOT meet this description, remove this section. Please note that maintainers freely reserve the right to remove and add tags should they deem it appropriate. You can attempt to finagle the system all you want, but it's best to shoot for clear communication right off the bat. --> 🆑 add: new adminbuse view matrix editor code: cleanup legacy stuff & moved them into their own respective dropdown option code: use tg display-mutable-appearance /🆑 <!-- Both 🆑's are required for the changelog to work! You can put your name to the right of the first 🆑 if you want to overwrite your GitHub username as author ingame. --> <!-- You can use multiple of the same prefix (they're only used for the icon ingame) and delete the unneeded ones. Despite some of the tags, changelogs should generally represent how a player might be affected by the changes rather than a summary of the PR's contents. -->
330 lines
8.0 KiB
Plaintext
330 lines
8.0 KiB
Plaintext
/proc/vv_get_class(var_name, var_value, datum/target)
|
|
if(isnull(var_value))
|
|
. = VV_NULL
|
|
|
|
else if(isnum(var_value))
|
|
if(fetch_bitfield(target?.type, var_name))
|
|
. = VV_BITFIELD
|
|
else
|
|
. = VV_NUM
|
|
|
|
else if(istext(var_value))
|
|
if(findtext(var_value, "\n"))
|
|
. = VV_MESSAGE
|
|
else if(findtext(var_value, GLOB.is_color))
|
|
. = VV_COLOR
|
|
else
|
|
. = VV_TEXT
|
|
|
|
else if(isicon(var_value))
|
|
. = VV_ICON
|
|
|
|
else if(ismob(var_value))
|
|
. = VV_MOB_REFERENCE
|
|
|
|
else if(isloc(var_value))
|
|
. = VV_ATOM_REFERENCE
|
|
|
|
else if(istype(var_value, /client))
|
|
. = VV_CLIENT
|
|
|
|
else if(isweakref(var_value))
|
|
. = VV_WEAKREF
|
|
|
|
else if(isdatum(var_value))
|
|
. = VV_DATUM_REFERENCE
|
|
|
|
else if(ispath(var_value))
|
|
if(ispath(var_value, /atom))
|
|
. = VV_ATOM_TYPE
|
|
else if(ispath(var_value, /datum))
|
|
. = VV_DATUM_TYPE
|
|
else
|
|
. = VV_TYPE
|
|
|
|
else if(islist(var_value))
|
|
if(var_name in GLOB.color_vars)
|
|
. = VV_COLOR_MATRIX
|
|
else
|
|
. = VV_LIST
|
|
|
|
else if(isalist(var_value))
|
|
. = VV_ALIST
|
|
|
|
else if(isfile(var_value))
|
|
. = VV_FILE
|
|
else
|
|
. = VV_NULL
|
|
|
|
/client/proc/vv_get_value(class, default_class, current_value, list/restricted_classes, list/extra_classes, list/classes, var_name, datum/maybe_datum)
|
|
. = list("class" = class, "value" = null)
|
|
if(!class)
|
|
if(!classes)
|
|
classes = list (
|
|
VV_NUM,
|
|
VV_TEXT,
|
|
VV_MESSAGE,
|
|
VV_ICON,
|
|
VV_COLOR,
|
|
VV_COLOR_MATRIX,
|
|
VV_ATOM_REFERENCE,
|
|
VV_DATUM_REFERENCE,
|
|
VV_MOB_REFERENCE,
|
|
VV_CLIENT,
|
|
VV_ATOM_TYPE,
|
|
VV_DATUM_TYPE,
|
|
VV_TYPE,
|
|
VV_FILE,
|
|
VV_NEW_ATOM,
|
|
VV_NEW_DATUM,
|
|
VV_NEW_TYPE,
|
|
VV_NEW_LIST,
|
|
VV_NEW_ALIST,
|
|
VV_NULL,
|
|
VV_INFINITY,
|
|
VV_RESTORE_DEFAULT,
|
|
VV_TEXT_LOCATE,
|
|
VV_PROCCALL_RETVAL,
|
|
VV_WEAKREF,
|
|
)
|
|
|
|
var/markstring
|
|
if(!(VV_MARKED_DATUM in restricted_classes))
|
|
markstring = "[VV_MARKED_DATUM] (CURRENT: [(istype(holder) && istype(holder.marked_datum))? holder.marked_datum.type : "NULL"])"
|
|
classes += markstring
|
|
|
|
if(restricted_classes)
|
|
classes -= restricted_classes
|
|
|
|
if(extra_classes)
|
|
classes += extra_classes
|
|
|
|
if(!maybe_datum)
|
|
classes -= VV_BITFIELD
|
|
|
|
.["class"] = input(src, "What kind of data?", "Variable Type", default_class) as null|anything in classes
|
|
if(holder && holder.marked_datum && .["class"] == markstring)
|
|
.["class"] = VV_MARKED_DATUM
|
|
|
|
switch(.["class"])
|
|
if(VV_TEXT)
|
|
.["value"] = input("Enter new text:", "Text", current_value) as null|text
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_MESSAGE)
|
|
.["value"] = input("Enter new text:", "Text", current_value) as null|message
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_NUM)
|
|
.["value"] = input("Enter new number:", "Num", current_value) as null|num
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_BITFIELD)
|
|
.["value"] = input_bitfield(usr, "Editing bitfield: [var_name]", fetch_bitfield(maybe_datum?.type, var_name), current_value)
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_ATOM_TYPE)
|
|
.["value"] = pick_closest_path(FALSE)
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_DATUM_TYPE)
|
|
.["value"] = pick_closest_path(FALSE, get_fancy_list_of_datum_types())
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
if(VV_TYPE)
|
|
var/type = current_value
|
|
var/error = ""
|
|
do
|
|
type = input("Enter type:[error]", "Type", type) as null|text
|
|
if(!type)
|
|
break
|
|
type = text2path(type)
|
|
error = "\nType not found, Please try again"
|
|
while(!type)
|
|
if(!type)
|
|
.["class"] = null
|
|
return
|
|
.["value"] = type
|
|
|
|
if(VV_ATOM_REFERENCE)
|
|
var/type = pick_closest_path(FALSE)
|
|
var/subtypes = vv_subtype_prompt(type)
|
|
if(subtypes == null)
|
|
.["class"] = null
|
|
return
|
|
var/list/things = vv_reference_list(type, subtypes)
|
|
var/value = input("Select reference:", "Reference", current_value) as null|anything in things
|
|
if(!value)
|
|
.["class"] = null
|
|
return
|
|
.["value"] = things[value]
|
|
|
|
if(VV_DATUM_REFERENCE)
|
|
var/type = pick_closest_path(FALSE, get_fancy_list_of_datum_types())
|
|
var/subtypes = vv_subtype_prompt(type)
|
|
if(subtypes == null)
|
|
.["class"] = null
|
|
return
|
|
var/list/things = vv_reference_list(type, subtypes)
|
|
var/value = input("Select reference:", "Reference", current_value) as null|anything in things
|
|
if(!value)
|
|
.["class"] = null
|
|
return
|
|
.["value"] = things[value]
|
|
|
|
if(VV_MOB_REFERENCE)
|
|
var/type = pick_closest_path(FALSE, make_types_fancy(typesof(/mob)))
|
|
var/subtypes = vv_subtype_prompt(type)
|
|
if(subtypes == null)
|
|
.["class"] = null
|
|
return
|
|
var/list/things = vv_reference_list(type, subtypes)
|
|
var/value = input("Select reference:", "Reference", current_value) as null|anything in things
|
|
if(!value)
|
|
.["class"] = null
|
|
return
|
|
.["value"] = things[value]
|
|
|
|
if(VV_WEAKREF)
|
|
var/type = pick_closest_path(FALSE, get_fancy_list_of_datum_types())
|
|
var/subtypes = vv_subtype_prompt(type)
|
|
if(subtypes == null)
|
|
.["class"] = null
|
|
return
|
|
var/list/things = vv_reference_list(type, subtypes)
|
|
var/value = input("Select reference:", "Reference", current_value) as null|anything in things
|
|
if(!value)
|
|
.["class"] = null
|
|
return
|
|
.["value"] = WEAKREF(things[value])
|
|
|
|
if(VV_CLIENT)
|
|
.["value"] = input("Select reference:", "Reference", current_value) as null|anything in GLOB.clients
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_FILE)
|
|
.["value"] = prompt_for_file_or_null("Pick file", "File", 10 * 1024 * 1024)
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_ICON)
|
|
.["value"] = prompt_for_icon_or_null("Pick icon", "Icon", 10 * 1024 * 1024)
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_MARKED_DATUM)
|
|
.["value"] = holder.marked_datum
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_PROCCALL_RETVAL)
|
|
var/list/get_retval = list()
|
|
callproc_blocking(get_retval)
|
|
.["value"] = get_retval["VALUE"] //should have been set in proccall!
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_NEW_ATOM)
|
|
var/type = pick_closest_path(FALSE)
|
|
if(!type)
|
|
.["class"] = null
|
|
return
|
|
.["type"] = type
|
|
var/atom/newguy = new type()
|
|
newguy.datum_flags |= DF_VAR_EDITED
|
|
.["value"] = newguy
|
|
|
|
if(VV_NEW_DATUM)
|
|
var/type = pick_closest_path(FALSE, get_fancy_list_of_datum_types())
|
|
if(!type)
|
|
.["class"] = null
|
|
return
|
|
.["type"] = type
|
|
var/datum/newguy = new type()
|
|
newguy.datum_flags |= DF_VAR_EDITED
|
|
.["value"] = newguy
|
|
|
|
if(VV_NEW_TYPE)
|
|
var/type = current_value
|
|
var/error = ""
|
|
do
|
|
type = input("Enter type:[error]", "Type", type) as null|text
|
|
if(!type)
|
|
break
|
|
type = text2path(type)
|
|
error = "\nType not found, Please try again"
|
|
while(!type)
|
|
if(!type)
|
|
.["class"] = null
|
|
return
|
|
.["type"] = type
|
|
var/datum/newguy = new type()
|
|
if(istype(newguy))
|
|
newguy.datum_flags |= DF_VAR_EDITED
|
|
.["value"] = newguy
|
|
|
|
if(VV_NEW_LIST)
|
|
.["type"] = /list
|
|
var/list/value = list()
|
|
|
|
var/expectation = alert("Would you like to populate the list", "Populate List?", "Yes", "No")
|
|
if(!expectation || expectation == "No")
|
|
.["value"] = value
|
|
return .
|
|
|
|
var/list/insert = null
|
|
while(TRUE)
|
|
insert = vv_get_value(restricted_classes = list(VV_RESTORE_DEFAULT))
|
|
if(!insert["class"])
|
|
break
|
|
value += LIST_VALUE_WRAP_LISTS(insert["value"])
|
|
|
|
.["value"] = value
|
|
|
|
if(VV_NEW_ALIST)
|
|
.["value"] = alist()
|
|
.["type"] = /alist
|
|
|
|
if(VV_TEXT_LOCATE)
|
|
var/datum/D
|
|
do
|
|
var/ref = input("Enter reference:", "Reference") as null|text
|
|
if(!ref)
|
|
break
|
|
D = locate(ref)
|
|
if(!D)
|
|
tgui_alert(usr,"Invalid ref!")
|
|
continue
|
|
if(!D.can_vv_mark())
|
|
tgui_alert(usr,"Datum can not be marked!")
|
|
continue
|
|
while(!D)
|
|
.["type"] = D.type
|
|
.["value"] = D
|
|
|
|
if(VV_COLOR)
|
|
.["value"] = input("Enter new color:", "Color", current_value) as color|null
|
|
if(.["value"] == null)
|
|
.["class"] = null
|
|
return
|
|
|
|
if(VV_COLOR_MATRIX)
|
|
.["value"] = open_color_matrix_editor()
|
|
if(.["value"] == COLOR_MATRIX_IDENTITY) //identity is equivalent to null
|
|
.["class"] = null
|
|
|
|
if(VV_INFINITY)
|
|
.["value"] = INFINITY
|