[MIRROR] TGUI list conversions + bug fixes [MDB IGNORE] (#10355)

* TGUI list conversions + bug fixes

* Fixing conflicts

* Maintaining a few modular files while we're at it...

Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
This commit is contained in:
SkyratBot
2022-01-03 23:53:58 +01:00
committed by GitHub
parent ab65ec07d4
commit 092e534e75
155 changed files with 1203 additions and 987 deletions

View File

@@ -17,7 +17,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin
. = list()
var/list/checked_turfs = list()
var/list/found_turfs = list(origin)
while(found_turfs.len)
while(length(found_turfs))
var/turf/sourceT = found_turfs[1]
found_turfs.Cut(1, 2)
var/dir_flags = checked_turfs[sourceT]
@@ -54,23 +54,23 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin
if(!turfs)
to_chat(creator, span_warning("The new area must be completely airtight and not a part of a shuttle."))
return
if(turfs.len > BP_MAX_ROOM_SIZE)
to_chat(creator, span_warning("The room you're in is too big. It is [turfs.len >= BP_MAX_ROOM_SIZE *2 ? "more than 100" : ((turfs.len / BP_MAX_ROOM_SIZE)-1)*100]% larger than allowed."))
if(length(turfs) > BP_MAX_ROOM_SIZE)
to_chat(creator, span_warning("The room you're in is too big. It is [length(turfs) >= BP_MAX_ROOM_SIZE *2 ? "more than 100" : ((length(turfs) / BP_MAX_ROOM_SIZE)-1)*100]% larger than allowed."))
return
var/list/areas = list("New Area" = /area)
for(var/i in 1 to turfs.len)
for(var/i in 1 to length(turfs))
var/area/place = get_area(turfs[i])
if(blacklisted_areas[place.type])
continue
if(!place.requires_power || (place.area_flags & NOTELEPORT) || (place.area_flags & HIDDEN_AREA))
continue // No expanding powerless rooms etc
areas[place.name] = place
var/area_choice = input(creator, "Choose an area to expand or make a new area.", "Area Expansion") as null|anything in areas
area_choice = areas[area_choice]
if(!area_choice)
var/area_choice = tgui_input_list(creator, "Choose an area to expand or make a new area", "Area Expansion", areas)
if(isnull(area_choice))
to_chat(creator, span_warning("No choice selected. The area remains undefined."))
return
area_choice = areas[area_choice]
var/area/newA
var/area/oldA = get_area(get_turf(creator))
if(!isarea(area_choice))
@@ -83,7 +83,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin
else
newA = area_choice
for(var/i in 1 to turfs.len)
for(var/i in 1 to length(turfs))
var/turf/thing = turfs[i]
var/area/old_area = thing.loc
newA.contents += thing

View File

@@ -42,11 +42,11 @@
var/heart_nominee
switch(attempt)
if(1)
heart_nominee = input(src, "What was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?")
heart_nominee = tgui_input_text(src, "What was their name? Just a first or last name may be enough.", "<3?")
if(2)
heart_nominee = input(src, "Try again, what was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?")
heart_nominee = tgui_input_text(src, "Try again, what was their name? Just a first or last name may be enough.", "<3?")
if(3)
heart_nominee = input(src, "One more try, what was their name? Just a first or last name may be enough. (Leave blank to cancel)", "<3?")
heart_nominee = tgui_input_text(src, "One more try, what was their name? Just a first or last name may be enough.", "<3?")
if(isnull(heart_nominee) || heart_nominee == "")
return

View File

@@ -97,6 +97,10 @@
choice_list[memory_iter.name] = memory_iter
var/choice = tgui_input_list(usr, "Select a memory to [verbage]", "Memory Selection?", choice_list)
if(isnull(choice))
return FALSE
if(isnull(choice_list[choice]))
return FALSE
var/datum/memory/memory_choice = choice_list[choice]
return memory_choice

View File

@@ -34,6 +34,8 @@
return
var/mob/living/silicon/ai/AI = usr
var/target_name = tgui_input_list(AI, "Select a target", "Tracking", AI.trackable_mobs())
if(isnull(target_name))
return
AI.ai_camera_track(target_name)
/atom/movable/screen/ai/camera_light

View File

@@ -259,7 +259,9 @@
return FALSE
entered_rune_name = tgui_input_list(cultist, "Choose a rite to scribe", "Sigils of Power", GLOB.rune_types)
if(!entered_rune_name || !can_scribe_rune(tool, cultist))
if(isnull(entered_rune_name))
return FALSE
if(!can_scribe_rune(tool, cultist))
return FALSE
rune_to_scribe = GLOB.rune_types[entered_rune_name]
@@ -447,7 +449,7 @@
to_chat(cultist, span_warning("This veil is not weak enough here - it can only be scribed in [english_list(summon_objective.summon_spots)]!"))
return FALSE
if(fail_if_last_site && summon_objective.summon_spots.len <= 1)
if(fail_if_last_site && length(summon_objective.summon_spots) <= 1)
to_chat(cultist, span_warning("This rune cannot be scribed here - the ritual site must be reserved for the final summoning!"))
return FALSE

View File

@@ -154,7 +154,7 @@
if(istype(I, /obj/item/stack) && precise_insertion)
var/atom/current_parent = parent
var/obj/item/stack/S = I
requested_amount = input(user, "How much do you want to insert?", "Inserting [S.singular_name]s") as num|null
requested_amount = round(tgui_input_number(user, "How much do you want to insert?", "Inserting [S.singular_name]s"))
if(isnull(requested_amount) || (requested_amount <= 0))
return
if(QDELETED(I) || QDELETED(user) || QDELETED(src) || parent != current_parent || user.physical_can_use_topic(current_parent) < UI_INTERACTIVE || user.get_active_held_item() != active_held)

View File

@@ -451,7 +451,7 @@
symptoms += SSdisease.list_symptoms.Copy()
do
if(user)
var/symptom = input(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom") in sort_list(symptoms, /proc/cmp_typepaths_asc)
var/symptom = tgui_input_list(user, "Choose a symptom to add ([i] remaining)", "Choose a Symptom", sort_list(symptoms, /proc/cmp_typepaths_asc))
if(isnull(symptom))
return
else if(istext(symptom))
@@ -465,7 +465,7 @@
if(D.symptoms.len > 0)
var/new_name = stripped_input(user, "Name your new disease.", "New Name")
var/new_name = tgui_input_text(user, "Name your new disease", "New Name", max_length = MAX_NAME_LEN)
if(!new_name)
return
D.Refresh()
@@ -474,11 +474,10 @@
var/list/targets = list("Random")
targets += sort_names(GLOB.human_list)
var/target = input(user, "Pick a viable human target for the disease.", "Disease Target") as null|anything in targets
var/mob/living/carbon/human/H
if(!target)
var/target = tgui_input_list(user, "Viable human target", "Disease Target", targets)
if(isnull(target))
return
var/mob/living/carbon/human/H
if(target == "Random")
for(var/human in shuffle(GLOB.human_list))
H = human

View File

@@ -62,11 +62,13 @@
available_surgeries[surgeryloop_two.name] = surgeryloop_two
break
if(!available_surgeries.len)
if(!length(available_surgeries))
return
var/pick_your_surgery = tgui_input_list(user, "Which procedure?", "Surgery", sort_list(available_surgeries))
if(pick_your_surgery && user?.Adjacent(livingtarget) && (source in user))
if(isnull(pick_your_surgery))
return
if(user?.Adjacent(livingtarget) && (source in user))
var/datum/surgery/surgeryinstance_notonmob = available_surgeries[pick_your_surgery]
for(var/i_three in livingtarget.surgeries)

View File

@@ -61,9 +61,9 @@
if(!length(possible))
to_chat(user,span_warning("Despite your best efforts, there are no scents to be found on [sniffed]..."))
return
tracking_target = input(user, "Choose a scent to remember.", "Scent Tracking") as null|anything in sort_names(possible)
if(!tracking_target)
if(!old_target)
tracking_target = tgui_input_list(user, "Scent to remember", "Scent Tracking", sort_names(possible))
if(isnull(tracking_target))
if(isnull(old_target))
to_chat(user,span_warning("You decide against remembering any scents. Instead, you notice your own nose in your peripheral vision. This goes on to remind you of that one time you started breathing manually and couldn't stop. What an awful day that was."))
return
tracking_target = old_target
@@ -242,7 +242,7 @@
if(BP.body_part != HEAD && BP.body_part != CHEST)
if(BP.dismemberable)
parts += BP
if(!parts.len)
if(!length(parts))
to_chat(usr, span_notice("You can't shed any more limbs!"))
return

View File

@@ -93,7 +93,7 @@
chosen_camera = named_cameras[1]
else
chosen_camera = tgui_input_list(ai, "Choose a camera to jump to", "Camera Selection", named_cameras)
if(!chosen_camera)
if(isnull(chosen_camera))
return
var/obj/machinery/camera/selected_camera = named_cameras[chosen_camera]
if(!selected_camera.can_use())

View File

@@ -627,11 +627,13 @@
if(!Adjacent(user) || !can_buckle || !has_buckled_mobs()) //so that borgs (but not AIs, sadly (perhaps in a future PR?)) can unbuckle people from machines
return _try_interact(user)
if(buckled_mobs.len <= 1)
if(length(buckled_mobs) <= 1)
if(user_unbuckle_mob(buckled_mobs[1],user))
return TRUE
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
var/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs))
if(isnull(unbuckled))
return FALSE
if(user_unbuckle_mob(unbuckled,user))
return TRUE

View File

@@ -207,7 +207,7 @@
list_to_show += i
used_material = tgui_input_list(usr, "Choose [used_material]", "Custom Material", sort_list(list_to_show, /proc/cmp_typepaths_asc))
if(!used_material)
if(isnull(used_material))
return //Didn't pick any material, so you can't build shit either.
custom_materials[used_material] += amount_needed
@@ -264,7 +264,7 @@
else
LAZYADD(not_imported, blueprint.name)
if(not_imported)
to_chat(user, span_warning("The following design[not_imported.len > 1 ? "s" : ""] couldn't be imported: [english_list(not_imported)]"))
to_chat(user, span_warning("The following design[length(not_imported) > 1 ? "s" : ""] couldn't be imported: [english_list(not_imported)]"))
busy = FALSE
return TRUE
@@ -348,7 +348,7 @@
. += span_notice("The status display reads: Storing up to <b>[materials.max_amount]</b> material units.<br>Material consumption at <b>[creation_efficiency*100]%</b>.")
/obj/machinery/autolathe/proc/can_build(datum/design/D, amount = 1)
if(D.make_reagents.len)
if(length(D.make_reagents))
return FALSE
var/coeff = (ispath(D.build_path, /obj/item/stack) ? 1 : creation_efficiency)

View File

@@ -231,10 +231,12 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/camera/xray, 0)
droppable_parts += assembly.emp_module
if(assembly.proxy_module)
droppable_parts += assembly.proxy_module
if(!droppable_parts.len)
if(!length(droppable_parts))
return
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts)
if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts))
if(isnull(choice))
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
to_chat(user, span_notice("You remove [choice] from [src]."))
if(choice == assembly.xray_module)

View File

