tm-better-chat icon indicating copy to clipboard operation
tm-better-chat copied to clipboard

Add chat channel API

Open Geekid812 opened this issue 2 years ago • 6 comments
trafficstars

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.

Geekid812 avatar Oct 06 '23 15:10 Geekid812

Note: formatting is weird for some reason. I'll have to update it.

Geekid812 avatar Oct 06 '23 15:10 Geekid812

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.

Geekid812 avatar Nov 07 '23 19:11 Geekid812

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?

codecat avatar Nov 07 '23 20:11 codecat

This is how the channel tab bar is displayed when active: image

Just like the other controls, it is only visible when the Openplanet UI is shown.

Geekid812 avatar Nov 08 '23 18:11 Geekid812

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!

Geekid812 avatar Nov 19 '23 19:11 Geekid812

Gently bumping this PR to get a review, I'm looking to use this API soon. Still looking at this @codecat?

Geekid812 avatar Dec 22 '23 11:12 Geekid812