tm-better-chat
tm-better-chat copied to clipboard
Add chat channel API
Draft implementation of #65. Quite a lot of changes to break out the initial assumption of BC that only one message destination exists. The draft UI uses tab-like buttons to switch between different chat channels. For the most part, each channel should be isolated, which means some relevant structures have been moved to a ChatChannel class.
This is not completely ready, but I'm submitting it at this stage to get a review on what's been done so far. Implementation is mostly done apart from correctly handling Listeners.
Note: formatting is weird for some reason. I'll have to update it.
I've fixed the remaining showstoppers for the implementation. The gist of changes is:
-
Channels each have a seperate message history. The server channel is always present, custom channels can be created in the exported API. You can switch channels using the channel tab bar, which is only displayed if there are at least 2 active channels. Active channels are counted as all the custom channels, plus one if you are playing on a server.
-
All checks and functions related to the server chat can only target the server channel. Listeners are also only able to listen on the server channel for API compatibility. Commands can work anywhere however.
I have written a small script that can be used to test the new functionality: bc-channels.as. It's also an example of the expected usage of the API.
Very nice! I will do my best to review this properly soon, but I'm very busy recently so no guarantees. Feel free to ping me in a week if I haven't checked it out yet.
Do you have some screenshots of what this looks like in-game?
This is how the channel tab bar is displayed when active:
Just like the other controls, it is only visible when the Openplanet UI is shown.
Hey, it's been a fair bit more than a week now, so just a reminder for you to check this out when you can. Thanks!
Gently bumping this PR to get a review, I'm looking to use this API soon. Still looking at this @codecat?