mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Adds Bitfields to the VV menu (#27266)
* Adds Bitfields to the VV menu * oops * fixed * oops * woo --------- Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
This commit is contained in:
@@ -76,25 +76,15 @@
|
||||
/// The TGUI modal to use for this popup
|
||||
var/modal_type = "ListInputModal"
|
||||
|
||||
/datum/tgui_list_input/New(mob/user, message, title, list/items, default, timeout, ui_state)
|
||||
/datum/tgui_list_input/New(mob/user, message, title, list/_items, default, timeout, ui_state)
|
||||
src.title = title
|
||||
src.message = message
|
||||
src.items = list()
|
||||
src.items_map = list()
|
||||
src.default = default
|
||||
src.state = ui_state
|
||||
var/list/repeat_items = list()
|
||||
|
||||
// Gets rid of illegal characters
|
||||
var/static/regex/whitelistedWords = regex(@{"([^\u0020-\u8000]+)"})
|
||||
|
||||
for(var/i in items)
|
||||
var/string_key = whitelistedWords.Replace("[i]", "")
|
||||
|
||||
// Avoids duplicated keys E.g: when areas have the same name
|
||||
string_key = avoid_assoc_duplicate_keys(string_key, repeat_items)
|
||||
src.items += string_key
|
||||
src.items_map[string_key] = i
|
||||
handle_new_items(_items)
|
||||
|
||||
if(length(src.items) == 0)
|
||||
invalid = TRUE
|
||||
@@ -173,3 +163,16 @@
|
||||
|
||||
/datum/tgui_list_input/proc/set_choice(choice)
|
||||
src.choice = choice
|
||||
|
||||
/datum/tgui_list_input/proc/handle_new_items(list/_items)
|
||||
var/list/repeat_items = list()
|
||||
// Gets rid of illegal characters
|
||||
var/static/regex/blacklisted_words = regex(@{"([^\u0020-\u8000]+)"})
|
||||
|
||||
for(var/i in items)
|
||||
var/string_key = blacklisted_words.Replace("[i]", "")
|
||||
|
||||
// Avoids duplicated keys E.g: when areas have the same name
|
||||
string_key = avoid_assoc_duplicate_keys(string_key, repeat_items)
|
||||
src.items += string_key
|
||||
src.items_map[string_key] = i
|
||||
|
||||
Reference in New Issue
Block a user