@@ -201,10 +201,12 @@
droppable_parts += emp_module
if(proxy_module)
droppable_parts += proxy_module
if(!droppable_parts.len)
if(!length(droppable_parts))
return
var/obj/item/choice = input(user, "Select a part to remove:", src) as null|obj in sort_names(droppable_parts)
if(!choice || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
var/obj/item/choice = tgui_input_list(user, "Select a part to remove", "Part Removal", sort_names(droppable_parts))
if(isnull(choice))
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
to_chat(user, span_notice("You remove [choice] from [src]."))
drop_upgrade(choice)

View File

@@ -9,7 +9,7 @@
for (var/obj/machinery/camera/C in L)
var/list/tempnetwork = C.network&src.network
if (tempnetwork.len)
if (length(tempnetwork))
T[text("[][]", C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C
return T
@@ -17,6 +17,10 @@
/mob/living/silicon/ai/proc/show_camera_list()
var/list/cameras = get_camera_list()
var/camera = tgui_input_list(src, "Choose which camera you want to view", "Cameras", cameras)
if(isnull(camera))
return
if(isnull(cameras[camera]))
return
switchCamera(cameras[camera])
/datum/trackable
@@ -145,7 +149,7 @@
var/obj/machinery/camera/a
var/obj/machinery/camera/b
for (var/i = L.len, i > 0, i--)
for (var/i = length(L), i > 0, i--)
for (var/j = 1 to i - 1)
a = L[j]
b = L[j + 1]

View File

@@ -159,9 +159,9 @@
var/list/keys = list()
for(var/mob/M in GLOB.player_list)
keys += M.client
var/client/selection = input("Please, select a player!", "Team member", null, null) as null|anything in sort_key(keys)
var/client/selection = tgui_input_list(user, "Select a player", "Team member", sort_key(keys))
//Could be freeform if you want to add disconnected i guess
if(!selection)
if(isnull(selection))
return
key = selection.ckey
if(!team_keys[team])

View File

@@ -424,7 +424,9 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers)
IO |= text[1]
if(!IO.len)
to_chat(user, span_alert("No machinery detected."))
var/S = input("Select the device set: ", "Selection", IO[1]) as anything in sort_list(IO)
var/S = tgui_input_list(user, "Select the device set", "Reconnect", sort_list(IO))
if(isnull(S))
return
if(src)
src.input_tag = "[S]_in"
src.output_tag = "[S]_out"

View File

@@ -137,19 +137,19 @@
var/camera_location
var/turf/myturf = get_turf(src)
if(eyeobj.use_static != FALSE)
if((!z_lock.len || (myturf.z in z_lock)) && GLOB.cameranet.checkTurfVis(myturf))
if((!length(z_lock) || (myturf.z in z_lock)) && GLOB.cameranet.checkTurfVis(myturf))
camera_location = myturf
else
for(var/obj/machinery/camera/C in GLOB.cameranet.cameras)
if(!C.can_use() || z_lock.len && !(C.z in z_lock))
if(!C.can_use() || length(z_lock) && !(C.z in z_lock))
continue
var/list/network_overlap = networks & C.network
if(network_overlap.len)
if(length(network_overlap))
camera_location = get_turf(C)
break
else
camera_location = myturf
if(z_lock.len && !(myturf.z in z_lock))
if(length(z_lock) && !(myturf.z in z_lock))
camera_location = locate(round(world.maxx/2), round(world.maxy/2), z_lock[1])
if(camera_location)
@@ -274,7 +274,7 @@
var/list/L = list()
for (var/obj/machinery/camera/cam in GLOB.cameranet.cameras)
if(origin.z_lock.len && !(cam.z in origin.z_lock))
if(length(origin.z_lock) && !(cam.z in origin.z_lock))
continue
L.Add(cam)
@@ -284,13 +284,17 @@
for (var/obj/machinery/camera/netcam in L)
var/list/tempnetwork = netcam.network & origin.networks
if (tempnetwork.len)
if (length(tempnetwork))
if(!netcam.c_tag)
continue
T["[netcam.c_tag][netcam.can_use() ? null : " (Deactivated)"]"] = netcam
playsound(origin, 'sound/machines/terminal_prompt.ogg', 25, FALSE)
var/camera = tgui_input_list(usr, "Camera to view", "Cameras", T)
if(isnull(camera))
return
if(isnull(T[camera]))
return
var/obj/machinery/camera/final = T[camera]
playsound(src, "terminal_type", 25, FALSE)
if(final)

View File

@@ -697,7 +697,7 @@ GLOBAL_VAR_INIT(cops_arrived, FALSE)
if(!SScommunications.can_announce(user, is_ai))
to_chat(user, span_alert("Intercomms recharging. Please stand by."))
return
var/input = stripped_input(user, "Please choose a message to announce to the station crew.", "What?")
var/input = tgui_input_text(user, "Message to announce to the station crew", "Announcement")
if(!input || !user.canUseTopic(src, !issilicon(usr)))
return
if(!(user.can_speak())) //No more cheating, mime/random mute guy!

View File

@@ -98,10 +98,10 @@
if("reset")
contained_id.points = 0
if("setgoal")
var/num = round(input(usr, "Choose prisoner's goal:", "Input an Integer", null) as num|null)
if(num >= 0)
num = min(num,1000) //Cap the quota to the equivilent of 10 minutes.
contained_id.goal = num
var/num = tgui_input_text(usr, "Enter the prisoner's goal", "Prisoner Management", 1, 1000, 1)
if(isnull(num))
return
contained_id.goal = round(num)
else if(href_list["inject1"])
var/obj/item/implant/I = locate(href_list["inject1"]) in GLOB.tracked_chem_implants
if(I && istype(I))

View File

@@ -612,19 +612,19 @@ What a mess.*/
printing = null
if("Print Poster")
if(!( printing ))
var/wanted_name = stripped_input(usr, "Please enter an alias for the criminal:", "Print Wanted Poster", active1.fields["name"])
var/wanted_name = tgui_input_text(usr, "Enter an alias for the criminal", "Print Wanted Poster", active1.fields["name"])
if(wanted_name)
var/default_description = "A poster declaring [wanted_name] to be a dangerous individual, wanted by Nanotrasen. Report any sightings to security immediately."
var/list/crimes = active2.fields["crim"]
if(crimes.len)
if(length(crimes))
default_description += "\n[wanted_name] is wanted for the following crimes:\n"
for(var/datum/data/crime/c in active2.fields["crim"])
default_description += "\n[c.crimeName]\n"
default_description += "[c.crimeDetails]\n"
var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Wanted Poster", "WANTED", 8)
var/headerText = tgui_input_text(usr, "Enter a poster heading", "Print Wanted Poster", "WANTED", 7)
var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Wanted Poster", default_description, null)
var/info = tgui_input_text(usr, "Input a description for the poster", "Print Wanted Poster", default_description)
if(info)
playsound(loc, 'sound/items/poster_being_created.ogg', 100, TRUE)
printing = 1
@@ -635,13 +635,13 @@ What a mess.*/
printing = 0
if("Print Missing")
if(!( printing ))
var/missing_name = stripped_input(usr, "Please enter an alias for the missing person:", "Print Missing Persons Poster", active1.fields["name"])
var/missing_name = tgui_input_text(usr, "Enter an alias for the missing person", "Print Missing Persons Poster", active1.fields["name"])
if(missing_name)
var/default_description = "A poster declaring [missing_name] to be a missing individual, missed by Nanotrasen. Report any sightings to security immediately."
var/headerText = stripped_input(usr, "Please enter Poster Heading (Max 7 Chars):", "Print Missing Persons Poster", "MISSING", 8)
var/headerText = tgui_input_text(usr, "Enter a poster heading", "Print Missing Persons Poster", "MISSING", 7)
var/info = stripped_multiline_input(usr, "Please input a description for the poster:", "Print Missing Persons Poster", default_description, null)
var/info = tgui_input_text(usr, "Input a description for the poster", "Print Missing Persons Poster", default_description)
if(info)
playsound(loc, 'sound/items/poster_being_created.ogg', 100, TRUE)
printing = 1
@@ -669,7 +669,7 @@ What a mess.*/
if(!( istype(active2, /datum/data/record) ))
return
var/a2 = active2
var/t1 = stripped_multiline_input("Add Comment:", "Secure. records", null, null)
var/t1 = tgui_input_text(usr, "Add a comment", "Security Records")
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return
var/counter = 1
@@ -763,7 +763,7 @@ What a mess.*/
switch(href_list["field"])
if("name")
if(istype(active1, /datum/data/record) || istype(active2, /datum/data/record))
var/t1 = stripped_input(usr, "Please input name:", "Secure. records", active1.fields["name"], MAX_MESSAGE_LEN)
var/t1 = tgui_input_text(usr, "Input a name", "Security Records", active1.fields["name"])
if(!canUseSecurityRecordsConsole(usr, t1, a1))
return
if(istype(active1, /datum/data/record))
@@ -772,7 +772,7 @@ What a mess.*/
active2.fields["name"] = t1
if("id")
if(istype(active2, /datum/data/record) || istype(active1, /datum/data/record))
var/t1 = stripped_input(usr, "Please input id:", "Secure. records", active1.fields["id"], null)
var/t1 = tgui_input_text(usr, "Input an id", "Security Records", active1.fields["id"])
if(!canUseSecurityRecordsConsole(usr, t1, a1))
return
if(istype(active1, /datum/data/record))
@@ -781,7 +781,7 @@ What a mess.*/
active2.fields["id"] = t1
if("fingerprint")
if(istype(active1, /datum/data/record))
var/t1 = stripped_input(usr, "Please input fingerprint hash:", "Secure. records", active1.fields["fingerprint"], null)
var/t1 = tgui_input_text(usr, "Input a fingerprint hash", "Security Records", active1.fields["fingerprint"])
if(!canUseSecurityRecordsConsole(usr, t1, a1))
return
active1.fields["fingerprint"] = t1
@@ -795,7 +795,7 @@ What a mess.*/
active1.fields["gender"] = "Male"
if("age")
if(istype(active1, /datum/data/record))
var/t1 = input("Please input age:", "Secure. records", active1.fields["age"], null) as num|null
var/t1 = tgui_input_number(usr, "Input age", "Security records", active1.fields["age"], AGE_MAX, AGE_MIN)
if (!t1)
return
@@ -805,7 +805,9 @@ What a mess.*/
active1.fields["age"] = t1
if("species")
if(istype(active1, /datum/data/record))
var/t1 = input("Select a species", "Species Selection") as null|anything in get_selectable_species()
var/t1 = tgui_input_list(usr, "Select a species", "Species Selection", get_selectable_species())
if(isnull(t1))
return
if(!canUseSecurityRecordsConsole(usr, t1, a1))
return
active1.fields["species"] = t1
@@ -855,8 +857,8 @@ What a mess.*/
print_photo(P.picture.picture_image, active1.fields["name"])
if("crim_add")
if(istype(active1, /datum/data/record))
var/t1 = stripped_input(usr, "Please input crime names:", "Secure. records", "", null)
var/t2 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null)
var/t1 = tgui_input_text(usr, "Input crime names", "Security Records")
var/t2 = tgui_input_text(usr, "Input crime details", "Security Records")
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return
var/crime = GLOB.data_core.createCrimeEntry(t1, t2, authenticated, station_time_timestamp())
@@ -871,7 +873,7 @@ What a mess.*/
if("add_details")
if(istype(active1, /datum/data/record))
if(href_list["cdataid"])
var/t1 = stripped_input(usr, "Please input crime details:", "Secure. records", "", null)
var/t1 = tgui_input_text(usr, "Input crime details", "Security Records")
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return
GLOB.data_core.addCrimeDetails(active1.fields["id"], href_list["cdataid"], t1)
@@ -880,17 +882,13 @@ What a mess.*/
if(istype(active1, /datum/data/record))
var/maxFine = CONFIG_GET(number/maxfine)
var/t1 = stripped_input(usr, "Please input citation crime:", "Secure. records", "", null)
var/fine = FLOOR(input(usr, "Please input citation fine, up to [maxFine]:", "Secure. records", 50) as num|null, 1)
var/t1 = tgui_input_text(usr, "Input citation crime", "Security Records")
var/fine = round(tgui_input_number(usr, "Input citation fine", "Security Records", 50, maxFine, 1))
if (isnull(fine))
return
fine = min(fine, maxFine)
if(fine < 0)
to_chat(usr, span_warning("You're pretty sure that's not how money works."))
return
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return
@@ -918,7 +916,7 @@ What a mess.*/
GLOB.data_core.removeCitation(active1.fields["id"], href_list["cdataid"])
if("notes")
if(istype(active2, /datum/data/record))
var/t1 = stripped_input(usr, "Please summarize notes:", "Secure. records", active2.fields["notes"], null)
var/t1 = tgui_input_text(usr, "Please summarize notes", "Security Records", active2.fields["notes"])
if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return
active2.fields["notes"] = t1

View File

@@ -188,16 +188,20 @@
var/list/targets = get_targets()
if (regime_set == "Teleporter")
var/desc = input("Please select a location to lock in.", "Locking Computer") as null|anything in sort_list(targets)
var/desc = tgui_input_list(usr, "Select a location to lock in", "Locking Computer", sort_list(targets))
if(isnull(desc))
return
set_teleport_target(targets[desc])
var/turf/target_turf = get_turf(targets[desc])
log_game("[key_name(user)] has set the teleporter target to [targets[desc]] at [AREACOORD(target_turf)]")
else
if (targets.len == 0)
if (!length(targets))
to_chat(user, span_alert("No active connected stations located."))
return
var/desc = input("Please select a station to lock in.", "Locking Computer") as null|anything in sort_list(targets)
var/desc = tgui_input_list(usr, "Select a station to lock in", "Locking Computer", sort_list(targets))
if(isnull(desc))
return
var/obj/machinery/teleport/station/target_station = targets[desc]
if(!target_station || !target_station.teleporter_hub)
return

View File

@@ -1240,7 +1240,7 @@
// reads from the airlock painter's `available paintjob` list. lets the player choose a paint option, or cancel painting
var/current_paintjob = tgui_input_list(user, "Paintjob for this airlock", "Customize", sort_list(painter.available_paint_jobs))
if(!current_paintjob) // if the user clicked cancel on the popup, return
if(isnull(current_paintjob)) // if the user clicked cancel on the popup, return
return
var/airlock_type = painter.available_paint_jobs["[current_paintjob]"] // get the airlock type path associated with the airlock name the user just chose
@@ -1390,7 +1390,7 @@
if(!electronics)
ae = new/obj/item/electronics/airlock(loc)
gen_access()
if(req_one_access.len)
if(length(req_one_access))
ae.one_access = 1
ae.accesses = req_one_access
else

View File

@@ -31,9 +31,10 @@
return
if (deconstruction != BLASTDOOR_FINISHED)
return
var/change_id = input("Set the shutters/blast door/blast door controllers ID. It must be a number between 1 and 100.", "ID", id) as num|null
if(change_id)
id = clamp(round(change_id, 1), 1, 100)
var/change_id = tgui_input_number(user, "Set the door controllers ID", "Door Controller ID", id, 100, 1)
if(isnull(change_id))
return
id = round(change_id)
to_chat(user, span_notice("You change the ID to [id]."))
balloon_alert(user, "ID changed")

View File

@@ -325,7 +325,9 @@ Possible to do for anyone motivated enough:
LAZYADD(callnames[A], I)
callnames -= get_area(src)
var/result = tgui_input_list(usr, "Choose an area to call", "Holocall", sort_names(callnames))
if(QDELETED(usr) || !result || outgoing_call)
if(isnull(result))
return
if(QDELETED(usr) || outgoing_call)
return
if(usr.loc == loc)
var/input = text2num(params["headcall"])
@@ -753,15 +755,15 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
if(time_delta >= 1)
disk.record.entries += list(list(HOLORECORD_DELAY,time_delta))
disk.record.entries += list(list(HOLORECORD_SAY,message))
if(disk.record.entries.len >= HOLORECORD_MAX_LENGTH)
if(length(disk.record.entries) >= HOLORECORD_MAX_LENGTH)
record_stop()
/obj/machinery/holopad/proc/replay_entry(entry_number)
if(!replay_mode)
return
if (!disk.record.entries.len) // check for zero entries such as photographs and no text recordings
if (!length(disk.record.entries)) // check for zero entries such as photographs and no text recordings
return // and pretty much just display them statically untill manually stopped
if(disk.record.entries.len < entry_number)
if(length(disk.record.entries) < entry_number)
if(loop_mode)
entry_number = 1
else

View File

@@ -553,7 +553,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/newscaster/security_unit, 30)
for(var/datum/newscaster/feed_channel/F in GLOB.news_network.network_channels)
if( (!F.locked || F.author == scanned_user) && !F.censored)
available_channels += F.channel_name
channel_name = input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in sort_list(available_channels)
var/channel_choice = tgui_input_list(usr, "Choose receiving Feed Channel", "Network Channel Handler", sort_list(available_channels))
if(isnull(channel_choice))
return
channel_name = channel_choice
updateUsrDialog()
else if(href_list["set_new_message"])
var/temp_message = tgui_input_text(usr, "Write your Feed story", "Network Channel Handler", msg, multiline = TRUE)

View File

@@ -181,13 +181,13 @@
return
if(istype(I, /obj/item/pen)) //you can rename turrets like bots!
var/t = stripped_input(user, "Enter new turret name", name, finish_name)
if(!t)
var/choice = tgui_input_text(user, "Enter a new turret name", "Turret Classification", finish_name, MAX_NAME_LEN)
if(!choice)
return
if(!Adjacent(user))
if(!user.canUseTopic(src, BE_CLOSE))
return
finish_name = t
finish_name = choice
return
return ..()

View File

