tgui usr to ui.user

This commit is contained in:
Kashargul
2024-11-13 00:49:17 +01:00
parent 49d89c0059
commit 32c9f971bc
120 changed files with 1037 additions and 1061 deletions
+24 -24
View File
@@ -179,13 +179,13 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("scan")
if(scan)
scan.forceMove(loc)
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(scan)
if(ishuman(ui.user) && !ui.user.get_active_hand())
ui.user.put_in_hands(scan)
scan = null
else
var/obj/item/I = usr.get_active_hand()
var/obj/item/I = ui.user.get_active_hand()
if(istype(I, /obj/item/card/id))
usr.drop_item()
ui.user.drop_item()
I.forceMove(src)
scan = I
return TRUE
@@ -195,30 +195,30 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if(check_access(scan))
authenticated = scan.registered_name
rank = scan.assignment
else if(login_type == LOGIN_TYPE_AI && isAI(usr))
authenticated = usr.name
else if(login_type == LOGIN_TYPE_AI && isAI(ui.user))
authenticated = ui.user.name
rank = JOB_AI
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(usr))
authenticated = usr.name
var/mob/living/silicon/robot/R = usr
else if(login_type == LOGIN_TYPE_ROBOT && isrobot(ui.user))
authenticated = ui.user.name
var/mob/living/silicon/robot/R = ui.user
rank = "[R.modtype] [R.braintype]"
return TRUE
if("logout")
if(scan)
scan.forceMove(loc)
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(scan)
if(ishuman(ui.user) && !ui.user.get_active_hand())
ui.user.put_in_hands(scan)
scan = null
authenticated = null
return TRUE
if("remove")
if(copyitem)
if(get_dist(usr, src) >= 2)
to_chat(usr, "\The [copyitem] is too far away for you to remove it.")
if(get_dist(ui.user, src) >= 2)
to_chat(ui.user, "\The [copyitem] is too far away for you to remove it.")
return
copyitem.forceMove(loc)
usr.put_in_hands(copyitem)
to_chat(usr, span_notice("You take \the [copyitem] out of \the [src]."))
ui.user.put_in_hands(copyitem)
to_chat(ui.user, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem = null
if("send_automated_staff_request")
request_roles()
@@ -229,7 +229,7 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
switch(action)
if("rename")
if(copyitem)
var/new_name = tgui_input_text(usr, "Enter new paper title", "This will show up in the preview for staff chat on discord when sending \
var/new_name = tgui_input_text(ui.user, "Enter new paper title", "This will show up in the preview for staff chat on discord when sending \
to central.", copyitem.name, MAX_NAME_LEN)
if(!new_name)
return
@@ -237,9 +237,9 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("send")
if(copyitem)
if (destination in admin_departments)
if(check_if_default_title_and_rename())
if(check_if_default_title_and_rename(ui.user))
return
send_admin_fax(usr, destination)
send_admin_fax(ui.user, destination)
else
sendfax(destination)
@@ -249,14 +249,14 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if("dept")
var/lastdestination = destination
destination = tgui_input_list(usr, "Which department?", "Choose a department", (alldepartments + admin_departments))
destination = tgui_input_list(ui.user, "Which department?", "Choose a department", (alldepartments + admin_departments))
if(!destination)
destination = lastdestination
return TRUE
/obj/machinery/photocopier/faxmachine/proc/check_if_default_title_and_rename()
/obj/machinery/photocopier/faxmachine/proc/check_if_default_title_and_rename(mob/user)
/*
Returns TRUE only on "Cancel" or invalid newname, else returns null/false
Extracted to its own procedure for easier logic handling with paper bundles.
@@ -276,13 +276,13 @@ Extracted to its own procedure for easier logic handling with paper bundles.
else if(copyitem.name != initial(copyitem.name))
return FALSE
var/choice = tgui_alert(usr, "[question_text] improve response time from staff when sending to discord. \
var/choice = tgui_alert(user, "[question_text] improve response time from staff when sending to discord. \
Renaming it changes its preview in staff chat.", \
"Default name detected", list("Change Title","Continue", "Cancel"))
if(!choice || choice == "Cancel")
return TRUE
else if(choice == "Change Title")
var/new_name = tgui_input_text(usr, "Enter new fax title", "This will show up in the preview for staff chat on discord when sending \
var/new_name = tgui_input_text(user, "Enter new fax title", "This will show up in the preview for staff chat on discord when sending \
to central.", copyitem.name, MAX_NAME_LEN)
if(!new_name)
return TRUE
@@ -295,9 +295,9 @@ Extracted to its own procedure for easier logic handling with paper bundles.
O.forceMove(src)
scan = O
else if(O.has_tool_quality(TOOL_MULTITOOL) && panel_open)
var/input = sanitize(tgui_input_text(usr, "What Department ID would you like to give this fax machine?", "Multitool-Fax Machine Interface", department))
var/input = sanitize(tgui_input_text(user, "What Department ID would you like to give this fax machine?", "Multitool-Fax Machine Interface", department))
if(!input)
to_chat(usr, "No input found. Please hang up and try your call again.")
to_chat(user, "No input found. Please hang up and try your call again.")
return
department = input
if( !(("[department]" in alldepartments) || ("[department]" in admin_departments)) && !(department == "Unknown"))
+3 -3
View File
@@ -99,15 +99,15 @@
return list("contents" = files)
/obj/structure/filingcabinet/tgui_act(action, params)
/obj/structure/filingcabinet/tgui_act(action, params, datum/tgui/ui)
if(..())
return TRUE
switch(action)
if("retrieve")
var/obj/item/P = locate(params["ref"])
if(istype(P) && (P.loc == src) && usr.Adjacent(src))
usr.put_in_hands(P)
if(istype(P) && (P.loc == src) && ui.user.Adjacent(src))
ui.user.put_in_hands(P)
open_animation()
SStgui.update_uis(src)
+7 -7
View File
@@ -61,13 +61,13 @@
switch(action)
if("make_copy")
addtimer(CALLBACK(src, PROC_REF(copy_operation), usr), 0)
addtimer(CALLBACK(src, PROC_REF(copy_operation), ui.user), 0)
. = TRUE
if("remove")
if(copyitem)
copyitem.loc = usr.loc
usr.put_in_hands(copyitem)
to_chat(usr, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem.loc = ui.user.loc
ui.user.put_in_hands(copyitem)
to_chat(ui.user, span_notice("You take \the [copyitem] out of \the [src]."))
copyitem = null
else if(has_buckled_mobs())
to_chat(buckled_mobs[1], span_notice("You feel a slight pressure on your ass.")) // It can't eject your asscheeks, but it'll try.
@@ -76,13 +76,13 @@
copies = clamp(text2num(params["num_copies"]), 1, maxcopies)
. = TRUE
if("ai_photo")
if(!issilicon(usr))
if(!issilicon(ui.user))
return
if(stat & (BROKEN|NOPOWER))
return
if(toner >= 5)
var/mob/living/silicon/tempAI = usr
var/mob/living/silicon/tempAI = ui.user
var/obj/item/camera/siliconcam/camera = tempAI.aiCamera
if(!camera)
@@ -376,7 +376,7 @@
if(M.item_is_in_hands(C))
continue
if((C.body_parts_covered & LOWER_TORSO) && !istype(C,/obj/item/clothing/under/permit))
to_chat(usr, span_warning("One needs to not be wearing pants to photocopy one's ass..."))
to_chat(M, span_warning("One needs to not be wearing pants to photocopy one's ass..."))
return FALSE
return TRUE