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:
Contrabang
2024-11-09 22:49:51 +00:00
committed by GitHub
co-authored by Burzah
parent 0b79bc23e9
commit 9b2cd0abea
12 changed files with 347 additions and 87 deletions
+15 -12
View File
@@ -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