@@ -198,17 +198,19 @@
notify_ghosts("\A [src] has been activated at [get_area(src)]!", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Bomb Planted")
/obj/machinery/syndicatebomb/proc/settings(mob/user)
if(!user.canUseTopic(src, !issilicon(user)))
return
var/new_timer = tgui_input_number(user, "Set the timer", "Countdown", timer_set, maximum_timer, minimum_timer)
if (isnull(new_timer))
return
new_timer = round(new_timer)
if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station
timer_set = clamp(new_timer, minimum_timer, maximum_timer)
if(!user.canUseTopic(src, !issilicon(user)))
return
timer_set = round(new_timer)
loc.visible_message(span_notice("[icon2html(src, viewers(src))] timer set for [timer_set] seconds."))
var/choice = tgui_alert(user, "Would you like to start the countdown now?", "Bomb Timer", list("Yes","No"))
if(choice != "Yes")
return
if(!in_range(src, user) || !isliving(user))
if(!user.canUseTopic(src, !issilicon(user)))
return
if(active)
to_chat(user, span_warning("The bomb is already active!"))

View File

@@ -288,10 +288,11 @@
for (var/obj/machinery/telecomms/message_server/M in GLOB.telecomms_list)
message_servers += M
if(message_servers.len > 1)
if(length(message_servers) > 1)
linkedServer = tgui_input_list(usr, "Please select a server", "Server Selection", message_servers)
if(linkedServer)
message = span_alert("NOTICE: Server selected.")
else if(message_servers.len > 0)
else if(length(message_servers) > 0)
linkedServer = message_servers[1]
message = span_notice("NOTICE: Only Single Server Detected - Server selected.")
else
@@ -388,7 +389,7 @@
if("Recepient")
//Get out list of viable PDAs
var/list/obj/item/pda/sendPDAs = get_viewable_pdas()
if(GLOB.PDAs && GLOB.PDAs.len > 0)
if(GLOB.PDAs && length(GLOB.PDAs) > 0)
customrecepient = tgui_input_list(usr, "Select a PDA from the list", "PDA Selection", sendPDAs)
else
customrecepient = null

View File

@@ -18,8 +18,10 @@
if(.)
return
if(can_buckle && has_buckled_mobs())
if(buckled_mobs.len > 1)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
if(length(buckled_mobs) > 1)
var/mob/living/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs))
if(isnull(unbuckled))
return
if(user_unbuckle_mob(unbuckled,user))
return TRUE
else
@@ -44,8 +46,10 @@
if(.)
return
if(Adjacent(user) && can_buckle && has_buckled_mobs())
if(buckled_mobs.len > 1)
var/unbuckled = input(user, "Who do you wish to unbuckle?","Unbuckle Who?") as null|mob in sort_names(buckled_mobs)
if(length(buckled_mobs) > 1)
var/mob/living/unbuckled = tgui_input_list(user, "Who do you wish to unbuckle?", "Unbuckle", sort_names(buckled_mobs))
if(isnull(unbuckled))
return
return user_unbuckle_mob(unbuckled,user)
else
return user_unbuckle_mob(buckled_mobs[1], user)
@@ -71,7 +75,7 @@
/atom/movable/proc/has_buckled_mobs()
if(!buckled_mobs)
return FALSE
if(buckled_mobs.len)
if(length(buckled_mobs))
return TRUE
/**

View File

@@ -419,7 +419,9 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
affixes.Add(suffixes)
//admin picks, cleanup the ones we didn't do and handle chosen
var/picked_affix_name = input(usr, "Choose an affix to add to [src]...", "Enchant [src]") as null|anything in affixes
var/picked_affix_name = tgui_input_list(usr, "Affix to add to [src]", "Enchant [src]", affixes)
if(isnull(picked_affix_name))
return
if(!affixes[picked_affix_name] || QDELETED(src))
return
var/datum/fantasy_affix/affix = affixes[picked_affix_name]

View File

@@ -246,15 +246,10 @@ AI MODULES
laws = list("")
/obj/item/ai_module/supplied/freeform/attack_self(mob/user)
var/newpos = input("Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority (15+)", lawpos) as num|null
if(newpos == null)
var/newpos = tgui_input_number(user, "Please enter the priority for your new law. Can only write to law sectors 15 and above.", "Law Priority ", lawpos, 50, 15)
if(isnull(newpos))
return
if(newpos < 15)
var/response = tgui_alert(usr, "Error: The law priority of [newpos] is invalid, Law priorities below 14 are reserved for core laws, Would you like to change that that to 15?", "Invalid law priority", list("Change to 15", "Cancel"))
if (!response || response == "Cancel")
return
newpos = 15
lawpos = min(newpos, 50)
lawpos = round(newpos)
var/targName = tgui_input_text(user, "Enter a new law for the AI.", "Freeform Law Entry", laws[1], CONFIG_GET(number/max_law_len), TRUE)
if(!targName)
return
@@ -290,12 +285,8 @@ AI MODULES
var/lawpos = 1
/obj/item/ai_module/remove/attack_self(mob/user)
lawpos = input("Please enter the law you want to delete.", "Law Number", lawpos) as num|null
if(lawpos == null)
return
if(lawpos <= 0)
to_chat(user, span_warning("Error: The law number of [lawpos] is invalid."))
lawpos = 1
lawpos = tgui_input_number(user, "Law to delete", "Law Removal", lawpos, 50, 1)
if(isnull(lawpos))
return
to_chat(user, span_notice("Law [lawpos] selected."))
..()

View File

@@ -459,7 +459,7 @@
to_chat(user, span_warning("[src] doesn't have a linked account to deposit into!"))
return FALSE
if (!money || !money.len)
if (!money || !length(money))
return FALSE
var/total = 0
@@ -489,49 +489,38 @@
. = FALSE
var/datum/bank_account/old_account = registered_account
var/new_bank_id = input(user, "Enter your account ID number.", "Account Reclamation", 111111) as num | null
var/new_bank_id = tgui_input_number(user, "Enter your account ID number", "Account Reclamation", 111111, 999999, 111111)
if(isnull(new_bank_id))
return
if(!alt_click_can_use_id(user))
return
if(!new_bank_id || new_bank_id < 111111 || new_bank_id > 999999)
to_chat(user, span_warning("The account ID number needs to be between 111111 and 999999."))
return
if(registered_account && registered_account.account_id == new_bank_id)
to_chat(user, span_warning("The account ID was already assigned to this card."))
return
var/datum/bank_account/B = SSeconomy.bank_accounts_by_id["[new_bank_id]"]
if(B)
if (old_account)
old_account.bank_cards -= src
B.bank_cards += src
registered_account = B
to_chat(user, span_notice("The provided account has been linked to this ID card."))
return TRUE
var/datum/bank_account/account = SSeconomy.bank_accounts_by_id["[new_bank_id]"]
if(isnull(account))
to_chat(user, span_warning("The account ID number provided is invalid."))
return
if(old_account)
old_account.bank_cards -= src
account.bank_cards += src
registered_account = account
to_chat(user, span_notice("The provided account has been linked to this ID card."))
return TRUE
/obj/item/card/id/AltClick(mob/living/user)
if(!alt_click_can_use_id(user))
return
if(!registered_account)
set_new_account(user)
return
if (registered_account.being_dumped)
registered_account.bank_card_talk(span_warning("内部服务器错误"), TRUE)
return
var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Balance: [registered_account.account_balance]", "Withdraw Funds", 5) as num|null, 1)
if(!amount_to_remove || amount_to_remove < 0)
var/amount_to_remove = round(tgui_input_number(user, "How much do you want to withdraw?", "Withdraw Funds", 1, registered_account.account_balance, 1))
if(isnull(amount_to_remove))
return
if(amount_to_remove < 1 || amount_to_remove > registered_account.account_balance)
return
if(!alt_click_can_use_id(user))
return
@@ -980,7 +969,8 @@
/obj/item/card/id/advanced/prisoner/attackby(obj/item/card/id/C, mob/user)
..()
var/list/id_access = C.GetAccess()
if(ACCESS_BRIG in id_access)
if(!(ACCESS_BRIG in id_access))
return
if(timed)
timed = FALSE
time_to_assign = initial(time_to_assign)
@@ -988,9 +978,10 @@
STOP_PROCESSING(SSobj, src)
to_chat(user, "Restating prisoner ID to default parameters.")
return
time_to_assign = input(user,"Set sentence time in seconds.","Set sentence time in seconds.",0) as num|null
var/choice = tgui_input_number(user, "Sentence time in seconds", "Sentencing")
if(isnull(time_to_assign) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
time_to_assign = round(choice)
to_chat(user, "You set the sentence time to [time_to_assign] seconds.")
timed = TRUE
@@ -1271,7 +1262,7 @@
return
if(popup_input == "Forge/Reset")
if(!forged)
var/input_name = stripped_input(user, "What name would you like to put on this card? Leave blank to randomise.", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name), MAX_NAME_LEN)
var/input_name = tgui_input_text(user, "What name would you like to put on this card? Leave blank to randomise.", "Agent card name", registered_name ? registered_name : (ishuman(user) ? user.real_name : user.name), MAX_NAME_LEN)
input_name = sanitize_name(input_name)
if(!input_name)
// Invalid/blank names give a randomly generated one.
@@ -1298,18 +1289,17 @@
var/fake_trim_name = "[trim.assignment] ([trim.trim_state])"
trim_list[fake_trim_name] = trim_path
var/selected_trim_path
selected_trim_path = input("Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", selected_trim_path) as null|anything in sort_list(trim_list, /proc/cmp_typepaths_asc)
var/selected_trim_path = tgui_input_list(user, "Select trim to apply to your card.\nNote: This will not grant any trim accesses.", "Forge Trim", sort_list(trim_list, /proc/cmp_typepaths_asc))
if(selected_trim_path)
SSid_access.apply_trim_to_chameleon_card(src, trim_list[selected_trim_path])
var/target_occupation = stripped_input(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels.", "Agent card job assignment", assignment ? assignment : "Assistant", MAX_MESSAGE_LEN)
var/target_occupation = tgui_input_text(user, "What occupation would you like to put on this card?\nNote: This will not grant any access levels.", "Agent card job assignment", assignment ? assignment : "Assistant")
if(target_occupation)
assignment = target_occupation
var/new_age = input(user, "Choose the ID's age:\n([AGE_MIN]-[AGE_MAX])", "Agent card age") as num|null
var/new_age = tgui_input_number(user, "Choose the ID's age", "Agent card age", AGE_MIN, AGE_MAX, AGE_MIN)
if(new_age)
registered_age = max(round(text2num(new_age)), 0)
registered_age = round(new_age)
if(tgui_alert(user, "Activate wallet ID spoofing, allowing this card to force itself to occupy the visible ID slot in wallets?", "Wallet ID Spoofing", list("Yes", "No")) == "Yes")
ADD_TRAIT(src, TRAIT_MAGNETIC_ID_CARD, CHAMELEON_ITEM_TRAIT)

View File

@@ -22,10 +22,14 @@
/obj/item/choice_beacon/proc/generate_options(mob/living/M)
var/list/display_names = generate_display_names()
if(!display_names.len)
if(!length(display_names))
return
var/choice = tgui_input_list(M, "Which item would you like to order?", "Select an Item", display_names)
if(!choice || !M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(isnull(choice))
return
if(isnull(display_names[choice]))
return
if(!M.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
spawn_option(display_names[choice],M)

View File

@@ -455,7 +455,7 @@
if (is_special_type)
return FALSE
var/position = fridges_name_paths.Find(build_path, fridges_name_paths)
position = (position == fridges_name_paths.len) ? 1 : (position + 1)
position = (position == length(fridges_name_paths)) ? 1 : (position + 1)
build_path = fridges_name_paths[position]
to_chat(user, span_notice("You set the board to [fridges_name_paths[build_path]]."))
return TRUE
@@ -564,7 +564,11 @@
display_vending_names_paths = list()
for(var/path in vending_names_paths)
display_vending_names_paths[vending_names_paths[path]] = path
var/choice = input(user, "Choose a new brand", "Select an Item") as null|anything in sort_list(display_vending_names_paths)
var/choice = tgui_input_list(user, "Choose a new brand", "Select an Item", sort_list(display_vending_names_paths))
if(isnull(choice))
return
if(isnull(display_vending_names_paths[choice]))
return
set_type(display_vending_names_paths[choice])
return TRUE
@@ -734,11 +738,13 @@
/obj/item/circuitboard/machine/medical_kiosk/multitool_act(mob/living/user)
. = ..()
var/new_cost = input("Set a new cost for using this medical kiosk.", "New cost", custom_cost) as num|null
if(!new_cost || (loc != user))
var/new_cost = tgui_input_number(user, "New cost for using this medical kiosk", "Pricing", custom_cost, 1000, 10)
if(isnull(new_cost))
return
if(loc != user)
to_chat(user, span_warning("You must hold the circuitboard to change its cost!"))
return
custom_cost = clamp(round(new_cost, 1), 10, 1000)
custom_cost = round(new_cost)
to_chat(user, span_notice("The cost is now set to [custom_cost]."))
/obj/item/circuitboard/machine/medical_kiosk/examine(mob/user)

View File

@@ -140,7 +140,9 @@
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
var/new_style = input(user, "Select a facial hairstyle", "Grooming") as null|anything in GLOB.facial_hairstyles_list
var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list)
if(isnull(new_style))
return
if(!get_location_accessible(H, location))
to_chat(user, span_warning("The mask is in the way!"))
return
@@ -186,7 +188,9 @@
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
var/new_style = input(user, "Select a hairstyle", "Grooming") as null|anything in GLOB.hairstyles_list
var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list)
if(isnull(new_style))
return
if(!get_location_accessible(H, location))
to_chat(user, span_warning("The headgear is in the way!"))
return

View File

@@ -248,7 +248,7 @@
if("select_colour")
. = can_change_colour && select_colour(usr)
if("enter_text")
var/txt = input(usr, "Choose what to write.", "Scribbles", text_buffer) as text|null
var/txt = tgui_input_text(usr, "Choose what to write", "Scribbles", text_buffer)
if(isnull(txt))
return
txt = crayon_text_strip(txt)

View File

@@ -101,7 +101,7 @@
/obj/item/holochip/AltClick(mob/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip?", "Holochip")
var/split_amount = tgui_input_number(user, "How many credits do you want to extract from the holochip?", "Holochip", 1, credits, 1)
if(isnull(split_amount))
return
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))

View File

@@ -618,8 +618,10 @@ GLOBAL_LIST_EMPTY(PDAs)
playsound(src, 'sound/machines/terminal_select.ogg', 15, TRUE)
if("Drone Phone")
var/alert_s = tgui_input_list(U, "Alert severity level", "Ping Drones", list("Low","Medium","High","Critical"))
if(isnull(alert_s))
return
var/area/A = get_area(U)
if(A && alert_s && !QDELETED(U))
if(A && !QDELETED(U))
var/msg = span_boldnotice("NON-DRONE PING: [U.name]: [alert_s] priority alert in [A.name]!")
_alert_drones(msg, TRUE, U)
to_chat(U, msg)
@@ -1264,8 +1266,7 @@ GLOBAL_LIST_EMPTY(PDAs)
plist[avoid_assoc_duplicate_keys(pda.owner, namecounts)] = pda
var/choice = tgui_input_list(user, "Please select a PDA", "PDA Messenger", sort_list(plist))
if (!choice)
if (isnull(choice))
return
var/selected = plist[choice]

View File

@@ -35,11 +35,11 @@
/obj/item/desynchronizer/AltClick(mob/living/user)
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user)))
return
var/new_duration = input(user, "Set the duration (5-300):", "Desynchronizer", duration / 10) as null|num
if(new_duration)
var/new_duration = tgui_input_number(user, "Set the duration", "Desynchronizer", duration / 10, max_duration, 5 SECONDS)
if(isnull(new_duration))
return
new_duration = new_duration SECONDS
new_duration = clamp(new_duration, 50, max_duration)
duration = new_duration
duration = round(new_duration)
to_chat(user, span_notice("You set the duration to [DisplayTimeText(duration)]."))
/obj/item/desynchronizer/proc/desync(mob/living/user)

View File

@@ -24,7 +24,7 @@
user.visible_message(span_notice("[user] paints \the [P] [paint_color]."),span_notice("You paint \the [P] [paint_color]."))
/obj/item/pipe_painter/attack_self(mob/user)
paint_color = tgui_input_list(usr, "Which colour do you want to use?","Pipe painter",GLOB.pipe_paint_colors)
paint_color = tgui_input_list(user, "Which colour do you want to use?", "Pipe painter", GLOB.pipe_paint_colors)
/obj/item/pipe_painter/examine(mob/user)
. = ..()

View File

@@ -19,15 +19,15 @@
else
if(is_zero_amount(delete_if_zero = TRUE))
return
chosen_circuit = input("What type of circuit would you like to remove?", "Choose a Circuit Type", chosen_circuit) in list("airlock","firelock","fire alarm","air alarm","APC","cancel")
chosen_circuit = tgui_input_list(user, "Circuit to remove", "Circuit Removal", list("airlock","firelock","fire alarm","air alarm","APC"), chosen_circuit)
if(isnull(chosen_circuit))
to_chat(user, span_notice("You wisely avoid putting your hands anywhere near [src]."))
return
if(is_zero_amount(delete_if_zero = TRUE))
return
if(loc != user)
return
switch(chosen_circuit)
if("cancel")
to_chat(user, span_notice("You wisely avoid putting your hands anywhere near [src]."))
return
if("airlock")
circuit_type = /obj/item/electronics/airlock
if("firelock")

View File

@@ -917,7 +917,9 @@ GENE SCANNER
options += get_display_name(A)
var/answer = tgui_input_list(user, "Analyze Potential", "Sequence Analyzer", sort_list(options))
if(answer && ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
if(isnull(answer))
return
if(ready && user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
var/sequence
for(var/A in buffer) //this physically hurts but i dont know what anything else short of an assoc list
if(get_display_name(A) == answer)

View File

@@ -29,13 +29,15 @@
return //SKYRAT EDIT ADDITION
var/mob/living/carbon/human/human_target = target
var/beard_or_hair = input(user, "What do you want to dye?", "Character Preference") as null|anything in list("Hair", "Facial Hair")
var/beard_or_hair = tgui_alert(user, "What do you want to dye?", "Character Preference", list("Hair", "Facial Hair"))
if(!beard_or_hair || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE))
return
var/list/choices = beard_or_hair == "Hair" ? GLOB.hair_gradients_list : GLOB.facial_hair_gradients_list
var/new_grad_style = input(user, "Choose a color pattern:", "Character Preference") as null|anything in choices
if(!new_grad_style || !user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE))
var/new_grad_style = tgui_input_list(user, "Choose a color pattern", "Character Preference", choices)
if(isnull(new_grad_style))
return
if(!user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE))
return
var/new_grad_color = input(user, "Choose a secondary hair color:", "Character Preference",human_target.grad_color) as color|null

View File

@@ -69,14 +69,11 @@
detonate()
/obj/item/grenade/c4/attack_self(mob/user)
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num|null
var/newtime = tgui_input_number(usr, "Please set the timer", "C4 Timer", 10, 60000, 10)
if (isnull(newtime))
return
if(user.get_active_held_item() == src)
newtime = clamp(newtime, 10, 60000)
det_time = newtime
det_time = round(newtime)
to_chat(user, "Timer set for [det_time] seconds.")
/obj/item/grenade/c4/afterattack(atom/movable/bomb_target, mob/user, flag)

View File

@@ -139,15 +139,17 @@
names[crewmember_name] = H
name_counts[crewmember_name] = 1
if(!names.len)
if(!length(names))
user.visible_message(span_notice("[user]'s pinpointer fails to detect a signal."), span_notice("Your pinpointer fails to detect a signal."))
return
var/A = input(user, "Person to track", "Pinpoint") in sort_list(names)
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
var/pinpoint_target = tgui_input_list(user, "Person to track", "Pinpoint", sort_list(names))
if(isnull(pinpoint_target))
return
target = names[A]
if(isnull(names[pinpoint_target]))
return
if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return
target = names[pinpoint_target]
toggle_on()
user.visible_message(span_notice("[user] activates [user.p_their()] pinpointer."), span_notice("You activate your pinpointer."))

View File

@@ -40,27 +40,30 @@
* * user The mob that is being teleported
*/
/obj/item/teleportation_scroll/proc/teleportscroll(mob/user)
var/A
A = input(user, "Area to jump to", "BOOYEA", A) as null|anything in GLOB.teleportlocs
if(!src || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !A || !uses)
if(!length(GLOB.teleportlocs))
to_chat(user, span_warning("There are no locations available"))
return
var/area/thearea = GLOB.teleportlocs[A]
var/jump_target = tgui_input_list(user, "Area to jump to", "BOOYEA", GLOB.teleportlocs)
if(isnull(jump_target))
return
if(!src || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !uses)
return
var/area/thearea = GLOB.teleportlocs[jump_target]
var/datum/effect_system/smoke_spread/smoke = new
smoke.set_up(2, user.loc)
smoke.attach(user)
smoke.start()
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
if(!T.is_blocked_turf())
L += T
var/list/possible_locations = list()
for(var/turf/target_turf in get_area_turfs(thearea.type))
if(!target_turf.is_blocked_turf())
possible_locations += target_turf
if(!L.len)
to_chat(user, span_warning("The spell matrix was unable to locate a suitable teleport destination for an unknown reason. Sorry."))
if(!length(possible_locations))
to_chat(user, span_warning("The spell matrix was unable to locate a suitable teleport destination for an unknown reason."))
return
if(do_teleport(user, pick(L), channel = TELEPORT_CHANNEL_MAGIC, forced = TRUE))
if(do_teleport(user, pick(possible_locations), channel = TELEPORT_CHANNEL_MAGIC, forced = TRUE))
smoke.start()
uses--
if(!uses)

