NTnrc improvements (pings, messages, spellcheck & category) (#70885)

## About The Pull Request

Changes in this PR:
- Anyone can ping others, not only the Administrator. More people than
just the Admin need to get people's attention.
- Pings now have a 3 second cooldown delay, so you can no longer spam
it. You also can't ping if you're muted.
- The chat program is now under the Crew section of the store, rather
than 'Misc', because it's a crew thing wtf?
- Messages are now shown with the latest on top, removing the need in
the past to scroll down to see new messages.
- I also increased the channel name character limit by 6 so people have
some more leeway in their names.


![image](https://user-images.githubusercontent.com/53777086/198833518-44af276c-9600-4e1c-b15e-484eb93fc8ec.png)

## Why It's Good For The Game

Makes the NTnrc app more bearable to use and makes people actually able
to get other client's attention, and gives the Admins more 'power' over
their channel.

## Changelog

🆑
qol: The chat client is now listed under 'Crew' instead of 'Misc' in the
store.
qol: The chat client now allows anyone to use the ping feature, as long
as they aren't server muted.
qol: The chat client's messaging system now shows the latest messages on
top, rather than bottom. No more scrolling!
qol: The chat client now has a ping spam-prevention feature.
/🆑
This commit is contained in:
John Willard
2022-11-22 02:00:19 -05:00
committed by GitHub
parent 021e56f8ff
commit e844c5e910
2 changed files with 16 additions and 14 deletions
@@ -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