diff --git a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm index 2761b504950..3c4a922b49b 100644 --- a/code/modules/modular_computers/file_system/programs/ntnrc_client.dm +++ b/code/modules/modular_computers/file_system/programs/ntnrc_client.dm @@ -1,11 +1,13 @@ #define USERNAME_SIZE 32 -#define CHANNELNAME_SIZE 12 +#define CHANNELNAME_SIZE 18 #define MESSAGE_SIZE 2048 +#define PING_COOLDOWN_TIME (3 SECONDS) + /datum/computer_file/program/chatclient filename = "ntnrc_client" filedesc = "Chat Client" - category = PROGRAM_CATEGORY_MISC + category = PROGRAM_CATEGORY_CREW program_icon_state = "command" extended_desc = "This program allows communication over NTNRC network" size = 8 @@ -27,6 +29,8 @@ var/netadmin_mode = FALSE ///All NTnet conversations the application is apart of. var/list/datum/ntnet_conversation/conversations = list() + ///Cooldown timer between pings. + COOLDOWN_DECLARE(ping_cooldown) /datum/computer_file/program/chatclient/New() username = "DefaultUser[rand(100, 999)]" @@ -165,10 +169,13 @@ channel.mute_user(src, muted) return TRUE if("PRG_ping_user") - if(!authed) + if(!COOLDOWN_FINISHED(src, ping_cooldown)) + return + if(src in channel.muted_clients) return var/datum/computer_file/program/chatclient/pinged = locate(params["ref"]) in channel.active_clients + channel.offline_clients channel.ping_user(src, pinged) + COOLDOWN_START(src, ping_cooldown, PING_COOLDOWN_TIME) return TRUE /datum/computer_file/program/chatclient/process_tick(delta_time) @@ -249,9 +256,9 @@ data["strong"] = channel.strong data["clients"] = clients var/list/messages = list() - for(var/message in channel.messages) + for(var/i=channel.messages.len to 1 step -1) messages.Add(list(list( - "msg" = message, + "msg" = channel.messages[i], ))) data["messages"] = messages data["is_operator"] = (channel.channel_operator == src) || netadmin_mode @@ -262,3 +269,5 @@ #undef USERNAME_SIZE #undef CHANNELNAME_SIZE #undef MESSAGE_SIZE + +#undef PING_COOLDOWN_TIME diff --git a/tgui/packages/tgui/interfaces/NtosNetChat.js b/tgui/packages/tgui/interfaces/NtosNetChat.js index bf9dfc4e763..8b401f9c149 100644 --- a/tgui/packages/tgui/interfaces/NtosNetChat.js +++ b/tgui/packages/tgui/interfaces/NtosNetChat.js @@ -7,15 +7,7 @@ const CLIENT_ONLINE = 2; const CLIENT_AWAY = 1; const CLIENT_OFFLINE = 0; -const STATUS2TEXT = { - 0: 'Offline', - 1: 'Away', - 2: 'Online', -}; - const NoChannelDimmer = (props, context) => { - const { act, data } = useBackend(context); - const { owner } = data; return ( @@ -36,7 +28,8 @@ const NoChannelDimmer = (props, context) => { Click a channel to start chatting! - (If you're new, you may wannaa set your name in the bottom left!) + (If you're new, you may want to set your name in the bottom + left!)