View File

@@ -186,8 +186,10 @@
locations["None (Dangerous)"] = PORTAL_LOCATION_DANGEROUS
var/teleport_location_key = input(user, "Please select a teleporter to lock in on.", "Hand Teleporter") as null|anything in locations
if (!teleport_location_key || user.get_active_held_item() != src || user.incapacitated())
var/teleport_location_key = tgui_input_list(user, "Teleporter to lock on", "Hand Teleporter", sort_list(locations))
if (isnull(teleport_location_key))
return
if(user.get_active_held_item() != src || user.incapacitated())
return
// Not always a datum, but needed for IS_WEAKREF_OF to cast properly.
@@ -210,7 +212,7 @@
/// Takes either PORTAL_LOCATION_DANGEROUS or an /obj/machinery/computer/teleport/computer.
/obj/item/hand_tele/proc/try_create_portal_to(mob/user, teleport_location)
if (active_portal_pairs.len >= max_portal_pairs)
if (length(active_portal_pairs) >= max_portal_pairs)
user.show_message(span_notice("[src] is recharging!"))
return

View File

@@ -253,20 +253,24 @@
if (!owner)
owner = user.real_name
if(beacons.len)
if(length(beacons))
beacons.Cut()
for(var/obj/machinery/navbeacon/B in GLOB.wayfindingbeacons)
beacons[B.codes["wayfinding"]] = B
if(!beacons.len)
if(!length(beacons))
to_chat(user, span_notice("Your pinpointer fails to detect a signal."))
return
var/A = tgui_input_list(user, "Select a location", "Pinpoint", sort_list(beacons))
if(!A || QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
var/wayfind_target = tgui_input_list(user, "Select a location", "Pinpoint", sort_list(beacons))
if(isnull(wayfind_target))
return
target = beacons[A]
if(isnull(beacons[wayfind_target]))
to_chat(user, span_warning("Your pinpointer fails to detect a signal."))
return
if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated())
return
target = beacons[wayfind_target]
toggle_on()
to_chat(user, span_notice("You activate your pinpointer."))

View File

@@ -127,7 +127,7 @@
/obj/structure/sign/barsign/proc/pick_sign(mob/user)
var/picked_name = tgui_input_list(user, "Available Signage", "Bar Sign", sort_list(get_bar_names()))
if(!picked_name)
if(isnull(picked_name))
return
chosen_sign = set_sign_by_name(picked_name)
SSblackbox.record_feedback("tally", "barsign_picked", 1, chosen_sign.type)

View File

@@ -41,8 +41,8 @@
/obj/structure/bonfire/attackby(obj/item/used_item, mob/living/user, params)
if(istype(used_item, /obj/item/stack/rods) && !can_buckle && !grill)
var/obj/item/stack/rods/rods = used_item
var/choice = input(user, "What would you like to construct?", "Bonfire") as null|anything in list("Stake","Grill")
if(!choice)
var/choice = tgui_alert(user, "What would you like to construct?", "Bonfire", list("Stake","Grill"))
if(isnull(choice))
return
rods.use(1)
switch(choice)

View File

@@ -67,7 +67,11 @@
if(..())
return
var/list/buildlist = list("Walls and Floors" = RCD_FLOORWALL, "Airlocks" = RCD_AIRLOCK, "Deconstruction" = RCD_DECONSTRUCT, "Windows and Grilles" = RCD_WINDOWGRILLE)
var/buildmode = input(owner, "Set construction mode.", "Base Console", null) in buildlist
var/buildmode = tgui_input_list(owner, "Set construction mode", "Base Console", buildlist)
if(isnull(buildmode))
return
if(isnull(buildlist[buildmode]))
return
check_rcd()
base_console.internal_rcd.construction_mode = buildlist[buildmode]
to_chat(owner, "Build mode is now [buildmode].")

View File

@@ -508,14 +508,14 @@
playsound(src, 'sound/machines/buzz-sigh.ogg', 50, TRUE)
return
var/new_price_input = input(usr,"Set the sale price for this vend-a-tray.","new price",0) as num|null
var/new_price_input = tgui_input_number(usr, "Sale price for this vend-a-tray", "New Price", 10, 1000, 1)
if(isnull(new_price_input) || (payments_acc != potential_acc.registered_account))
to_chat(usr, span_warning("[src] rejects your new price."))
return
if(!usr.canUseTopic(src, BE_CLOSE, FALSE, NO_TK) )
to_chat(usr, span_warning("You need to get closer!"))
return
new_price_input = clamp(round(new_price_input, 1), 10, 1000)
new_price_input = round(new_price_input)
sale_price = new_price_input
to_chat(usr, span_notice("The cost is now set to [sale_price]."))
SStgui.update_uis(src)

View File

@@ -51,7 +51,7 @@
/obj/structure/door_assembly/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/pen))
var/t = tgui_input_text(user, "Enter the name for the door.", name, created_name, MAX_NAME_LEN)
var/t = tgui_input_text(user, "Enter the name for the door", "Airlock Renaming", created_name, MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)

View File

@@ -28,44 +28,47 @@
return
if(!Adjacent(user))//no tele-grooming
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(!ishuman(user))
return
var/mob/living/carbon/human/dressing_human = user
if(H.dna && H.dna.species && (NO_UNDERWEAR in H.dna.species.species_traits))
if(dressing_human.dna && dressing_human.dna.species && (NO_UNDERWEAR in dressing_human.dna.species.species_traits))
to_chat(user, span_warning("You are not capable of wearing underwear."))
return
var/choice = input(user, "Underwear, Undershirt, or Socks?", "Changing") as null|anything in list("Underwear","Underwear Color","Undershirt","Undershirt Color","Socks","Socks Color") //SKYRAT EDIT ADDITION - Colorable Undershirt/Socks
var/choice = tgui_input_list(user, "Underwear, Undershirt, or Socks?", "Changing", list("Underwear", "Underwear Color", "Undershirt", "Socks", "Undershirt Color", "Socks Color")) //SKYRAT EDIT ADDITION - Colorable Undershirt/Socks
if(isnull(choice))
return
if(!Adjacent(user))
return
switch(choice)
if("Underwear")
var/new_undies = input(user, "Select your underwear", "Changing") as null|anything in GLOB.underwear_list
var/new_undies = tgui_input_list(user, "Select your underwear", "Changing", GLOB.underwear_list)
if(new_undies)
H.underwear = new_undies
dressing_human.underwear = new_undies
if("Underwear Color")
var/new_underwear_color = input(H, "Choose your underwear color", "Underwear Color",H.underwear_color) as color|null
var/new_underwear_color = input(dressing_human, "Choose your underwear color", "Underwear Color", dressing_human.underwear_color) as color|null
if(new_underwear_color)
H.underwear_color = sanitize_hexcolor(new_underwear_color)
dressing_human.underwear_color = sanitize_hexcolor(new_underwear_color)
if("Undershirt")
var/new_undershirt = input(user, "Select your undershirt", "Changing") as null|anything in GLOB.undershirt_list
var/new_undershirt = tgui_input_list(user, "Select your undershirt", "Changing", GLOB.undershirt_list)
if(new_undershirt)
H.undershirt = new_undershirt
dressing_human.undershirt = new_undershirt
if("Socks")
var/new_socks = tgui_input_list(user, "Select your socks", "Changing", GLOB.socks_list)
if(new_socks)
dressing_human.socks = new_socks
//SKYRAT EDIT ADDITION BEGIN - Colorable Undershirt/Socks
if("Undershirt Color")
var/new_undershirt_color = input(H, "Choose your undershirt color", "Undershirt Color",H.undershirt_color) as color|null
var/new_undershirt_color = input(dressing_human, "Choose your undershirt color", "Undershirt Color", dressing_human.undershirt_color) as color|null
if(new_undershirt_color)
H.undershirt_color = sanitize_hexcolor(new_undershirt_color)
if("Socks")
var/new_socks = input(user, "Select your socks", "Changing") as null|anything in GLOB.socks_list
if(new_socks)
H.socks= new_socks
dressing_human.undershirt_color = sanitize_hexcolor(new_undershirt_color)
if("Socks Color")
var/new_socks_color = input(H, "Choose your socks color", "Socks Color",H.socks_color) as color|null
var/new_socks_color = input(dressing_human, "Choose your socks color", "Socks Color", dressing_human.socks_color) as color|null
if(new_socks_color)
H.socks_color = sanitize_hexcolor(new_socks_color)
dressing_human.socks_color = sanitize_hexcolor(new_socks_color)
//SKYRAT EDIT ADDITION END - Colorable Undershirt/Socks
add_fingerprint(H)
H.update_body()
add_fingerprint(dressing_human)
dressing_human.update_body()

