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
+40 -40
View File
@@ -33,7 +33,7 @@
else
switch(text2num(params["option"]))
if(1) // Configure pAI device
pda.pai.attack_self(usr)
pda.pai.attack_self(ui.user)
if(2) // Eject pAI device
var/turf/T = get_turf_or_move(pda.loc)
if(T)
@@ -72,105 +72,105 @@
return TRUE
switch(action)
if("Edit")
var/n = tgui_input_text(usr, "Please enter message", name, notehtml, multiline = TRUE, prevent_enter = TRUE)
if(pda.loc == usr)
var/n = tgui_input_text(ui.user, "Please enter message", name, notehtml, multiline = TRUE, prevent_enter = TRUE)
if(pda.loc == ui.user)
note = adminscrub(n)
notehtml = html_decode(note)
note = replacetext(note, "\n", "<br>")
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Titleset")
var/n = tgui_input_text(usr, "Please enter title", name, notetitle, multiline = FALSE)
if(pda.loc == usr)
var/n = tgui_input_text(ui.user, "Please enter title", name, notetitle, multiline = FALSE)
if(pda.loc == ui.user)
notetitle = adminscrub(n)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Print")
if(pda.loc == usr)
printnote()
if(pda.loc == ui.user)
printnote(ui.user)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
// dumb way to do this, but i don't know how to easily parse this without a lot of silly code outside the switch!
if("Note1")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(1)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note2")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(2)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note3")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(3)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note4")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(4)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note5")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(5)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note6")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(6)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note7")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(7)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note8")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(8)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note9")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(9)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note10")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(10)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note11")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(11)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
if("Note12")
if(pda.loc == usr)
if(pda.loc == ui.user)
changetonote(12)
else
pda.close(usr)
pda.close(ui.user)
return TRUE
/datum/data/pda/app/notekeeper/proc/printnote()
/datum/data/pda/app/notekeeper/proc/printnote(mob/user)
// get active hand of person holding PDA, and print the page to the paper in it
if(istype( usr, /mob/living/carbon/human ))
var/mob/living/carbon/human/H = usr
if(istype( user, /mob/living/carbon/human ))
var/mob/living/carbon/human/H = user
var/obj/item/I = H.get_active_hand()
if(istype(I,/obj/item/paper))
var/obj/item/paper/P = I
@@ -178,12 +178,12 @@
var/titlenote = "Note [alphabet_uppercase[currentnote]]"
if(!isnull(notetitle) && notetitle != "")
titlenote = notetitle
to_chat(usr, span_notice("Successfully printed [titlenote]!"))
to_chat(user, span_notice("Successfully printed [titlenote]!"))
P.set_content( pencode2html(note), titlenote)
else
to_chat(usr, span_notice("You can only print to empty paper!"))
to_chat(user, span_notice("You can only print to empty paper!"))
else
to_chat(usr, span_notice("You must be holding paper for the pda to print to!"))
to_chat(user, span_notice("You must be holding paper for the pda to print to!"))
/datum/data/pda/app/notekeeper/proc/changetonote(var/noteindex)
+5 -5
View File
@@ -86,7 +86,7 @@
active_conversation = null
if("Message")
var/obj/item/pda/P = locate(params["target"])
create_message(usr, P)
create_message(ui.user, P)
if(params["target"] in conversations) // Need to make sure the message went through, if not welp.
active_conversation = params["target"]
if("Select Conversation")
@@ -100,12 +100,12 @@
var/obj/item/pda/P = locate(params["target"])
if(!P)
to_chat(usr, "PDA not found.")
to_chat(ui.user, "PDA not found.")
var/datum/data/pda/messenger_plugin/plugin = locate(params["plugin"])
if(plugin && (plugin in pda.cartridge.messenger_plugins))
plugin.messenger = src
plugin.user_act(usr, P)
plugin.user_act(ui.user, P)
if("Back")
active_conversation = null
@@ -142,7 +142,7 @@
if(last_text && world.time < last_text + 5)
return
if(!pda.can_use(usr))
if(!pda.can_use(U))
return
last_text = world.time
@@ -181,7 +181,7 @@
PM.receive_message(list("sent" = 0, "owner" = "[pda.owner]", "job" = "[pda.ownjob]", "message" = "[t]", "target" = "\ref[pda]"), "\ref[pda]")
SStgui.update_user_uis(U, P) // Update the sending user's PDA UI so that they can see the new message
log_pda("(PDA: [src.name]) sent \"[t]\" to [P.name]", usr)
log_pda("(PDA: [src.name]) sent \"[t]\" to [P.name]", U)
to_chat(U, "[icon2html(pda,U.client)] <b>Sent message to [P.owner] ([P.ownjob]), </b>\"[t]\"")
else
to_chat(U, span_notice("ERROR: Messaging server is not responding."))
+3 -3
View File
@@ -63,8 +63,8 @@
if(..())
return TRUE
add_fingerprint(usr)
usr.set_machine(src)
add_fingerprint(ui.user)
ui.user.set_machine(src)
if(!touch_silent)
playsound(src, 'sound/machines/pda_click.ogg', 20)
@@ -99,7 +99,7 @@
cartridge = null
update_shortcuts()
if("Authenticate")//Checks for ID
id_check(usr, 1)
id_check(ui.user, 1)
if("Retro")
retro_mode = !retro_mode
if("TouchSounds")