mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-18 10:34:10 +01:00
tgui usr to ui.user
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
if("PRG_newtextfile")
|
||||
if(!HDD)
|
||||
return
|
||||
var/newname = sanitize(tgui_input_text(usr, "Enter file name or leave blank to cancel:", "File rename"))
|
||||
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name or leave blank to cancel:", "File rename"))
|
||||
if(!newname)
|
||||
return
|
||||
if(HDD.find_file_by_name(newname))
|
||||
@@ -60,13 +60,13 @@
|
||||
var/datum/computer_file/data/F = computer.find_file_by_uid(open_file)
|
||||
if(!F || !istype(F))
|
||||
return
|
||||
if(F.do_not_edit && (tgui_alert(usr, "WARNING: This file is not compatible with editor. Editing it may result in permanently corrupted formatting or damaged data consistency. Edit anyway?", "Incompatible File", list("No", "Yes")) != "Yes"))
|
||||
if(F.do_not_edit && (tgui_alert(ui.user, "WARNING: This file is not compatible with editor. Editing it may result in permanently corrupted formatting or damaged data consistency. Edit anyway?", "Incompatible File", list("No", "Yes")) != "Yes"))
|
||||
return
|
||||
|
||||
var/oldtext = html_decode(F.stored_data)
|
||||
oldtext = replacetext(oldtext, "\[br\]", "\n")
|
||||
|
||||
var/newtext = sanitize(replacetext(tgui_input_text(usr, "Editing file [F.filename].[F.filetype]. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
|
||||
var/newtext = sanitize(replacetext(tgui_input_text(ui.user, "Editing file [F.filename].[F.filetype]. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
|
||||
if(!newtext)
|
||||
return
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
/**
|
||||
* This is tgui's replacement for Topic(). It handles any user input from the UI.
|
||||
*/
|
||||
/datum/computer_file/program/game/tgui_act(action, list/params)
|
||||
/datum/computer_file/program/game/tgui_act(action, list/params, datum/tgui/ui)
|
||||
if(..()) // Always call parent in tgui_act, it handles making sure the user is allowed to interact with the UI.
|
||||
return TRUE
|
||||
|
||||
@@ -115,8 +115,8 @@
|
||||
if(computer)
|
||||
printer = computer.nano_printer
|
||||
|
||||
// var/gamerSkillLevel = usr.mind?.get_skill_level(/datum/skill/gaming)
|
||||
// var/gamerSkill = usr.mind?.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
|
||||
// var/gamerSkillLevel = ui.user.mind?.get_skill_level(/datum/skill/gaming)
|
||||
// var/gamerSkill = ui.user.mind?.get_skill_modifier(/datum/skill/gaming, SKILL_RANDS_MODIFIER)
|
||||
switch(action)
|
||||
if("Attack")
|
||||
var/attackamt = 0 //Spam prevention.
|
||||
@@ -162,20 +162,20 @@
|
||||
return TRUE
|
||||
if("Dispense_Tickets")
|
||||
if(!printer)
|
||||
to_chat(usr, span_notice("Hardware error: A printer is required to redeem tickets."))
|
||||
to_chat(ui.user, span_notice("Hardware error: A printer is required to redeem tickets."))
|
||||
return
|
||||
if(printer.stored_paper <= 0)
|
||||
to_chat(usr, span_notice("Hardware error: Printer is out of paper."))
|
||||
to_chat(ui.user, span_notice("Hardware error: Printer is out of paper."))
|
||||
return
|
||||
else
|
||||
computer.visible_message(span_infoplain(span_bold("\The [computer]") + " prints out paper."))
|
||||
if(ticket_count >= 1)
|
||||
new /obj/item/stack/arcadeticket((get_turf(computer)), 1)
|
||||
to_chat(usr, span_notice("[src] dispenses a ticket!"))
|
||||
to_chat(ui.user, span_notice("[src] dispenses a ticket!"))
|
||||
ticket_count -= 1
|
||||
printer.stored_paper -= 1
|
||||
else
|
||||
to_chat(usr, span_notice("You don't have any stored tickets!"))
|
||||
to_chat(ui.user, span_notice("You don't have any stored tickets!"))
|
||||
return TRUE
|
||||
if("Start_Game")
|
||||
game_active = TRUE
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
if(downloading || !loaded_article)
|
||||
return
|
||||
|
||||
var/savename = sanitize(tgui_input_text(usr, "Enter file name or leave blank to cancel:", "Save article", loaded_article.filename))
|
||||
var/savename = sanitize(tgui_input_text(ui.user, "Enter file name or leave blank to cancel:", "Save article", loaded_article.filename))
|
||||
if(!savename)
|
||||
return TRUE
|
||||
var/obj/item/computer_hardware/hard_drive/HDD = computer.hard_drive
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/datum/computer_file/program/chatclient/New()
|
||||
username = "DefaultUser[rand(100, 999)]"
|
||||
|
||||
/datum/computer_file/program/chatclient/tgui_act(action, params)
|
||||
/datum/computer_file/program/chatclient/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return
|
||||
|
||||
@@ -47,8 +47,7 @@
|
||||
return TRUE
|
||||
|
||||
channel.add_message(message, username)
|
||||
// var/mob/living/user = usr
|
||||
// user.log_talk(message, LOG_CHAT, tag="as [username] to channel [channel.title]")
|
||||
// ui.user.log_talk(message, LOG_CHAT, tag="as [username] to channel [channel.title]")
|
||||
return TRUE
|
||||
if("PRG_joinchannel")
|
||||
var/new_target = text2num(params["id"])
|
||||
@@ -85,8 +84,7 @@
|
||||
if(channel)
|
||||
channel.remove_client(src) // We shouldn't be in channel's user list, but just in case...
|
||||
return TRUE
|
||||
var/mob/living/user = usr
|
||||
if(can_run(user, TRUE, access_network))
|
||||
if(isliving(ui.user) && can_run(ui.user, TRUE, access_network))
|
||||
for(var/datum/ntnet_conversation/chan as anything in ntnet_global.chat_channels)
|
||||
chan.remove_client(src)
|
||||
netadmin_mode = TRUE
|
||||
|
||||
@@ -134,7 +134,7 @@ var/global/nttransfer_uid = 0
|
||||
if(!remote || !remote.provided_file)
|
||||
return
|
||||
if(remote.server_password)
|
||||
var/pass = sanitize(tgui_input_text(usr, "Code 401 Unauthorized. Please enter password:", "Password required"))
|
||||
var/pass = sanitize(tgui_input_text(ui.user, "Code 401 Unauthorized. Please enter password:", "Password required"))
|
||||
if(pass != remote.server_password)
|
||||
error = "Incorrect Password"
|
||||
return
|
||||
@@ -152,7 +152,7 @@ var/global/nttransfer_uid = 0
|
||||
provided_file = null
|
||||
return TRUE
|
||||
if("PRG_setpassword")
|
||||
var/pass = sanitize(tgui_input_text(usr, "Enter new server password. Leave blank to cancel, input 'none' to disable password.", "Server security", "none"))
|
||||
var/pass = sanitize(tgui_input_text(ui.user, "Enter new server password. Leave blank to cancel, input 'none' to disable password.", "Server security", "none"))
|
||||
if(!pass)
|
||||
return
|
||||
if(pass == "none")
|
||||
|
||||
@@ -74,11 +74,11 @@
|
||||
|
||||
switch(action)
|
||||
if("PRG_txtrpeview")
|
||||
show_browser(usr,"<HTML><HEAD><TITLE>[open_file]</TITLE></HEAD>[pencode2html(loaded_data)]</BODY></HTML>", "window=[open_file]")
|
||||
show_browser(ui.user,"<HTML><HEAD><TITLE>[open_file]</TITLE></HEAD>[pencode2html(loaded_data)]</BODY></HTML>", "window=[open_file]")
|
||||
return TRUE
|
||||
|
||||
if("PRG_taghelp")
|
||||
to_chat(usr, span_notice("The hologram of a googly-eyed paper clip helpfully tells you:"))
|
||||
to_chat(ui.user, span_notice("The hologram of a googly-eyed paper clip helpfully tells you:"))
|
||||
var/help = {"
|
||||
\[br\] : Creates a linebreak.
|
||||
\[center\] - \[/center\] : Centers the text.
|
||||
@@ -104,7 +104,7 @@
|
||||
\[redlogo\] - Inserts red NT logo image.
|
||||
\[sglogo\] - Inserts Solgov insignia image."}
|
||||
|
||||
to_chat(usr, help)
|
||||
to_chat(ui.user, help)
|
||||
return TRUE
|
||||
|
||||
if("PRG_closebrowser")
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
if("PRG_openfile")
|
||||
if(is_edited)
|
||||
if(tgui_alert(usr, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
|
||||
if(tgui_alert(ui.user, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
|
||||
save_file(open_file)
|
||||
browsing = 0
|
||||
if(!open_file(params["PRG_openfile"]))
|
||||
@@ -130,10 +130,10 @@
|
||||
|
||||
if("PRG_newfile")
|
||||
if(is_edited)
|
||||
if(tgui_alert(usr, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
|
||||
if(tgui_alert(ui.user, "Would you like to save your changes first?","Save Changes",list("Yes","No")) == "Yes")
|
||||
save_file(open_file)
|
||||
|
||||
var/newname = sanitize(tgui_input_text(usr, "Enter file name:", "New File"))
|
||||
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name:", "New File"))
|
||||
if(!newname)
|
||||
return TRUE
|
||||
var/datum/computer_file/data/F = create_file(newname)
|
||||
@@ -146,7 +146,7 @@
|
||||
return TRUE
|
||||
|
||||
if("PRG_saveasfile")
|
||||
var/newname = sanitize(tgui_input_text(usr, "Enter file name:", "Save As"))
|
||||
var/newname = sanitize(tgui_input_text(ui.user, "Enter file name:", "Save As"))
|
||||
if(!newname)
|
||||
return TRUE
|
||||
var/datum/computer_file/data/F = create_file(newname, loaded_data)
|
||||
@@ -158,7 +158,7 @@
|
||||
|
||||
if("PRG_savefile")
|
||||
if(!open_file)
|
||||
open_file = sanitize(tgui_input_text(usr, "Enter file name:", "Save As"))
|
||||
open_file = sanitize(tgui_input_text(ui.user, "Enter file name:", "Save As"))
|
||||
if(!open_file)
|
||||
return 0
|
||||
if(!save_file(open_file))
|
||||
@@ -169,7 +169,7 @@
|
||||
var/oldtext = html_decode(loaded_data)
|
||||
oldtext = replacetext(oldtext, "\[br\]", "\n")
|
||||
|
||||
var/newtext = sanitize(replacetext(tgui_input_text(usr, "Editing file '[open_file]'. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
|
||||
var/newtext = sanitize(replacetext(tgui_input_text(ui.user, "Editing file '[open_file]'. You may use most tags used in paper formatting:", "Text Editor", oldtext, MAX_TEXTFILE_LENGTH, TRUE, prevent_enter = TRUE), "\n", "\[br\]"), MAX_TEXTFILE_LENGTH)
|
||||
if(!newtext)
|
||||
return
|
||||
loaded_data = newtext
|
||||
|
||||
Reference in New Issue
Block a user