View File

@@ -178,8 +178,9 @@
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
return
var/new_layer = input("Select a layer", "Layer") as null|anything in layers
if(new_layer)
var/new_layer = tgui_input_list(user, "Select a layer", "Layer", layers)
if(isnull(new_layer))
return
target_layer = layers[new_layer]
///A faster reinforced plunger

View File

@@ -30,21 +30,24 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
//handle facial hair (if necessary)
if(hairdresser.gender != FEMALE)
var/new_style = input(user, "Select a facial hairstyle", "Grooming") as null|anything in GLOB.facial_hairstyles_list
var/new_style = tgui_input_list(user, "Select a facial hairstyle", "Grooming", GLOB.facial_hairstyles_list)
if(isnull(new_style))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE //no tele-grooming
if(new_style)
hairdresser.facial_hairstyle = new_style
else
hairdresser.facial_hairstyle = "Shaved"
//handle normal hair
var/new_style = input(user, "Select a hairstyle", "Grooming") as null|anything in GLOB.hairstyles_list
var/new_style = tgui_input_list(user, "Select a hairstyle", "Grooming", GLOB.hairstyles_list)
if(isnull(new_style))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE //no tele-grooming
if(HAS_TRAIT(hairdresser, TRAIT_BALD))
to_chat(hairdresser, span_notice("If only growing back hair were that easy for you..."))
if(new_style)
hairdresser.hairstyle = new_style
hairdresser.update_hair()
@@ -132,7 +135,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
/obj/structure/mirror/magic/Initialize(mapload)
. = ..()
if(selectable_races.len)
if(length(selectable_races))
return
for(var/datum/species/species_type as anything in subtypesof(/datum/species))
if(initial(species_type.changesource_flags) & race_flags)
@@ -148,14 +151,16 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
var/mob/living/carbon/human/amazed_human = user
var/choice = input(user, "Something to change?", "Magical Grooming") as null|anything in list("name", "race", "gender", "hair", "eyes")
var/choice = tgui_input_list(user, "Something to change?", "Magical Grooming", list("name", "race", "gender", "hair", "eyes"))
if(isnull(choice))
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
switch(choice)
if("name")
var/newname = sanitize_name(stripped_input(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever.
var/newname = sanitize_name(tgui_input_text(amazed_human, "Who are we again?", "Name change", amazed_human.name, MAX_NAME_LEN), allow_numbers = TRUE) //It's magic so whatever.
if(!newname)
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
@@ -168,8 +173,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
amazed_human.mind.name = newname
if("race")
var/racechoice = input(amazed_human, "What are we again?", "Race change") as null|anything in selectable_races
if(!racechoice || !selectable_races[racechoice])
var/racechoice = tgui_input_list(amazed_human, "What are we again?", "Race change", selectable_races)
if(isnull(racechoice))
return TRUE
if(selectable_races[racechoice])
return TRUE
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return TRUE
@@ -178,7 +185,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
amazed_human.set_species(newrace, icon_update = FALSE)
if(amazed_human.dna.species.use_skintones)
var/new_s_tone = input(user, "Choose your skin tone:", "Race change") as null|anything in GLOB.skin_tones
var/new_s_tone = tgui_input_list(user, "Choose your skin tone", "Race change", GLOB.skin_tones)
if(new_s_tone)
amazed_human.skin_tone = new_s_tone
amazed_human.dna.update_ui_block(DNA_SKIN_TONE_BLOCK)
@@ -283,7 +290,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/mirror, 28)
var/turf/user_turf = get_turf(user)
var/list/levels = SSmapping.levels_by_trait(ZTRAIT_SPACE_RUINS)
var/turf/dest
if(levels.len)
if(length(levels))
dest = locate(user_turf.x, user_turf.y, pick(levels))
user_turf.ChangeTurf(/turf/open/chasm, flags = CHANGETURF_INHERIT_AIR)

View File

@@ -98,10 +98,10 @@
if(engraved)
to_chat(user, span_warning("This plaque has already been engraved."))
return
var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization")
var/namechoice = tgui_input_text(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization", max_length = MAX_NAME_LEN)
if(!namechoice)
return
var/descriptionchoice = input(user, "Engrave this plaque's text.", "Plaque Customization")
var/descriptionchoice = tgui_input_text(user, "Engrave this plaque's text", "Plaque Customization")
if(!descriptionchoice)
return
if(!Adjacent(user)) //Make sure user is adjacent still
@@ -130,10 +130,10 @@
if(engraved)
to_chat(user, span_warning("This plaque has already been engraved."))
return
var/namechoice = input(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization")
var/namechoice = tgui_input_text(user, "Title this plaque. (e.g. 'Best HoP Award', 'Great Ashwalker War Memorial')", "Plaque Customization", max_length = MAX_NAME_LEN)
if(!namechoice)
return
var/descriptionchoice = input(user, "Engrave this plaque's text.", "Plaque Customization")
var/descriptionchoice = tgui_input_text(user, "Engrave this plaque's text", "Plaque Customization")
if(!descriptionchoice)
return
if(!Adjacent(user)) //Make sure user is adjacent still

View File

@@ -132,8 +132,8 @@
if(is_editable && istype(I, /obj/item/pen))
if(!length(GLOB.editable_sign_types))
CRASH("GLOB.editable_sign_types failed to populate")
var/choice = input(user, "Select a sign type.", "Sign Customization") as null|anything in GLOB.editable_sign_types
if(!choice)
var/choice = tgui_input_list(user, "Select a sign type", "Sign Customization", GLOB.editable_sign_types)
if(isnull(choice))
return
if(!Adjacent(user)) //Make sure user is adjacent still.
to_chat(user, span_warning("You need to stand next to the sign to change it!"))
@@ -160,14 +160,12 @@
if(is_editable && istype(I, /obj/item/pen))
if(!length(GLOB.editable_sign_types))
CRASH("GLOB.editable_sign_types failed to populate")
var/choice = input(user, "Select a sign type.", "Sign Customization") as null|anything in GLOB.editable_sign_types
if(!choice)
var/choice = tgui_input_list(user, "Select a sign type", "Sign Customization", GLOB.editable_sign_types)
if(isnull(choice))
return
if(!Adjacent(user)) //Make sure user is adjacent still.
to_chat(user, span_warning("You need to stand next to the sign to change it!"))
return
if(!choice)
return
user.visible_message(span_notice("You begin changing [src]."))
if(!do_after(user, 4 SECONDS, target = src))
return

View File

@@ -34,8 +34,10 @@
virgin = FALSE
notify_ghosts("Someone has begun playing with a [src.name] in [get_area(src)]!", source = src, header = "Spirit board")
planchette = input("Choose the letter.", "Seance!") as null|anything in list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")
if(!planchette || !Adjacent(M) || next_use > world.time)
planchette = tgui_input_list(M, "Choose the letter.", "Seance!", list("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"))
if(isnull(planchette))
return
if(!Adjacent(M) || next_use > world.time)
return
M.log_message("picked a letter on [src], which was \"[planchette]\".", LOG_GAME)
next_use = world.time + rand(30,50)

View File

@@ -245,7 +245,7 @@
ae.forceMove(drop_location())
else if(istype(W, /obj/item/pen))
var/t = tgui_input_text(user, "Enter the name for the door.", "Windoor", created_name, MAX_NAME_LEN)
var/t = tgui_input_text(user, "Enter the name for the door", "Windoor Renaming", created_name, MAX_NAME_LEN)
if(!t)
return
if(!in_range(src, usr) && loc != usr)

View File

@@ -44,8 +44,9 @@
var/list/combined = sort_list(logs_present) + sort_list(logs_missing)
var/selected = input("Investigate what?", "Investigate") as null|anything in combined
var/selected = tgui_input_list(src, "Investigate what?", "Investigation", combined)
if(isnull(selected))
return
if(!(selected in combined) || selected == "---")
return

View File

@@ -511,12 +511,12 @@ GLOBAL_PROTECT(admin_verbs_hideable)
set desc = "Cause an explosion of varying strength at your location."
var/list/choices = list("Small Bomb (1, 2, 3, 3)", "Medium Bomb (2, 3, 4, 4)", "Big Bomb (3, 5, 7, 5)", "Maxcap", "Custom Bomb")
var/choice = tgui_input_list(usr, "What size explosion would you like to produce? NOTE: You can do all this rapidly and in an IC manner (using cruise missiles!) with the Config/Launch Supplypod verb. WARNING: These ignore the maxcap", "Drop Bomb", choices)
var/choice = tgui_input_list(src, "What size explosion would you like to produce? NOTE: You can do all this rapidly and in an IC manner (using cruise missiles!) with the Config/Launch Supplypod verb. WARNING: These ignore the maxcap", "Drop Bomb", choices)
if(isnull(choice))
return
var/turf/epicenter = mob.loc
switch(choice)
if(null)
return
if("Small Bomb (1, 2, 3, 3)")
explosion(epicenter, devastation_range = 1, heavy_impact_range = 2, light_impact_range = 3, flash_range = 3, adminlog = TRUE, ignorecap = TRUE, explosion_cause = mob)
if("Medium Bomb (2, 3, 4, 4)")
@@ -800,7 +800,7 @@ GLOBAL_PROTECT(admin_verbs_hideable)
candidates = get_area_turfs(area)
if (candidates.len)
if (length(candidates))
k = 100
do

View File

@@ -167,7 +167,7 @@
if(suit)
suit = new suit //initial() doesn't like lists
options = suit.allowed
if(!options.len) //nothing will happen, but don't let the user think it's broken
if(!length(options)) //nothing will happen, but don't let the user think it's broken
to_chat(owner, span_warning("No options available for the current suit."))
if("belt")
@@ -189,8 +189,12 @@
if("r_pocket")
choose_any_item(slot)
if(length(options))
set_item(slot, tgui_input_list(owner, "Choose an item", OUTFIT_EDITOR_NAME, options))
if(!length(options))
return
var/option = tgui_input_list(owner, "Choose an item", OUTFIT_EDITOR_NAME, options)
if(isnull(option))
return
set_item(slot, option)
#undef OUTFIT_EDITOR_NAME

View File

@@ -58,7 +58,10 @@
owner.holder.load_outfit(owner.mob)
if("copy")
var/datum/outfit/outfit = tgui_input_list(owner, "Pick an outfit to copy from", "Outfit Manager", subtypesof(/datum/outfit))
if(ispath(outfit))
if(isnull(outfit))
return
if(!ispath(outfit))
return
owner.open_outfit_editor(new outfit)
var/datum/outfit/target_outfit = locate(params["outfit"])

View File

@@ -14,7 +14,9 @@
var/random_appearance
/datum/smite/custom_imaginary_friend/configure(client/user)
friend_candidate_client = tgui_input_list(user, "Pick the player to put in control.", "New Imaginary Friend", sort_list(GLOB.clients))
friend_candidate_client = tgui_input_list(user, "Pick the player to put in control", "New Imaginary Friend", sort_list(GLOB.clients))
if(isnull(friend_candidate_client))
return
if(QDELETED(friend_candidate_client))
to_chat(user, span_notice("Selected player no longer has a client, aborting."))

View File

@@ -1596,7 +1596,7 @@
if(!check_rights(R_ADMIN))
return
var/list/type_choices = typesof(/datum/station_goal)
var/picked = tgui_input_list(usr, "Choose goal type",, type_choices)
var/picked = tgui_input_list(usr, "Choose goal type", "Station Goal", type_choices)
if(!picked)
return
var/datum/station_goal/G = new picked()

View File

@@ -322,7 +322,8 @@ GLOBAL_LIST_INIT_TYPED(sdql_spells, /obj/effect/proc_holder/spell, list())
saved_vars[params["name"]] = !saved_vars[params["name"]]
if("path_variable")
var/new_path = tgui_input_list(user, "Select type.", "Add SDQL Spell", typesof(text2path(params["root_path"])))
if(new_path)
if(isnull(new_path))
return
saved_vars[params["name"]] = new_path
var/datum/sample = new new_path
var/list/overrides = list_vars[special_var_lists[params["name"]]]

View File

@@ -153,21 +153,26 @@
usr.forceMove(M.loc)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Get Key") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/sendmob(mob/M in sort_mobs())
/client/proc/sendmob(mob/jumper in sort_mobs())
set category = "Admin.Game"
set name = "Send Mob"
if(!src.holder)
to_chat(src, "Only administrators may use this command.", confidential = TRUE)
return
var/area/A = input(usr, "Pick an area.", "Pick an area") in GLOB.sortedAreas|null
if(A && istype(A))
var/list/turfs = get_area_turfs(A)
if(length(turfs) && M.forceMove(pick(turfs)))
log_admin("[key_name(usr)] teleported [key_name(M)] to [AREACOORD(M)]")
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)] to [AREACOORD(M)]"
if(!length(GLOB.sortedAreas))
to_chat(src, "No areas found.", confidential = TRUE)
return
var/area/target_area = tgui_input_list(src, "Pick an area", "Send Mob", GLOB.sortedAreas)
if(isnull(target_area))
return
if(!istype(target_area))
return
var/list/turfs = get_area_turfs(target_area)
if(length(turfs) && jumper.forceMove(pick(turfs)))
log_admin("[key_name(usr)] teleported [key_name(jumper)] to [AREACOORD(jumper)]")
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(jumper)] to [AREACOORD(jumper)]"
message_admins(msg)
admin_ticket_log(M, msg)
admin_ticket_log(jumper, msg)
else
to_chat(src, "Failed to move mob to a valid location.", confidential = TRUE)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Send Mob") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -84,8 +84,9 @@
return
switch (action)
if ("set_charge")
var/newcharge = input("New charge (0-[borg.cell.maxcharge]):", borg.name, borg.cell.charge) as num|null
if (newcharge)
var/newcharge = tgui_input_number(usr, "Set new charge", borg.name, borg.cell.charge, borg.cell.maxcharge)
if (isnull(newcharge))
return
borg.cell.charge = clamp(newcharge, 0, borg.cell.maxcharge)
message_admins("[key_name_admin(user)] set the charge of [ADMIN_LOOKUPFLW(borg)] to [borg.cell.charge].")
log_silicon("[key_name(user)] set the charge of [key_name(borg)] to [borg.cell.charge].")

