The One Where I Port Modals

This commit is contained in:
Chompstation Bot
2021-06-30 19:29:34 +00:00
parent 2457a62edd
commit b6e1989a01
468 changed files with 10519 additions and 1808 deletions

View File

@@ -306,12 +306,6 @@ This actually tests if they have the same entries and values.
for(var/i=1, i<L.len, ++i)
L.Swap(i,rand(i,L.len))
//Return a list with no duplicate entries
/proc/uniquelist(var/list/L)
. = list()
for(var/i in L)
. |= i
//same, but returns nothing and acts on list in place (also handles associated values properly)
/proc/uniqueList_inplace(list/L)
var/temp = L.Copy()
@@ -866,4 +860,17 @@ var/global/list/json_cache = list()
. = global.json_cache[json_to_decode]
catch(var/exception/e)
log_error("Exception during JSON decoding ([json_to_decode]): [e]")
return list()
return list()
//takes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate
//use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input
/proc/avoid_assoc_duplicate_keys(input_key, list/used_key_list)
if(!input_key || !istype(used_key_list))
return
if(used_key_list[input_key])
used_key_list[input_key]++
input_key = "[input_key] ([used_key_list[input_key]])"
else
used_key_list[input_key] = 1
return input_key

View File

@@ -25,7 +25,7 @@
if(path != root)
choices.Insert(1,"/")
var/choice = input(src,"Choose a file to access:","Download",null) as null|anything in choices
var/choice = tgui_input_list(src, "Choose a file to access:", "Download", choices)
switch(choice)
if(null)
return

View File

@@ -8,6 +8,7 @@ var/global/list/silicon_mob_list = list() //List of all silicon mobs, includin
var/global/list/ai_list = list() //List of all AIs, including clientless
var/global/list/living_mob_list = list() //List of all alive mobs, including clientless. Excludes /mob/new_player
var/global/list/dead_mob_list = list() //List of all dead mobs, including clientless. Excludes /mob/new_player
var/global/list/observer_mob_list = list() //List of all /mob/observer/dead, including clientless.
var/global/list/listening_objects = list() //List of all objects which care about receiving messages (communicators, radios, etc)
var/global/list/cleanbot_reserved_turfs = list() //List of all turfs currently targeted by some cleanbot
@@ -201,6 +202,12 @@ GLOBAL_LIST_EMPTY(mannequins)
S.race_key = rkey //Used in mob icon caching.
GLOB.all_species[S.name] = S
//Shakey shakey shake
sortTim(GLOB.all_species, /proc/cmp_species, associative = TRUE)
//Split up the rest
for(var/speciesname in GLOB.all_species)
var/datum/species/S = GLOB.all_species[speciesname]
if(!(S.spawn_flags & SPECIES_IS_RESTRICTED))
GLOB.playable_species += S.name
if(S.spawn_flags & SPECIES_IS_WHITELISTED)

View File

@@ -533,19 +533,27 @@ var/global/list/remainless_species = list(SPECIES_PROMETHEAN,
var/datum/trait/instance = new path()
if(!instance.name)
continue //A prototype or something
var/category = instance.category
var/cost = instance.cost
traits_costs[path] = cost
all_traits[path] = instance
// Shakey shakey shake
sortTim(all_traits, /proc/cmp_trait_datums_name, associative = TRUE)
// Split 'em up
for(var/traitpath in all_traits)
var/datum/trait/T = all_traits[traitpath]
var/category = T.category
switch(category)
if(-INFINITY to -0.1)
negative_traits[path] = instance
negative_traits[traitpath] = T
if(0)
neutral_traits[path] = instance
if(!(instance.custom_only))
everyone_traits[path] = instance
neutral_traits[traitpath] = T
if(!(T.custom_only))
everyone_traits[traitpath] = T
if(0.1 to INFINITY)
positive_traits[path] = instance
positive_traits[traitpath] = T
// Weaver recipe stuff
paths = typesof(/datum/weaver_recipe/structure) - /datum/weaver_recipe/structure

View File

@@ -79,9 +79,19 @@
/proc/cmp_text_asc(a,b)
return sorttext(b,a)
///Tracks are sorted by genre then by title inside that.
/proc/cmp_media_track_asc(datum/track/A, datum/track/B)
var/genre_sort = sorttext(B.genre || "Uncategorized", A.genre || "Uncategorized")
return genre_sort || sorttext(B.title, A.title)
///Filters have a numerical priority.
/proc/cmp_filter_data_priority(list/A, list/B)
return A["priority"] - B["priority"]
///Traits have sort they have defined on them to categorize themselves into groups. After that, alphabetical.
/proc/cmp_trait_datums_name(datum/trait/A, datum/trait/B)
return A.sort == B.sort ? sorttext("[B.name]","[A.name]") : A.sort - B.sort
///Species have sort_hint they self-generate to hint themselves into groups. After that, alphabetical.
/proc/cmp_species(datum/species/A, datum/species/B)
return A.sort_hint == B.sort_hint ? sorttext("[B.name]","[A.name]") : A.sort_hint - B.sort_hint

View File

@@ -394,8 +394,9 @@ Turf and target are seperate in case you want to teleport some distance from a t
borgs[name] = A
if (borgs.len)
select = input("Unshackled borg signals detected:", "Borg selection", null, null) as null|anything in borgs
return borgs[select]
select = tgui_input_list(usr, "Unshackled borg signals detected:", "Borg selection", borgs)
if(select)
return borgs[select]
//When a borg is activated, it can choose which AI it wants to be slaved to
/proc/active_ais()
@@ -421,7 +422,7 @@ Turf and target are seperate in case you want to teleport some distance from a t
/proc/select_active_ai(var/mob/user)
var/list/ais = active_ais()
if(ais.len)
if(user) . = input(usr,"AI signals detected:", "AI selection") in ais
if(user) . = tgui_input_list(usr, "AI signals detected:", "AI selection", ais)
else . = pick(ais)
return .
@@ -1482,7 +1483,7 @@ var/mob/dview/dview_mob = new
/proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
if (value == FALSE) //nothing should be calling us with a number, so this is safe
value = input("Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text
value = input(usr, "Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text
if (isnull(value))
return
value = trim(value)
@@ -1496,7 +1497,7 @@ var/mob/dview/dview_mob = new
if(matches.len==1)
chosen = matches[1]
else
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in matches
chosen = tgui_input_list(usr, "Select a type", "Pick Type", matches)
if(!chosen)
return
chosen = matches[chosen]