The One Where I Port Modals

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

View File

@@ -129,7 +129,7 @@
var/datum/admins/D = admin_datums[adm_ckey]
if(task == "remove")
if(alert("Are you sure you want to remove [adm_ckey]?","Message","Yes","Cancel") == "Yes")
if(tgui_alert(usr, "Are you sure you want to remove [adm_ckey]?","Message",list("Yes","Cancel")) == "Yes")
if(!D) return
admin_datums -= adm_ckey
D.disassociate()
@@ -141,9 +141,9 @@
else if(task == "rank")
var/new_rank
if(admin_ranks.len)
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in (admin_ranks|"*New Rank*")
new_rank = tgui_input_list(usr, "Please select a rank", "New rank", (admin_ranks|"*New Rank*"))
else
new_rank = input("Please select a rank", "New rank", null, null) as null|anything in list("Game Master","Game Admin", "Trial Admin", "Admin Observer","*New Rank*")
new_rank = tgui_input_list(usr, "Please select a rank", "New rank", list("Game Master","Game Admin", "Trial Admin", "Admin Observer","*New Rank*"))
var/rights = 0
if(D)
@@ -151,7 +151,7 @@
switch(new_rank)
if(null,"") return
if("*New Rank*")
new_rank = input("Please input a new rank", "New custom rank", null, null) as null|text
new_rank = input(usr, "Please input a new rank", "New custom rank", null, null) as null|text
if(config.admin_legacy_system)
new_rank = ckeyEx(new_rank)
if(!new_rank)
@@ -187,7 +187,7 @@
var/list/permissionlist = list()
for(var/i=1, i<=R_MAXPERMISSION, i<<=1) //that <<= is shorthand for i = i << 1. Which is a left bitshift
permissionlist[rights2text(i)] = i
var/new_permission = input("Select a permission to turn on/off", "Permission toggle", null, null) as null|anything in permissionlist
var/new_permission = tgui_input_list(usr, "Select a permission to turn on/off", "Permission toggle", permissionlist)
if(!new_permission) return
D.rights ^= permissionlist[new_permission]
@@ -201,7 +201,7 @@
if(!check_rights(R_ADMIN|R_EVENT)) return
if( ticker.mode.name == "blob" )
alert("You can't call the shuttle during blob!")
tgui_alert_async(usr, "You can't call the shuttle during blob!")
return
switch(href_list["call_shuttle"])
@@ -232,7 +232,7 @@
if(!check_rights(R_SERVER)) return
if (emergency_shuttle.wait_for_launch)
var/new_time_left = input("Enter new shuttle launch countdown (seconds):","Edit Shuttle Launch Time", emergency_shuttle.estimate_launch_time() ) as num
var/new_time_left = input(usr, "Enter new shuttle launch countdown (seconds):","Edit Shuttle Launch Time", emergency_shuttle.estimate_launch_time() ) as num
emergency_shuttle.launch_time = world.time + new_time_left*10
@@ -240,13 +240,13 @@
message_admins("<font color='blue'>[key_name_admin(usr)] edited the Emergency Shuttle's launch time to [new_time_left*10]</font>", 1)
else if (emergency_shuttle.shuttle.has_arrive_time())
var/new_time_left = input("Enter new shuttle arrival time (seconds):","Edit Shuttle Arrival Time", emergency_shuttle.estimate_arrival_time() ) as num
var/new_time_left = input(usr, "Enter new shuttle arrival time (seconds):","Edit Shuttle Arrival Time", emergency_shuttle.estimate_arrival_time() ) as num
emergency_shuttle.shuttle.arrive_time = world.time + new_time_left*10
log_admin("[key_name(usr)] edited the Emergency Shuttle's arrival time to [new_time_left]")
message_admins("<font color='blue'>[key_name_admin(usr)] edited the Emergency Shuttle's arrival time to [new_time_left*10]</font>", 1)
else
alert("The shuttle is neither counting down to launch nor is it in transit. Please try again when it is.")
tgui_alert_async(usr, "The shuttle is neither counting down to launch nor is it in transit. Please try again when it is.")
href_list["secretsadmin"] = "check_antagonist"
@@ -268,7 +268,7 @@
return
var/delmob = 0
switch(alert("Delete old mob?","Message","Yes","No","Cancel"))
switch(tgui_alert(usr, "Delete old mob?","Message",list("Yes","No","Cancel")))
if("Cancel") return
if("Yes") delmob = 1
@@ -304,11 +304,11 @@
var/banfolder = href_list["unbanf"]
Banlist.cd = "/base/[banfolder]"
var/key = Banlist["key"]
if(alert(usr, "Are you sure you want to unban [key]?", "Confirmation", "Yes", "No") == "Yes")
if(tgui_alert(usr, "Are you sure you want to unban [key]?", "Confirmation", list("Yes", "No")) == "Yes")
if(RemoveBan(banfolder))
unbanpanel()
else
alert(usr, "This ban has already been lifted / does not exist.", "Error", "Ok")
tgui_alert_async(usr, "This ban has already been lifted / does not exist.", "Error")
unbanpanel()
else if(href_list["warn"])
@@ -332,7 +332,7 @@
var/duration
switch(alert("Temporary Ban?",,"Yes","No"))
switch(tgui_alert(usr, "Temporary Ban?","Temporary Ban",list("Yes","No")))
if("Yes")
temp = 1
var/mins = 0
@@ -645,7 +645,7 @@
if(M != usr) //we can jobban ourselves
if(M.client && M.client.holder && (M.client.holder.rights & R_BAN)) //they can ban too. So we can't ban them
alert("You cannot perform this action. You must be of a higher administrative rank!")
tgui_alert_async(usr, "You cannot perform this action. You must be of a higher administrative rank!")
return
if(!job_master)
@@ -723,7 +723,7 @@
//Banning comes first
if(notbannedlist.len) //at least 1 unbanned job exists in joblist so we have stuff to ban.
switch(alert("Temporary Ban?",,"Yes","No", "Cancel"))
switch(tgui_alert(usr, "Temporary Ban?","Temporary Ban", list("Yes","No","Cancel")))
if("Yes")
if(!check_rights(R_MOD,0) && !check_rights(R_BAN, 0))
to_chat(usr, "<span class='filter_adminlog warning'> You cannot issue temporary job-bans!</span>")
@@ -795,7 +795,7 @@
for(var/job in joblist)
var/reason = jobban_isbanned(M, job)
if(!reason) continue //skip if it isn't jobbanned anyway
switch(alert("Job: '[job]' Reason: '[reason]' Un-jobban?","Please Confirm","Yes","No"))
switch(tgui_alert(usr, "Job: '[job]' Reason: '[reason]' Un-jobban?","Please Confirm",list("Yes","No")))
if("Yes")
ban_unban_log_save("[key_name(usr)] unjobbanned [key_name(M)] from [job]")
log_admin("[key_name(usr)] unbanned [key_name(M)] from [job]")
@@ -819,7 +819,7 @@
if (ismob(M))
if(!check_if_greater_rights_than(M.client))
return
var/reason = sanitize(input("Please enter reason.") as null|message)
var/reason = sanitize(input(usr, "Please enter reason.") as null|message)
if(!reason)
return
@@ -835,7 +835,7 @@
var/t = href_list["removejobban"]
if(t)
if((alert("Do you want to unjobban [t]?","Unjobban confirmation", "Yes", "No") == "Yes") && t) //No more misclicks! Unless you do it twice.
if((tgui_alert(usr, "Do you want to unjobban [t]?","Unjobban confirmation", list("Yes", "No")) == "Yes") && t) //No more misclicks! Unless you do it twice.
log_admin("[key_name(usr)] removed [t]")
message_admins("<font color='blue'>[key_name_admin(usr)] removed [t]</font>", 1)
jobban_remove(t)
@@ -859,7 +859,7 @@
if(M.client && M.client.holder) return //admins cannot be banned. Even if they could, the ban doesn't affect them anyway
switch(alert("Temporary Ban?",,"Yes","No", "Cancel"))
switch(tgui_alert(usr, "Temporary Ban?","Temporary Ban",list("Yes","No","Cancel")))
if("Yes")
var/mins = input(usr,"How long (in minutes)?","Ban time",1440) as num|null
if(!mins)
@@ -895,7 +895,7 @@
var/reason = sanitize(input(usr,"Reason?","reason","Griefer") as text|null)
if(!reason)
return
switch(alert(usr,"IP ban?",,"Yes","No","Cancel"))
switch(tgui_alert(usr,"IP ban?","IP Ban",list("Yes","No","Cancel")))
if("Cancel") return
if("Yes")
AddBan(M.ckey, M.computer_id, reason, usr.ckey, 0, 0, M.lastKnownIP)
@@ -938,7 +938,7 @@
if(!check_rights(R_ADMIN|R_EVENT)) return
if(ticker && ticker.mode)
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert_async(usr, "The game has already started.")
var/dat = {"<B>What mode do you wish to play?</B><HR>"}
for(var/mode in config.modes)
dat += {"<A href='?src=\ref[src];c_mode2=[mode]'>[config.mode_names[mode]]</A><br>"}
@@ -951,9 +951,9 @@
if(!check_rights(R_ADMIN|R_EVENT)) return
if(ticker && ticker.mode)
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert_async(usr, "The game has already started.")
if(master_mode != "secret")
return alert(usr, "The game mode has to be secret!", null, null, null, null)
return tgui_alert_async(usr, "The game mode has to be secret!")
var/dat = {"<B>What game mode do you want to force secret to be? Use this if you want to change the game mode, but want the players to believe it's secret. This will only work if the current game mode is secret.</B><HR>"}
for(var/mode in config.modes)
dat += {"<A href='?src=\ref[src];f_secret2=[mode]'>[config.mode_names[mode]]</A><br>"}
@@ -965,7 +965,7 @@
if(!check_rights(R_ADMIN|R_SERVER|R_EVENT)) return
if (ticker && ticker.mode)
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert_async(usr, "The game has already started.")
master_mode = href_list["c_mode2"]
log_admin("[key_name(usr)] set the mode as [config.mode_names[master_mode]].")
message_admins("<font color='blue'>[key_name_admin(usr)] set the mode as [config.mode_names[master_mode]].</font>", 1)
@@ -978,9 +978,9 @@
if(!check_rights(R_ADMIN|R_SERVER|R_EVENT)) return
if(ticker && ticker.mode)
return alert(usr, "The game has already started.", null, null, null, null)
return tgui_alert_async(usr, "The game has already started.")
if(master_mode != "secret")
return alert(usr, "The game mode has to be secret!", null, null, null, null)
return tgui_alert_async(usr, "The game mode has to be secret!")
secret_force_mode = href_list["f_secret2"]
log_admin("[key_name(usr)] set the forced secret mode as [secret_force_mode].")
message_admins("<font color='blue'>[key_name_admin(usr)] set the forced secret mode as [secret_force_mode].</font>", 1)
@@ -1018,7 +1018,7 @@
if(!ismob(M))
to_chat(usr, "<span class='filter_adminlog'>this can only be used on instances of type /mob</span>")
var/speech = input("What will [key_name(M)] say?.", "Force speech", "")// Don't need to sanitize, since it does that in say(), we also trust our admins.
var/speech = input(usr, "What will [key_name(M)] say?.", "Force speech", "") // Don't need to sanitize, since it does that in say(), we also trust our admins.
if(!speech) return
M.say(speech)
speech = sanitize(speech) // Nah, we don't trust them
@@ -1028,7 +1028,7 @@
else if(href_list["sendtoprison"])
if(!check_rights(R_ADMIN)) return
if(alert(usr, "Send to admin prison for the round?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Send to admin prison for the round?", "Message", list("Yes", "No")) != "Yes")
return
var/mob/M = locate(href_list["sendtoprison"])
@@ -1078,7 +1078,7 @@
to_chat(usr, "<span class='filter_adminlog warning'>[M] doesn't seem to have an active client.</span>")
return
if(alert(usr, "Send [key_name(M)] back to Lobby?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Send [key_name(M)] back to Lobby?", "Message", list("Yes", "No")) != "Yes")
return
log_admin("[key_name(usr)] has sent [key_name(M)] back to the Lobby.")
@@ -1091,7 +1091,7 @@
else if(href_list["tdome1"])
if(!check_rights(R_FUN)) return
if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return
var/mob/M = locate(href_list["tdome1"])
@@ -1116,7 +1116,7 @@
else if(href_list["tdome2"])
if(!check_rights(R_FUN)) return
if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return
var/mob/M = locate(href_list["tdome2"])
@@ -1141,7 +1141,7 @@
else if(href_list["tdomeadmin"])
if(!check_rights(R_FUN)) return
if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return
var/mob/M = locate(href_list["tdomeadmin"])
@@ -1163,7 +1163,7 @@
else if(href_list["tdomeobserve"])
if(!check_rights(R_FUN)) return
if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes")
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return
var/mob/M = locate(href_list["tdomeobserve"])
@@ -1424,7 +1424,7 @@
to_chat(usr, "<span class='filter_adminlog'>This can only be used on instances of type /mob/living</span>")
return
if(alert(src.owner, "Are you sure you wish to hit [key_name(M)] with Blue Space Artillery?", "Confirm Firing?" , "Yes" , "No") != "Yes")
if(tgui_alert(src.owner, "Are you sure you wish to hit [key_name(M)] with Blue Space Artillery?", "Confirm Firing?", list("Yes", "No")) != "Yes")
return
bluespace_artillery(M,src)
@@ -1522,23 +1522,63 @@
P.adminbrowse()
else if(href_list["jumpto"])
if(!check_rights(R_ADMIN|R_EVENT|R_MOD)) return
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT))
return
if(!config.allow_admin_jump)
tgui_alert_async(usr, "Admin jumping disabled")
return
var/mob/M = locate(href_list["jumpto"])
usr.client.jumptomob(M)
if(!M)
return
var/turf/T = get_turf(M)
if(isturf(T))
usr.on_mob_jump()
usr.forceMove(T)
feedback_add_details("admin_verb","JM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
log_and_message_admins("[key_name_admin(usr)] jumped to [key_name_admin(M)]")
else
to_chat(usr, "<span class='filter_adminlog'>This mob is not located in the game world.</span>")
else if(href_list["getmob"])
if(!check_rights(R_ADMIN|R_EVENT|R_FUN)) return
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT))
return
if(!config.allow_admin_jump)
tgui_alert_async(usr, "Admin jumping disabled")
return
if(tgui_alert(usr, "Confirm?", "Message", list("Yes", "No")) != "Yes")
return
if(alert(usr, "Confirm?", "Message", "Yes", "No") != "Yes") return
var/mob/M = locate(href_list["getmob"])
usr.client.Getmob(M)
if(!M)
return
M.on_mob_jump()
M.forceMove(get_turf(usr))
var/msg = "[key_name_admin(usr)] jumped [key_name_admin(M)] to them"
log_and_message_admins(msg)
admin_ticket_log(M, msg)
feedback_add_details("admin_verb","GM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else if(href_list["sendmob"])
if(!check_rights(R_ADMIN|R_EVENT|R_FUN)) return
if(!check_rights(R_ADMIN|R_MOD|R_DEBUG|R_EVENT))
return
if(!config.allow_admin_jump)
tgui_alert_async(usr, "Admin jumping disabled")
return
var/mob/M = locate(href_list["sendmob"])
usr.client.sendmob(M)
if(!M)
return
var/area/A = tgui_input_list(usr, "Pick an area:", "Send Mob", return_sorted_areas())
if(!A)
return
M.on_mob_jump()
M.forceMove(pick(get_area_turfs(A)))
var/msg = "[key_name_admin(usr)] teleported [ADMIN_LOOKUPFLW(M)]"
log_and_message_admins(msg)
admin_ticket_log(M, msg)
feedback_add_details("admin_verb","SMOB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
else if(href_list["narrateto"])
if(!check_rights(R_ADMIN|R_EVENT|R_FUN)) return
@@ -1556,7 +1596,7 @@
if(!check_rights(R_ADMIN|R_MOD|R_EVENT)) return
if(!ticker || !ticker.mode)
alert("The game hasn't started yet!")
tgui_alert_async(usr, "The game hasn't started yet!")
return
var/mob/M = locate(href_list["traitor"])
@@ -1622,13 +1662,13 @@
paths += path
if(!paths)
alert("The path list you sent is empty")
tgui_alert(usr, "The path list you sent is empty")
return
if(length(paths) > 5)
alert("Select fewer object types, (max 5)")
tgui_alert_async(usr, "Select fewer object types, (max 5)")
return
else if(length(removed_paths))
alert("Removed:\n" + jointext(removed_paths, "\n"))
tgui_alert_async(usr, "Removed:\n" + jointext(removed_paths, "\n"))
var/list/offset = splittext(href_list["offset"],",")
var/number = dd_range(1, 100, text2num(href_list["object_count"]))
@@ -1727,7 +1767,7 @@
if(src.admincaster_feed_channel.channel_name == "" || src.admincaster_feed_channel.channel_name == "\[REDACTED\]" || check )
src.admincaster_screen=7
else
var/choice = alert("Please confirm Feed channel creation","Network Channel Handler","Confirm","Cancel")
var/choice = tgui_alert(usr, "Please confirm Feed channel creation","Network Channel Handler",list("Confirm","Cancel"))
if(choice=="Confirm")
news_network.CreateFeedChannel(admincaster_feed_channel.channel_name, admincaster_signature, admincaster_feed_channel.locked, 1)
feedback_inc("newscaster_channels",1) //Adding channel to the global network
@@ -1739,7 +1779,7 @@
var/list/available_channels = list()
for(var/datum/feed_channel/F in news_network.network_channels)
available_channels += F.channel_name
src.admincaster_feed_channel.channel_name = sanitizeSafe(input(usr, "Choose receiving Feed Channel", "Network Channel Handler") in available_channels )
src.admincaster_feed_channel.channel_name = sanitizeSafe(tgui_input_list(usr, "Choose receiving Feed Channel", "Network Channel Handler", available_channels ))
src.access_news_network()
else if(href_list["ac_set_new_title"])
@@ -1801,7 +1841,7 @@
if(src.admincaster_feed_message.author == "" || src.admincaster_feed_message.body == "")
src.admincaster_screen = 16
else
var/choice = alert("Please confirm Wanted Issue [(input_param==1) ? ("creation.") : ("edit.")]","Network Security Handler","Confirm","Cancel")
var/choice = tgui_alert(usr, "Please confirm Wanted Issue [(input_param==1) ? ("creation.") : ("edit.")]","Network Security Handler",list("Confirm","Cancel"))
if(choice=="Confirm")
if(input_param==1) //If input_param == 1 we're submitting a new wanted issue. At 2 we're just editing an existing one. See the else below
var/datum/feed_message/WANTED = new /datum/feed_message
@@ -1823,7 +1863,7 @@
src.access_news_network()
else if(href_list["ac_cancel_wanted"])
var/choice = alert("Please confirm Wanted Issue removal","Network Security Handler","Confirm","Cancel")
var/choice = tgui_alert(usr, "Please confirm Wanted Issue removal","Network Security Handler",list("Confirm","Cancel"))
if(choice=="Confirm")
news_network.wanted_issue = null
for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
@@ -1947,7 +1987,7 @@
if(href_list["add_player_info"])
var/key = href_list["add_player_info"]
var/add = sanitize(input("Add Player Info") as null|text)
var/add = sanitize(input(usr, "Add Player Info") as null|text)
if(!add) return
notes_add(key,add,usr)