View File

@@ -57,7 +57,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(C.key)
available.Add(C)
var/mob/choice = tgui_input_list(usr, "Choose a player to play the pAI", "Spawn pAI", sort_names(available))
if(!choice)
if(isnull(choice))
return
if(!isobserver(choice))
var/confirm = tgui_alert(usr, "[choice.key] isn't ghosting right now. Are you sure you want to yank them out of their body and place them in this pAI?", "Spawn pAI Confirmation", list("Yes", "No"))
@@ -534,8 +534,10 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
set category = "Debug"
set name = "Debug Mob Lists"
set desc = "For when you just gotta know"
switch(tgui_input_list(usr, "Which list?",, list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients")))
var/chosen_list = tgui_input_list(usr, "Which list?", "Select List", list("Players","Admins","Mobs","Living Mobs","Dead Mobs","Clients","Joined Clients"))
if(isnull(chosen_list))
return
switch(chosen_list)
if("Players")
to_chat(usr, jointext(GLOB.player_list,","), confidential = TRUE)
if("Admins")

View File

@@ -1,8 +1,8 @@
/client/proc/manipulate_organs(mob/living/carbon/C in world)
set name = "Manipulate Organs"
set category = "Debug"
var/operation = input("Select organ operation.", "Organ Manipulation", "cancel") as null|anything in list("add organ", "add implant", "drop organ/implant", "remove organ/implant", "cancel")
if (!operation)
var/operation = tgui_input_list(usr, "Select organ operation", "Organ Manipulation", list("add organ", "add implant", "drop organ/implant", "remove organ/implant"))
if (isnull(operation))
return
var/list/organs = list()
@@ -12,8 +12,10 @@
var/dat = replacetext("[path]", "/obj/item/organ/", ":")
organs[dat] = path
var/obj/item/organ/organ = input("Select organ type:", "Organ Manipulation", null) as null|anything in organs
if(!organ)
var/obj/item/organ/organ = tgui_input_list(usr, "Select organ type", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
organ = new organ
@@ -26,8 +28,10 @@
var/dat = replacetext("[path]", "/obj/item/implant/", ":")
organs[dat] = path
var/obj/item/implant/organ = input("Select implant type:", "Organ Manipulation", null) as null|anything in organs
if(!organ)
var/obj/item/implant/organ = tgui_input_list(usr, "Select implant type", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
organ = new organ
@@ -44,12 +48,12 @@
var/obj/item/implant/I = X
organs["[I.name] ([I.type])"] = I
var/obj/item/organ = input("Select organ/implant:", "Organ Manipulation", null) as null|anything in organs
if(!organ)
var/obj/item/organ = tgui_input_list(usr, "Select organ/implant", "Organ Manipulation", organs)
if(isnull(organ))
return
if(isnull(organs[organ]))
return
organ = organs[organ]
if(!organ)
return
var/obj/item/organ/O
var/obj/item/implant/I

View File

@@ -33,7 +33,7 @@
maprotatechoices[mapname] = VM
var/chosenmap = tgui_input_list(usr, "Choose a map to change to", "Change Map", sort_list(maprotatechoices)|"Custom")
if (!chosenmap)
if (isnull(chosenmap))
return
if(chosenmap == "Custom")

View File

@@ -33,8 +33,8 @@
options += "Delete Shuttle"
options += "Into The Sunset (delete & greentext 'escape')"
var/selection = input(user, "Select where to fly [name || id]:", "Fly Shuttle") as null|anything in options
if(!selection)
var/selection = tgui_input_list(user, "Select where to fly [name || id]:", "Fly Shuttle", options)
if(isnull(selection))
return
switch(selection)
@@ -77,8 +77,8 @@
if (canDock(S) == SHUTTLE_CAN_DOCK)
options[S.name || S.id] = S
var/selection = input(user, "Select the new arrivals destination:", "Fly Shuttle") as null|anything in options
if(!selection)
var/selection = tgui_input_list(user, "New arrivals destination", "Fly Shuttle", options)
if(isnull(selection))
return
target_dock = options[selection]
if(!QDELETED(target_dock))

View File

@@ -62,7 +62,9 @@
names += "---Elements---"
names += sort_list(subtypesof(/datum/element), /proc/cmp_typepaths_asc)
var/result = tgui_input_list(usr, "Choose a component/element to add", "Add Component", names)
if(!usr || !result || result == "---Components---" || result == "---Elements---")
if(isnull(result))
return
if(!usr || result == "---Components---" || result == "---Elements---")
return
if(QDELETED(src))
to_chat(usr, "That thing doesn't exist anymore!", confidential = TRUE)
@@ -100,7 +102,9 @@
// We have to list every element here because there is no way to know what element is on this object without doing some sort of hack.
names += sort_list(subtypesof(/datum/element), /proc/cmp_typepaths_asc)
var/path = tgui_input_list(usr, "Choose a component/element to remove. All elements listed here may not be on the datum.", "Remove element", names)
if(!usr || !path || path == "---Components---" || path == "---Elements---")
if(isnull(path))
return
if(!usr || path == "---Components---" || path == "---Elements---")
return
if(QDELETED(src))
to_chat(usr, "That thing doesn't exist anymore!")

View File

@@ -71,7 +71,11 @@
for(var/i in 1 to GLOB.blob_nodes.len)
var/obj/structure/blob/special/node/B = GLOB.blob_nodes[i]
nodes["Blob Node #[i] ([get_area_name(B)])"] = B
var/node_name = input(src, "Choose a node to jump to.", "Node Jump") in nodes
var/node_name = tgui_input_list(src, "Choose a node to jump to", "Node Jump", nodes)
if(isnull(node_name))
return FALSE
if(isnull(nodes[node_name]))
return FALSE
var/obj/structure/blob/special/node/chosen_node = nodes[node_name]
if(chosen_node)
forceMove(chosen_node.loc)

View File

@@ -16,7 +16,7 @@
names += "[prof.name]"
var/chosen_name = tgui_input_list(user, "Target DNA", "Transformation", sort_list(names))
if(!chosen_name)
if(isnull(chosen_name))
return
var/datum/changelingprofile/chosen_prof = changeling.get_dna(chosen_name)

View File

@@ -40,15 +40,15 @@
break
if(rune)
limit = MAX_BLOODCHARGE
if(spells.len >= limit)
if(length(spells) >= limit)
if(rune)
to_chat(owner, span_cultitalic("You cannot store more than [MAX_BLOODCHARGE] spells. <b>Pick a spell to remove.</b>"))
else
to_chat(owner, span_cultitalic("<b><u>You cannot store more than [RUNELESS_MAX_BLOODCHARGE] spells without an empowering rune! Pick a spell to remove.</b></u>"))
var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells)
if(nullify_spell)
qdel(nullify_spell)
if(isnull(nullify_spell))
return
qdel(nullify_spell)
var/entered_spell_name
var/datum/action/innate/cult/blood_spell/BS
var/list/possible_spells = list()
@@ -58,13 +58,15 @@
possible_spells[cult_name] = J
possible_spells += "(REMOVE SPELL)"
entered_spell_name = tgui_input_list(owner, "Blood spell to prepare", "Spell Choices", possible_spells)
if(isnull(entered_spell_name))
return
if(entered_spell_name == "(REMOVE SPELL)")
var/nullify_spell = tgui_input_list(owner, "Spell to remove", "Current Spells", spells)
if(nullify_spell)
qdel(nullify_spell)
if(isnull(nullify_spell))
return
qdel(nullify_spell)
BS = possible_spells[entered_spell_name]
if(QDELETED(src) || owner.incapacitated() || !BS || (rune && !(locate(/obj/effect/rune/empower) in range(1, owner))) || (spells.len >= limit))
if(QDELETED(src) || owner.incapacitated() || !BS || (rune && !(locate(/obj/effect/rune/empower) in range(1, owner))) || (length(spells) >= limit))
return
to_chat(owner,span_warning("You begin to carve unnatural symbols into your flesh!"))
SEND_SOUND(owner, sound('sound/weapons/slice.ogg',0,1,10))
@@ -478,7 +480,7 @@
for(var/obj/effect/rune/teleport/teleport_rune as anything in GLOB.teleport_runes)
potential_runes[avoid_assoc_duplicate_keys(teleport_rune.listkey, teleportnames)] = teleport_rune
if(!potential_runes.len)
if(!length(potential_runes))
to_chat(user, span_warning("There are no valid runes to teleport to!"))
return
@@ -488,6 +490,11 @@
return
var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked
if(isnull(input_rune_key))
return
if(isnull(potential_runes[input_rune_key]))
to_chat(user, span_warning("You must pick a valid rune!"))
return
var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to?
if(QDELETED(src) || !user || !user.is_holding(src) || user.incapacitated() || !actual_selected_rune || !proximity)
return

View File

@@ -162,8 +162,8 @@ Striking a noncultist, however, will tear their flesh."}
/obj/item/cult_bastard/examine(mob/user)
. = ..()
if(contents.len)
. += "<b>There are [contents.len] souls trapped within the sword's core.</b>"
if(length(contents))
. += "<b>There are [length(contents)] souls trapped within the sword's core.</b>"
else
. += "The sword appears to be quite lifeless."
@@ -227,7 +227,7 @@ Striking a noncultist, however, will tear their flesh."}
stone.attack(human_target, user)
if(!LAZYLEN(stone.contents))
qdel(stone)
if(istype(target, /obj/structure/constructshell) && contents.len)
if(istype(target, /obj/structure/constructshell) && length(contents))
var/obj/item/soulstone/stone = contents[1]
if(!istype(stone))
stone.forceMove(drop_location())
@@ -665,7 +665,10 @@ Striking a noncultist, however, will tear their flesh."}
to_chat(user, "That doesn't seem to do anything useful.")
return
if(istype(A, /obj/item))
if(!istype(A, /obj/item))
..()
to_chat(user, span_warning("\The [src] can only transport items!"))
return
var/list/cultists = list()
for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult))
@@ -674,7 +677,7 @@ Striking a noncultist, however, will tear their flesh."}
var/mob/living/cultist_to_receive = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", (cultists - user))
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated())
return
if(!cultist_to_receive)
if(isnull(cultist_to_receive))
to_chat(user, "<span class='cult italic'>You require a destination!</span>")
log_game("Void torch failed - no target")
return
@@ -696,11 +699,6 @@ Striking a noncultist, however, will tear their flesh."}
if(charges == 0)
qdel(src)
else
..()
to_chat(user, span_warning("\The [src] can only transport items!"))
/obj/item/melee/cultblade/halberd
name = "bloody halberd"
desc = "A halberd with a volatile axehead made from crystallized blood. It seems linked to its creator. And, admittedly, more of a poleaxe than a halberd."

View File

@@ -97,10 +97,10 @@ Runes can either be invoked by one's self or with many different cultists. Each
to_chat(user, span_warning("You aren't able to understand the words of [src]."))
return
var/list/invokers = can_invoke(user)
if(invokers.len >= req_cultists)
if(length(invokers) >= req_cultists)
invoke(invokers)
else
to_chat(user, span_danger("You need [req_cultists - invokers.len] more adjacent cultists to use this rune in such a manner."))
to_chat(user, span_danger("You need [req_cultists - length(invokers)] more adjacent cultists to use this rune in such a manner."))
fail_invoke()
/obj/effect/rune/attack_animal(mob/living/simple_animal/user, list/modifiers)
@@ -221,7 +221,7 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/mob/living/M in T)
if(!IS_CULTIST(M))
myriad_targets |= M
if(!myriad_targets.len)
if(!length(myriad_targets))
fail_invoke()
log_game("Offer rune failed - no eligible targets")
return
@@ -250,7 +250,7 @@ structure_check() searches for nearby cultist structures required for the invoca
rune_in_use = FALSE
/obj/effect/rune/convert/proc/do_convert(mob/living/convertee, list/invokers)
if(invokers.len < 2)
if(length(invokers) < 2)
for(var/M in invokers)
to_chat(M, span_warning("You need at least two invokers to convert [convertee]!"))
log_game("Offer rune failed - tried conversion with one invoker")
@@ -307,7 +307,7 @@ structure_check() searches for nearby cultist structures required for the invoca
log_game("Offer rune failed - tried sacrificing already sacrificed target.")
return FALSE
//SKYRAT ADDITION END
if((((ishuman(sacrificial) || iscyborg(sacrificial)) && sacrificial.stat != DEAD) || C.cult_team.is_sacrifice_target(sacrificial.mind)) && invokers.len < 3)
if((((ishuman(sacrificial) || iscyborg(sacrificial)) && sacrificial.stat != DEAD) || C.cult_team.is_sacrifice_target(sacrificial.mind)) && length(invokers) < 3)
for(var/M in invokers)
to_chat(M, span_cultitalic("[sacrificial] is too greatly linked to the world! You need three acolytes!"))
log_game("Offer rune failed - not enough acolytes and target is living or sac target")
@@ -411,7 +411,7 @@ structure_check() searches for nearby cultist structures required for the invoca
if(teleport_rune != src && !is_away_level(teleport_rune.z))
potential_runes[avoid_assoc_duplicate_keys(teleport_rune.listkey, teleportnames)] = teleport_rune
if(!potential_runes.len)
if(!length(potential_runes))
to_chat(user, span_warning("There are no valid runes to teleport to!"))
log_game("Teleport rune failed - no other teleport runes")
fail_invoke()
@@ -425,6 +425,11 @@ structure_check() searches for nearby cultist structures required for the invoca
return
var/input_rune_key = tgui_input_list(user, "Rune to teleport to", "Teleportation Target", potential_runes) //we know what key they picked
if(isnull(input_rune_key))
return
if(isnull(potential_runes[input_rune_key]))
fail_invoke()
return
var/obj/effect/rune/teleport/actual_selected_rune = potential_runes[input_rune_key] //what rune does that key correspond to?
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated() || !actual_selected_rune)
fail_invoke()
@@ -577,13 +582,15 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/mob/living/M in T.contents)
if(IS_CULTIST(M) && (M.stat == DEAD || !M.client || M.client.is_afk()))
potential_revive_mobs |= M
if(!potential_revive_mobs.len)
if(!length(potential_revive_mobs))
to_chat(user, "<span class='cult italic'>There are no dead cultists on the rune!</span>")
log_game("Raise Dead rune failed - no cultists to revive")
fail_invoke()
return
if(potential_revive_mobs.len > 1)
if(length(potential_revive_mobs) > 1)
mob_to_revive = tgui_input_list(user, "Cultist to revive", "Revive Cultist", potential_revive_mobs)
if(isnull(mob_to_revive))
return
else
mob_to_revive = potential_revive_mobs[1]
if(QDELETED(src) || !validness_checks(mob_to_revive, user))
@@ -684,10 +691,14 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/datum/mind/M as anything in get_antag_minds(/datum/antagonist/cult))
if(!(M.current in invokers) && M.current && M.current.stat != DEAD)
cultists |= M.current
if(length(cultists) <= 1)
to_chat(user, span_warning("There are no cultists to summon!"))
fail_invoke()
return
var/mob/living/cultist_to_summon = tgui_input_list(user, "Who do you wish to call to [src]?", "Followers of the Geometer", cultists)
if(!Adjacent(user) || !src || QDELETED(src) || user.incapacitated())
return
if(!cultist_to_summon)
if(isnull(cultist_to_summon))
to_chat(user, "<span class='cult italic'>You require a summoning target!</span>")
fail_invoke()
log_game("Summon Cultist rune failed - no target")
@@ -828,7 +839,7 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/mob/dead/observer/O in T)
if(O.client && !is_banned_from(O.ckey, ROLE_CULTIST) && !QDELETED(src) && !(isAdminObserver(O) && (O.client.prefs.toggles & ADMIN_IGNORE_CULT_GHOST)) && !QDELETED(O))
ghosts_on_rune += O
if(!ghosts_on_rune.len)
if(!length(ghosts_on_rune))
to_chat(user, span_cultitalic("There are no spirits near [src]!"))
fail_invoke()
log_game("Manifest rune failed - no nearby ghosts")
@@ -926,7 +937,7 @@ structure_check() searches for nearby cultist structures required for the invoca
var/mob/living/user = invokers[1]
var/datum/antagonist/cult/user_antag = user.mind.has_antag_datum(/datum/antagonist/cult,TRUE)
var/datum/objective/eldergod/summon_objective = locate() in user_antag.cult_team.objectives
if(summon_objective.summon_spots.len <= 1)
if(length(summon_objective.summon_spots) <= 1)
to_chat(user, span_cultlarge("Only one ritual site remains - it must be reserved for the final summoning!"))
return
if(!(place in summon_objective.summon_spots))
@@ -940,7 +951,7 @@ structure_check() searches for nearby cultist structures required for the invoca
for(var/mob/living/M in GLOB.player_list)
if(IS_CULTIST(M))
intensity++
intensity = max(60, 360 - (360*(intensity/GLOB.player_list.len + 0.3)**2)) //significantly lower intensity for "winning" cults
intensity = max(60, 360 - (360*(intensity/length(GLOB.player_list) + 0.3)**2)) //significantly lower intensity for "winning" cults
var/duration = intensity*10
playsound(T, 'sound/magic/enter_blood.ogg', 100, TRUE)
visible_message(span_warning("A colossal shockwave of energy bursts from the rune, disintegrating it in the process!"))

