You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Edit:] Initial conclusions after looking through most of the non-cmds ChatModule code, actually ChatModule isn't all that big? Tbh I wonder if it would be possible to pull "Chat" and "Commands" apart into two Modules and then rewrite those separately :widegladeline:
ideas/plans
I still have that really old chat module rewrite I could revive
Snip want to put an external lock around BroadcastRawCMD calls to prevent ws message race conditions
include message types to stop classifying by colors
might as well plan for client-local chatting with this rewrite too
introduce more fine-grained spam-controls, like to allow rapid "/tp" and "/e" usage
Make a /tp that doesn't send any session data and just goes to same room in same map (...could possibly be local??)
make a /del moderation-command and prefix the last N (30ish?) messages in client chat log with numbers that cycle through; actually make range of numbers 2N so that if you want to delete oldest deletable you don't accidentally delete a brand new message? -> And only show these numbers when /del is typed in; actually just use make completion prompts
should it be possible to fully hide global chat? Must be blocked from participating in it too. Implementation could be linked with a "forced" mode for moderation mutes or something.
I'm wondering if we'll need to keep some minimal implementations of "legacy" (i.e. current) chat message structures around. For when new clients might be connected to old servers and still need to at least accept old chat messages?
And new server chat should probably still at the very least detect old style clients and send them motd or an upgrade notice 🤷
Idk how a chat "protocol" upgrade would go down
Existing ChatModule etc.
related DataTypes
DataChat
fields:
DataPlayerInfo? Player
uintID = 0xffffff
byteVersion = 0
stringTag = ""
stringText = ""
ColorColor = Color.White
DateTime Date = DateTime.UtcNow
DateTime ReceivedDate = DateTime.UtcNow
Written to transport:
(OptRef) Player
(uint) Version & ID packed into one value
(string) Tag
(string) Text
(Color, 3 bytes) Color
(Date in binary = 64-bit integer) Date
Read of the DataType sets CreatedByServer = false and ReceivedDate = DateTime.UtcNow
Filters on Handle & Send for dropping when Text.IsNullOrEmpty()
Server-only fields:
boolCreatedByServer
DataPlayerInfo[]?Targets
DataPlayerInfo?Target (is a property based on Targets)
Where does DataChat show up
ChatModule:
Handle( ... DataEmote) creates a DataChat purely for the PrepareAndLog, logging emotes
Broadcast(...) as called by /bc in-game and chat/chatx wscmd's, plus join/leave messages if enabled
SendTo(...) as called by
ChatCMDEnv.Send used to send all the command server responses
MOTD, Spam-error, WSCMDDissolve
passed into PrepareAndLog by running /cc, /gc and /w (=/r)
FrontendModule:
...
Client:
...
DataCommandList
...
ChatModule
Pretty small besides the Command stuff
ChatModule methods
Init()
instantiate SpamContext
instantiate ChatCommands
add OnSessionStart to Server's OnSessionStart delegate/event
(add OnSessionEnd to existing sessions, I guess on the mythical hot-reload)
Dispose() -- basically opposite of Init()
OnSessionStart(...)
broadcast "join" message if enabled
send MOTD to joining session
send CommandList
set up SpamContext stuff with error-sender
add OnSessionEnd to the session.OnEnd
OnSessionEnd(...)
broadcast "leave" message if enabled
undo spam setup stuff
PrepareAndLog(...)
TODO: does a bunch of funny stuff lol
called from:
DataChat handler here in the module
for logging DataEmote as if they were chat if enabled
SendTo, see above under DataChat section
/gc, /cc and /w to create the corresponding chat messages
Handle(... DataChat)
TODO: Does a bunch of stuff lol
Handle(... DataEmote)
just handled here for the logging part 🤷
Broadcast(...)
see also above under DataChat sections
just creates a "server" DataChat message and shoves it into Handle(DataChat)
SendTo(...)
creates a "server" DataChat to send to specific session (passed through PrepareAndLog)
Just gonna use this for taking notes.
[Edit:] Initial conclusions after looking through most of the non-cmds
ChatModulecode, actually ChatModule isn't all that big?Tbh I wonder if it would be possible to pull "Chat" and "Commands" apart into two Modules and then rewrite those separately:widegladeline:ideas/plans
Thoughts about breaking changes:
Existing ChatModule etc.
related DataTypes
DataChat
uintID =0xffffffbyteVersion =0stringTag =""stringText =""ColorColor =Color.WhiteDateTime.UtcNowDateTime.UtcNowuint) Version & ID packed into one valuestring) Tagstring) TextColor, 3 bytes) ColorDatein binary = 64-bit integer) DateCreatedByServer = falseandReceivedDate = DateTime.UtcNowText.IsNullOrEmpty()boolCreatedByServerDataPlayerInfo[]?TargetsDataPlayerInfo?Target (is a property based on Targets)Where does DataChat show up
Handle( ... DataEmote)creates a DataChat purely for the PrepareAndLog, logging emotesBroadcast(...)as called by/bcin-game andchat/chatxwscmd's, plus join/leave messages if enabledSendTo(...)as called byPrepareAndLogby running/cc,/gcand/w(=/r)DataCommandList
ChatModule
Pretty small besides the Command stuff
ChatModule methods
Init()OnSessionStartto Server's OnSessionStart delegate/eventOnSessionEndto existing sessions, I guess on the mythical hot-reload)Dispose()-- basically opposite ofInit()OnSessionStart(...)OnSessionEndto thesession.OnEndOnSessionEnd(...)PrepareAndLog(...)DataChathandler here in the moduleDataEmoteas if they were chat if enabledSendTo, see above underDataChatsection/gc,/ccand/wto create the corresponding chat messagesHandle(... DataChat)Handle(... DataEmote)Broadcast(...)DataChatsectionsHandle(DataChat)SendTo(...)event Action<ChatModule, DataChat>? OnReceiveevent Action<ChatModule, DataChat>? OnForceSendForceSend(DataChat)