diff --git a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm index 6c440422970..a6f30fdec83 100644 --- a/code/modules/modular_computers/NTNet/NTNRC/conversation.dm +++ b/code/modules/modular_computers/NTNet/NTNRC/conversation.dm @@ -157,7 +157,11 @@ var/global/ntnrc_uid = 0 if(newPassword) password = newPassword else - password = FALSE + password = null + + var/datum/ntnet_message/new_password/msg = new() + msg.nuser = operator + process_message(msg) /datum/ntnet_conversation/proc/cl_kick(var/datum/computer_file/program/chat_client/Cl, var/datum/ntnet_user/target) if(!istype(Cl) || !istype(Cl.my_user) || !can_manage(Cl) || !(target in users) || direct) diff --git a/code/modules/modular_computers/NTNet/NTNRC/message.dm b/code/modules/modular_computers/NTNet/NTNRC/message.dm index 97efbafe82c..90ec350bdf1 100644 --- a/code/modules/modular_computers/NTNet/NTNRC/message.dm +++ b/code/modules/modular_computers/NTNet/NTNRC/message.dm @@ -36,7 +36,10 @@ . = "([sanitize(Conv.get_title(Cl))]) [nuser.username]: [sanitize(message)] (Reply)" /datum/ntnet_message/message/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] [nuser.username]: [message]" + var/conversation_message_length = length(Conv.messages) + var/last_message = conversation_message_length ? Conv.messages[conversation_message_length] : null + var/should_add_spacer = last_message ? !findtext(last_message, nuser.username + ":") : FALSE + . = "[should_add_spacer ? "\n" : ""][worldtime2text()] [nuser.username]: [message]" /datum/ntnet_message/message/format_admin_log(var/datum/ntnet_conversation/Conv) . = message @@ -50,7 +53,7 @@ . = FONT_SMALL("([sanitize(Conv.get_title(Cl))]) [nuser.username] has entered the chat.") /datum/ntnet_message/join/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has entered the chat." + . = "\n[worldtime2text()] -!- [nuser.username] has entered the chat." @@ -58,20 +61,22 @@ . = FONT_SMALL("([sanitize(Conv.get_title(Cl))]) [nuser.username] has left the chat.") /datum/ntnet_message/leave/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has left the chat." + . = "\n[worldtime2text()] -!- [nuser.username] has left the chat." /datum/ntnet_message/new_op/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has become operator." + . = "\n[worldtime2text()] -!- [nuser.username] has become operator." +/datum/ntnet_message/new_password/format_chat_log(var/datum/ntnet_conversation/Conv) + . = "\n[worldtime2text()] -!- [nuser.username] has [Conv.password ? "updated" : "removed"] the channel's password." /datum/ntnet_message/new_title var/title = "" /datum/ntnet_message/new_title/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has changed channel title from [Conv.get_title()] to [title]" + . = "\n[worldtime2text()] -!- [nuser.username] has changed channel title from [Conv.get_title()] to [title]" /datum/ntnet_message/new_title/format_chat_notification(var/datum/ntnet_conversation/Conv, var/datum/computer_file/program/chat_client/Cl) . = FONT_SMALL("([sanitize(Conv.get_title(Cl))]) [nuser.username] has changed the channel title to [sanitize(title)].") @@ -82,7 +87,7 @@ var/datum/ntnet_user/target /datum/ntnet_message/kick/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has kicked [target.username] from conversation." + . = "\n[worldtime2text()] -!- [nuser.username] has kicked [target.username] from conversation." /datum/ntnet_message/kick/format_chat_notification(var/datum/ntnet_conversation/Conv, var/datum/computer_file/program/chat_client/Cl) . = FONT_SMALL("([sanitize(Conv.get_title(Cl))]) [nuser.username] has kicked [target.username] from conversation.") @@ -90,7 +95,7 @@ /datum/ntnet_message/direct/format_chat_log(var/datum/ntnet_conversation/Conv) - . = "[worldtime2text()] -!- [nuser.username] has opened direct conversation." + . = "\n[worldtime2text()] -!- [nuser.username] has opened direct conversation." /datum/ntnet_message/direct/format_chat_notification(var/datum/ntnet_conversation/Conv, var/datum/computer_file/program/chat_client/Cl) . = FONT_SMALL("([sanitize(Conv.get_title(Cl))]) [nuser.username] has opened direct conversation with you.") diff --git a/code/modules/modular_computers/NTNet/NTNRC/ntnrc.dm b/code/modules/modular_computers/NTNet/NTNRC/ntnrc.dm index ec2258273be..54e1fc7be97 100644 --- a/code/modules/modular_computers/NTNet/NTNRC/ntnrc.dm +++ b/code/modules/modular_computers/NTNet/NTNRC/ntnrc.dm @@ -26,3 +26,5 @@ var/datum/ntnet_message/direct/msg = new(Cl) Conv.process_message(msg) + + return Conv diff --git a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm index c1534fa5935..b9d599a9b4e 100644 --- a/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/generic/ntnrc_client.dm @@ -254,6 +254,7 @@ else conv.cl_join(src) computer.update_static_data_for_all_viewers() + active = conv . = TRUE if(action == "set_active") @@ -298,8 +299,9 @@ . = TRUE if(action == "new_channel") - GLOB.ntnet_global.begin_conversation(src, sanitize(params["new_channel"])) + var/datum/ntnet_conversation/conversation = GLOB.ntnet_global.begin_conversation(src, sanitize(params["new_channel"])) computer.update_static_data_for_all_viewers() + active = conversation . = TRUE if(action == "delete") @@ -312,8 +314,9 @@ if(action == "direct") var/datum/ntnet_user/tUser = locate(params["direct"]) - GLOB.ntnet_global.begin_direct(src, tUser) + var/datum/ntnet_conversation/conversation = GLOB.ntnet_global.begin_direct(src, tUser) computer.update_static_data_for_all_viewers() + active = conversation . = TRUE if(action == "toggleadmin") diff --git a/html/changelogs/geeves-pda_chat_improvements.yml b/html/changelogs/geeves-pda_chat_improvements.yml new file mode 100644 index 00000000000..65d296c9b0c --- /dev/null +++ b/html/changelogs/geeves-pda_chat_improvements.yml @@ -0,0 +1,8 @@ +author: Geeves + +delete-after: True + +changes: + - qol: "Made a bunch of improvements to the PDA chat program. Clicking on someone or a channel's name will now immediately open the chat. Text inputs will now not input unless you press enter." + - qol: "PDA chat messages will now have spaces between them, unless it's the same person sending multiple messages in a row." + - qol: "Updating a PDA chat channel's password will now output that it changed into the chat." diff --git a/tgui/packages/tgui/interfaces/ChatClient.tsx b/tgui/packages/tgui/interfaces/ChatClient.tsx index 63ee95879b5..c9969851e81 100644 --- a/tgui/packages/tgui/interfaces/ChatClient.tsx +++ b/tgui/packages/tgui/interfaces/ChatClient.tsx @@ -106,16 +106,15 @@ export const Users = (props, context) => { return (
- + act('set_active', { set_active: null })}> All - {data.channels && - data.channels.length && - data.channels + {data.channels?.length + ? data.channels .filter((chn) => chn.can_interact) .map((channel) => ( { }> {channel.title} - ))} + )) + : null}
{data.active && data.active.can_interact ? : } @@ -183,11 +183,25 @@ export const Chat = (props, context) => { `newMessage`, `` ); + + const [creatingJoinPassword, setCreatingJoinPassword] = useLocalState( + context, + 'creatingJoinPassword', + 0 + ); + const [password, setPassword] = useLocalState( context, `password`, `` ); + + const [creatingTitle, setCreatingTitle] = useLocalState( + context, + 'creatingTitle', + 0 + ); + const [title, setTitle] = useLocalState(context, `title`, ``); return ( @@ -199,40 +213,49 @@ export const Chat = (props, context) => { <>
);