View File

@@ -338,7 +338,7 @@
if(!rune_ref.resolve())
current_runes -= rune_ref
if(current_runes.len >= max_rune_amt)
if(length(current_runes) >= max_rune_amt)
to_chat(user,span_notice("The blade cannot support more runes!"))
return
@@ -350,7 +350,7 @@
drawing = TRUE
var/type = pick_list[tgui_input_list(user, "Choose the rune", "Rune", pick_list) ]
if(!type)
if(isnull(type))
drawing = FALSE
return

View File

@@ -147,7 +147,7 @@
for(var/atom/requirements as anything in atoms)
fingerprints |= requirements.return_fingerprints()
list_clear_nulls(fingerprints)
if(fingerprints.len == 0)
if(!length(fingerprints))
return FALSE
return TRUE
@@ -160,12 +160,12 @@
compiled_list |= human_to_check.real_name
compiled_list[human_to_check.real_name] = human_to_check
if(compiled_list.len == 0)
if(!length(compiled_list))
to_chat(user, span_warning("These items don't possess the required fingerprints or DNA."))
return FALSE
var/chosen_mob = tgui_input_list(user, "Select the person you wish to curse","Your target", sort_list(compiled_list, /proc/cmp_mob_realname_dsc))
if(!chosen_mob)
var/chosen_mob = tgui_input_list(user, "Select the person you wish to curse", "Eldritch Curse", sort_list(compiled_list, /proc/cmp_mob_realname_dsc))
if(isnull(chosen_mob))
return FALSE
curse(compiled_list[chosen_mob])
addtimer(CALLBACK(src, .proc/uncurse, compiled_list[chosen_mob]),timer)
@@ -292,7 +292,12 @@
if(!targeted)
break
targets["[targeted.current.real_name] the [targeted.assigned_role.title][is_teammate ? " (ally)" : ""]"] = targeted.current
heart.target = targets[input(user,"Choose your next target","Target") in targets]
var/chosen_target = tgui_input_list(user, "Choose a target", "Eldritch Targeting", targets)
if(isnull(chosen_target))
return FALSE
if(isnull(targets[chosen_target]))
return FALSE
heart.target = targets[chosen_target]
qdel(temp_objective)
if(heart.target)
to_chat(user,span_warning("Your new target has been selected, go and sacrifice [heart.target.real_name]!"))

View File

@@ -586,7 +586,9 @@
if(!originator?.linked_mobs[living_owner])
CRASH("Uh oh the mansus link got somehow activated without it being linked to a raw prophet or the mob not being in a list of mobs that should be able to do it.")
var/message = sanitize(input("Message:", "Telepathy from the Manse") as text|null)
var/message = sanitize(tgui_input_text(living_owner, "Enter your message", "Telepathy from the Manse"))
if(!message)
return
if(QDELETED(living_owner))
return
@@ -595,7 +597,7 @@
to_chat(living_owner, span_warning("The link seems to have been severed..."))
Remove(living_owner)
return
if(message)
var/msg = "<i><font color=#568b00>\[Mansus Link\] <b>[living_owner]:</b> [message]</font></i>"
log_directed_talk(living_owner, originator, msg, LOG_SAY, "Mansus Link")
to_chat(originator.linked_mobs, msg)

View File

@@ -81,7 +81,12 @@
for(var/X in subtypesof(/obj/item/eldritch_potion))
var/obj/item/eldritch_potion/potion = X
lst[initial(potion.name)] = potion
var/type = lst[input(user,"Choose your brew","Brew") in lst]
var/chosen_type = tgui_input_list(user, "Choose a brew", "Brewing", lst)
if(isnull(chosen_type))
return
if(isnull(lst[chosen_type]))
return
var/type = lst[chosen_type]
playsound(src, 'sound/misc/desecration-02.ogg', 75, TRUE)
new type(drop_location())
current_mass = 0

View File

@@ -180,11 +180,10 @@
to_chat(user,span_notice("You can't afford this."))
return
var/sniped_amount = painting_metadata.credit_value
var/offer_amount = input(user,"How much do you want to offer ? Minimum : [painting_metadata.credit_value]","Patronage Amount", painting_metadata.credit_value + 1) as num|null
if(account.account_balance < offer_amount)
to_chat(user,span_notice("You can't afford this."))
var/offer_amount = tgui_input_number(user, "How much do you want to offer?", "Patronage Amount", (painting_metadata.credit_value + 1), account.account_balance, painting_metadata.credit_value)
if(isnull(offer_amount))
return
if(!offer_amount || sniped_amount != painting_metadata.credit_value || offer_amount < painting_metadata.credit_value+1 || !user.canUseTopic(src))
if(offer_amount <= 0 || sniped_amount != painting_metadata.credit_value || offer_amount < painting_metadata.credit_value+1 || !user.canUseTopic(src))
return
if(!account.adjust_money(-offer_amount))
to_chat(user,span_warning("Transaction failure. Please try again."))

View File

@@ -14,9 +14,10 @@
. += span_notice("Its channel ID is '[id]'.")
/obj/item/assembly/control/multitool_act(mob/living/user)
var/change_id = input("Set the shutters/blast door/blast door controllers ID. It must be a number between 1 and 100.", "ID", id) as num|null
if(change_id)
id = clamp(round(change_id, 1), 1, 100)
var/change_id = tgui_input_number(user, "Set the door controllers ID", "ID", id, 100, 1)
if(isnull(change_id))
return
id = round(change_id)
to_chat(user, span_notice("You change the ID to [id]."))
/obj/item/assembly/control/activate()

View File

@@ -620,8 +620,10 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
return
switch(action)
if("relabel")
var/label = tgui_input_list(usr, "New canister label", name, GLOB.gas_id_to_canister)
if(label && !..())
var/label = tgui_input_list(usr, "New canister label", "Canister", GLOB.gas_id_to_canister)
if(isnull(label))
return
if(!..())
var/newtype = GLOB.gas_id_to_canister[label]
if(newtype)
var/obj/machinery/portable_atmospherics/canister/replacement = newtype
@@ -684,7 +686,7 @@ GLOBAL_LIST_INIT(gas_id_to_canister, init_gas_id_to_canister())
logmsg += "\n[name]: [gaseslog[name]] moles."
if(n <= 5) //the first five gases added
admin_msg += "\n[name]: [gaseslog[name]] moles."
if(n == 5 && gaseslog.len > 5) //message added if more than 5 gases
if(n == 5 && length(gaseslog) > 5) //message added if more than 5 gases
admin_msg += "\nToo many gases to log. Check investigate log."
if(danger) //sent to admin's chat if contains dangerous gases
message_admins(admin_msg)

View File

@@ -37,9 +37,12 @@
/obj/machinery/artillerycontrol/Topic(href, href_list)
if(..())
return
var/A
A = input("Area to bombard", "Open Fire", A) in GLOB.teleportlocs
var/area/thearea = GLOB.teleportlocs[A]
var/target_area = tgui_input_list(usr, "Area to bombard", "Open Fire", GLOB.teleportlocs)
if(isnull(target_area))
return
if(isnull(GLOB.teleportlocs[target_area]))
return
var/area/thearea = GLOB.teleportlocs[target_area]
if(usr.stat != CONSCIOUS || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED))
return
if(reload < reload_cooldown)
@@ -47,9 +50,9 @@
if(usr.contents.Find(src) || (in_range(src, usr) && isturf(loc)) || issilicon(usr))
priority_announce("Bluespace artillery fire detected. Brace for impact.")
message_admins("[ADMIN_LOOKUPFLW(usr)] has launched an artillery strike.")
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
L+=T
var/loc = pick(L)
explosion(loc, explosiondev, explosionmed, explosionlight, explosion_cause = src)
var/list/possible_turfs = list()
for(var/turf/available_turf in get_area_turfs(thearea.type))
possible_turfs += available_turf
var/random_turf = pick(possible_turfs)
explosion(random_turf, explosiondev, explosionmed, explosionlight, explosion_cause = src)
reload = 0

View File

@@ -45,14 +45,12 @@
if(!isliving(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
var/amount_to_remove = FLOOR(input(user, "How much do you want to withdraw? Current Amount: [money]", "Withdraw Funds", 5) as num|null, 1)
var/amount_to_remove = tgui_input_number(user, "How much do you want to withdraw? Current Amount: [money]", "Withdraw Funds", 5, money, 1)
if(isnull(amount_to_remove))
return
if(!user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
if(!amount_to_remove || amount_to_remove < 0)
return
if(amount_to_remove > money)
to_chat(user, span_warning("There is only [money] credits in [src]"))
if(amount_to_remove <= 0)
return
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)

View File

@@ -285,7 +285,7 @@
return
var/list/expNames = list("Devastation", "Heavy Damage", "Light Damage", "Flame") //Explosions have a range of different types of damage
var/list/boomInput = list()
for (var/i=1 to expNames.len) //Gather input from the user for the value of each type of damage
for (var/i=1 to length(expNames)) //Gather input from the user for the value of each type of damage
boomInput.Add(input("Enter the [expNames[i]] range of the explosion. WARNING: This ignores the bomb cap!", "[expNames[i]] Range", 0) as null|num)
if (isnull(boomInput[i]))
return
@@ -456,7 +456,7 @@
continue
var/sound/found = playing_sound
if (found.file == tempSound.file)
soundLen = found.len
soundLen = length(found)
if (!soundLen)
soundLen = input(holder, "Couldn't auto-determine sound file length. What is the exact length of the sound file, in seconds. This number will be used to line the sound up so that it finishes right as the pod lands!", "Pick a Sound File", 0.3) as null|num
if (isnull(soundLen))
@@ -689,7 +689,7 @@
acceptableTurfs = list()
for (var/t in orderedArea) //Go through the orderedArea list
var/turf/unchecked_turf = t
if (iswallturf(unchecked_turf) || typecache_filter_list_reverse(unchecked_turf.contents, ignored_atoms).len != 0) //if there is something in this turf that isn't in the blacklist, we consider this turf "acceptable" and add it to the acceptableTurfs list
if (iswallturf(unchecked_turf) || length(typecache_filter_list_reverse(unchecked_turf.contents, ignored_atoms))) //if there is something in this turf that isn't in the blacklist, we consider this turf "acceptable" and add it to the acceptableTurfs list
acceptableTurfs.Add(unchecked_turf) //Because orderedArea was an ordered linear list, acceptableTurfs will be as well.
numTurfs ++
@@ -703,7 +703,7 @@
if (iswallturf(accepted_turf))
launchList += accepted_turf
if(LAUNCH_ORDERED) //If we are launching one at a time
if (launchCounter > acceptableTurfs.len) //Check if the launchCounter, which acts as an index, is too high. If it is, reset it to 1
if (launchCounter > length(acceptableTurfs)) //Check if the launchCounter, which acts as an index, is too high. If it is, reset it to 1
launchCounter = 1 //Note that the launchCounter index is incremented in the launch() proc
var/turf/next_turf_in_line = acceptableTurfs[launchCounter]
launchList |= typecache_filter_list_reverse(next_turf_in_line.contents, ignored_atoms) //Filter the specicic turf chosen from acceptableTurfs, and add it to the launchList
@@ -774,7 +774,7 @@
/datum/centcom_podlauncher/proc/updateSelector() //Ensures that the selector effect will showcase the next item if needed
if (launchChoice == LAUNCH_ORDERED && length(acceptableTurfs) > 1 && !temp_pod.reversing && !temp_pod.effectMissile) //We only show the selector if we are taking items from the bay
var/index = (launchCounter == 1 ? launchCounter : launchCounter + 1) //launchCounter acts as an index to the ordered acceptableTurfs list, so adding one will show the next item in the list. We don't want to do this for the very first item tho
if (index > acceptableTurfs.len) //out of bounds check
if (index > length(acceptableTurfs)) //out of bounds check
index = 1
selector.forceMove(acceptableTurfs[index]) //forceMove the selector to the next turf in the ordered acceptableTurfs list
else

View File

@@ -256,7 +256,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
players[displayed_key] = displayed_key
// Check if the list is empty
if(!players.len)
if(!length(players))
// Express that there are no players we can ignore in chat
to_chat(src, "<span class='infoplain'>There are no other players you can ignore!</span>")
@@ -267,10 +267,10 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
players = sort_list(players)
// Request the player to ignore
var/selection = input("Please, select a player!", "Ignore", null, null) as null|anything in players
var/selection = tgui_input_list(src, "Select a player", "Ignore", players)
// Stop running if we didn't receieve a valid selection
if(!selection || !(selection in players))
if(isnull(selection) || !(selection in players))
return
// Store the selected player
@@ -300,7 +300,7 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set desc = "Stop ignoring a player's messages on the OOC channel"
// Check if we've ignored any players
if(!prefs.ignoring.len)
if(!length(prefs.ignoring))
// Express that we haven't ignored any players in chat
to_chat(src, "<span class='infoplain'>You haven't ignored any players!</span>")
@@ -308,10 +308,10 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
return
// Request the player to unignore
var/selection = input("Please, select a player!", "Unignore", null, null) as null|anything in prefs.ignoring
var/selection = tgui_input_list(src, "Select a player", "Unignore", prefs.ignoring)
// Stop running if we didn't receive a selection
if(!selection)
if(isnull(selection))
return
// Check if the selected player is not on our ignore list

View File

@@ -93,12 +93,14 @@
/datum/action/chameleon_outfit/proc/select_outfit(mob/user)
if(!user || !IsAvailable())
return FALSE
var/selected = input("Select outfit to change into", "Chameleon Outfit") as null|anything in outfit_options
var/selected = tgui_input_list(user, "Select outfit to change into", "Chameleon Outfit", outfit_options)
if(isnull(selected))
return FALSE
if(!IsAvailable() || QDELETED(src) || QDELETED(user))
return FALSE
var/outfit_type = outfit_options[selected]
if(!outfit_type)
if(isnull(outfit_options[selected]))
return FALSE
var/outfit_type = outfit_options[selected]
var/datum/outfit/job/O = new outfit_type()
var/list/outfit_types = O.get_chameleon_disguise_info()
var/datum/job/job_datum = SSjob.GetJobType(O.jobtype)
@@ -177,13 +179,12 @@
/datum/action/item_action/chameleon/change/proc/select_look(mob/user)
var/obj/item/picked_item
var/picked_name
picked_name = input("Select [chameleon_name] to change into", "Chameleon [chameleon_name]", picked_name) as null|anything in sort_list(chameleon_list, /proc/cmp_typepaths_asc)
if(!picked_name)
var/picked_name = tgui_input_list(user, "Select [chameleon_name] to change into", "Chameleon Settings", sort_list(chameleon_list, /proc/cmp_typepaths_asc))
if(isnull(picked_name))
return
if(isnull(chameleon_list[picked_name]))
return
picked_item = chameleon_list[picked_name]
if(!picked_item)
return
update_look(user, picked_item)
/datum/action/item_action/chameleon/change/proc/random_look(mob/user)

View File

@@ -47,7 +47,7 @@
hair_overlay.overlays += emissive_blocker(hair_overlay.icon, hair_overlay.icon_state, alpha = hair_overlay.alpha)
/obj/item/clothing/head/wig/attack_self(mob/user)
var/new_style = input(user, "Select a hairstyle", "Wig Styling") as null|anything in (GLOB.hairstyles_list - "Bald")
var/new_style = tgui_input_list(user, "Select a hairstyle", "Wig Styling", GLOB.hairstyles_list - "Bald")
var/newcolor = adjustablecolor ? input(usr,"","Choose Color",color) as color|null : null
if(!user.canUseTopic(src, BE_CLOSE))
return

View File

@@ -251,7 +251,9 @@
return
var/list/modes = list("Off", "Binary vitals", "Exact vitals", "Tracking beacon")
var/switchMode = input("Select a sensor mode:", "Suit Sensor Mode", modes[sensor_mode + 1]) in modes
var/switchMode = tgui_input_list(M, "Select a sensor mode", "Suit Sensors", modes, modes[sensor_mode + 1])
if(isnull(switchMode))
return
if(get_dist(usr, src) > 1)
to_chat(usr, span_warning("You have moved too far away!"))
return

View File

@@ -27,10 +27,10 @@
name = rename_msg
return
else if(choice == "Set the fee")
var/force_fee_input = input(user,"Set the fee!","Set a fee!",0) as num|null
var/force_fee_input = tgui_input_number(user, "Set the fee", "Fee", max_value = 10000)
if(isnull(force_fee_input) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
force_fee = force_fee_input
force_fee = round(force_fee_input)
return
locked = !locked
to_chat(user, span_notice("You [src.locked ? "lock" : "unlock"] the paystand, protecting the bolts from [anchored ? "loosening" : "tightening"]."))

View File

@@ -150,12 +150,12 @@
update_appearance()
return
else
bomb_timer = input(user, "Set the [bomb] timer from [bomb_timer_min] to [bomb_timer_max].", bomb, bomb_timer) as num|null
bomb_timer = tgui_input_number(user, "Set the timer for [bomb].", "Pizza Bomb", bomb_timer, bomb_timer_max, bomb_timer_min)
if (isnull(bomb_timer))
return
bomb_timer = clamp(CEILING(bomb_timer, 1), bomb_timer_min, bomb_timer_max)
bomb_timer = round(bomb_timer)
bomb_defused = FALSE
log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer] seconds")

View File

@@ -737,8 +737,8 @@
if(!(gene.mutability_flags & PLANT_GENE_REMOVABLE))
continue // Don't show genes that can't be removed.
current_traits[gene.name] = gene
var/removed_trait = (input(user, "Select a trait to remove from the [myseed.plantname].", "Plant Trait Removal") as null|anything in sort_list(current_traits))
if(removed_trait == null)
var/removed_trait = tgui_input_list(user, "Trait to remove from the [myseed.plantname]", "Plant Trait Removal", sort_list(current_traits))
if(isnull(removed_trait))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
@@ -818,8 +818,12 @@
for(var/muties in myseed.mutatelist)
var/obj/item/seeds/another_mut = new muties
fresh_mut_list[another_mut.plantname] = muties
var/locked_mutation = (input(user, "Select a mutation to lock.", "Plant Mutation Locks") as null|anything in sort_list(fresh_mut_list))
if(!user.canUseTopic(src, BE_CLOSE) || !locked_mutation)
var/locked_mutation = tgui_input_list(user, "Mutation to lock", "Plant Mutation Locks", sort_list(fresh_mut_list))
if(isnull(locked_mutation))
return
if(isnull(fresh_mut_list[locked_mutation]))
return
if(!user.canUseTopic(src, BE_CLOSE))
return
myseed.mutatelist = list(fresh_mut_list[locked_mutation])
myseed.set_endurance(myseed.endurance/2)

View File

@@ -135,8 +135,8 @@
return
if(length_char(t) >= MUSIC_MAXLINES * MUSIC_MAXLINECHARS)
var/cont = input(usr, "Your message is too long! Would you like to continue editing it?", "", "yes") in list("yes", "no")
if(cont == "no")
var/cont = tgui_alert(usr, "Your message is too long! Would you like to continue editing it?", "Warning", list("Yes", "No"))
if(cont != "Yes")
break
while(length_char(t) > MUSIC_MAXLINES * MUSIC_MAXLINECHARS)
ParseSong(t)
@@ -157,7 +157,7 @@
INVOKE_ASYNC(src, .proc/start_playing, usr)
else if(href_list["newline"])
var/newline = html_encode(input("Enter your line: ", parent.name) as text|null)
var/newline = tgui_input_text(usr, "Enter your line ", parent.name)
if(!newline || !in_range(parent, usr))
return
if(lines.len > MUSIC_MAXLINES)
@@ -174,7 +174,7 @@
else if(href_list["modifyline"])
var/num = round(text2num(href_list["modifyline"]),1)
var/content = stripped_input(usr, "Enter your line: ", parent.name, lines[num], MUSIC_MAXLINECHARS)
var/content = tgui_input_text(usr, "Enter your line ", parent.name, lines[num], MUSIC_MAXLINECHARS)
if(!content || !in_range(parent, usr))
return
if(num > lines.len || num < 1)
@@ -185,22 +185,22 @@
stop_playing()
else if(href_list["setlinearfalloff"])
var/amount = input(usr, "Set linear sustain duration in seconds", "Linear Sustain Duration") as null|num
var/amount = tgui_input_number(usr, "Set linear sustain duration in seconds", "Linear Sustain Duration")
if(!isnull(amount))
set_linear_falloff_duration(amount)
else if(href_list["setexpfalloff"])
var/amount = input(usr, "Set exponential sustain factor", "Exponential sustain factor") as null|num
var/amount = tgui_input_number(usr, "Set exponential sustain factor", "Exponential sustain factor")
if(!isnull(amount))
set_exponential_drop_rate(amount)
else if(href_list["setvolume"])
var/amount = input(usr, "Set volume", "Volume") as null|num
var/amount = tgui_input_number(usr, "Set volume", "Volume")
if(!isnull(amount))
set_volume(amount)
else if(href_list["setdropoffvolume"])
var/amount = input(usr, "Set dropoff threshold", "Dropoff Threshold Volume") as null|num
var/amount = tgui_input_number(usr, "Set dropoff threshold", "Dropoff Threshold Volume")
if(!isnull(amount))
set_dropoff_volume(amount)
@@ -215,12 +215,14 @@
var/datum/instrument/I = SSinstruments.get_instrument(i)
if(I)
LAZYSET(categories[I.category || "ERROR CATEGORY"], I.name, I.id)
var/cat = input(usr, "Select Category", "Instrument Category") as null|anything in categories
if(!cat)
var/cat = tgui_input_list(usr, "Select Category", "Instrument Category", categories)
if(isnull(cat))
return
var/list/instruments = categories[cat]
var/choice = input(usr, "Select Instrument", "Instrument Selection") as null|anything in instruments
if(!choice)
var/choice = tgui_input_list(usr, "Select Instrument", "Instrument Selection", instruments)
if(isnull(choice))
return
if(isnull(instruments[choice]))
return
choice = instruments[choice] //get id
if(choice)
@@ -232,7 +234,7 @@
note_shift = clamp(amount, note_shift_min, note_shift_max)
else if(href_list["setsustainmode"])
var/choice = input(usr, "Choose a sustain mode", "Sustain Mode") as null|anything in SSinstruments.note_sustain_modes
var/choice = tgui_input_list(usr, "Choose a sustain mode", "Sustain Mode", SSinstruments.note_sustain_modes)
if(choice)
sustain_mode = SSinstruments.note_sustain_modes[choice]

View File

@@ -85,7 +85,9 @@
if("grant_language")
if((is_admin || isobserver(AM)) && language_datum)
var/list/choices = list("Only Spoken", "Only Understood", "Both")
var/choice = input(user,"How do you want to add this language?","[language_datum]",null) as null|anything in choices
var/choice = tgui_input_list(user, "How do you want to add this language?", "[language_datum]", choices)
if(isnull(choice))
return
var/spoken = FALSE
var/understood = FALSE
switch(choice)
@@ -108,7 +110,9 @@
if("remove_language")
if((is_admin || isobserver(AM)) && language_datum)
var/list/choices = list("Only Spoken", "Only Understood", "Both")
var/choice = input(user,"Which part do you wish to remove?","[language_datum]",null) as null|anything in choices
var/choice = tgui_input_list(user, "Which part do you wish to remove?", "[language_datum]", choices)
if(isnull(choice))
return
var/spoken = FALSE
var/understood = FALSE
switch(choice)

View File

@@ -113,7 +113,7 @@
if(!user.is_literate())
to_chat(user, span_notice("You scribble illegibly on the side of [src]!"))
return
var/newname = stripped_input(user, "What would you like to title this bookshelf?")
var/newname = tgui_input_text(user, "What would you like to title this bookshelf?", "Bookshelf Renaming", max_length = MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE))
return
if(!newname)
@@ -121,7 +121,7 @@
else
name = "bookcase ([sanitize(newname)])"
else if(I.tool_behaviour == TOOL_CROWBAR)
if(contents.len)
if(length(contents))
to_chat(user, span_warning("You need to remove the books first!"))
else
I.play_tool_sound(src, 100)
@@ -142,9 +142,11 @@
if(load_random_books)
create_random_books(books_to_load, src, FALSE, random_category)
load_random_books = FALSE
if(contents.len)
var/obj/item/book/choice = input(user, "Which book would you like to remove from the shelf?") as null|obj in sort_names(contents.Copy())
if(choice)
if(!length(contents))
return
var/obj/item/book/choice = tgui_input_list(user, "Book to remove from the shelf", "Remove Book", sort_names(contents.Copy()))
if(isnull(choice))
return
if(!(user.mobility_flags & MOBILITY_USE) || user.stat != CONSCIOUS || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !in_range(loc, user))
return
if(ishuman(user))
@@ -169,7 +171,7 @@
if(state == BOOKCASE_UNANCHORED || state == BOOKCASE_ANCHORED)
icon_state = "bookempty"
return ..()
var/amount = contents.len
var/amount = length(contents)
if(load_random_books)
amount += books_to_load
icon_state = "book-[clamp(amount, 0, 5)]"
@@ -249,12 +251,14 @@
if(!literate)
to_chat(user, span_notice("You scribble illegibly on the cover of [src]!"))
return
var/choice = tgui_input_list(usr, "What would you like to change?",,list("Title", "Contents", "Author", "Cancel"))
var/choice = tgui_input_list(usr, "What would you like to change?", "Book Alteration", list("Title", "Contents", "Author", "Cancel"))
if(isnull(choice))
return
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
switch(choice)
if("Title")
var/newtitle = reject_bad_text(stripped_input(user, "Write a new title:"))
var/newtitle = reject_bad_text(tgui_input_text(user, "Write a new title", "Book Title", max_length = 30))
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if (length_char(newtitle) > 30)
@@ -267,7 +271,7 @@
name = newtitle
title = newtitle
if("Contents")
var/content = stripped_input(user, "Write your book's contents (HTML NOT allowed):","","",8192)
var/content = tgui_input_text(user, "Write your book's contents (HTML NOT allowed)", "Book Contents", max_length = 8192, multiline = TRUE)
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if(!content)
@@ -276,7 +280,7 @@
else
dat += content
if("Author")
var/newauthor = stripped_input(user, "Write the author's name:")
var/newauthor = tgui_input_text(user, "Write the author's name", "Author Name", max_length = MAX_NAME_LEN)
if(!user.canUseTopic(src, BE_CLOSE, literate))
return
if(!newauthor)

Some files were not shown because too many files have changed in this diff Show More