mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-16 19:53:37 +01:00
1365e6079c
## About The Pull Request As before, more fiddling with NTNRC, more bugs. This time, the same user sending the same message within the same second would cause this message to spawn a new copy each time the channel was opened, until the UI was closed and re-opened. Looking into it, this seemed to be because we would set the `Box`'s `key` value to the message contents: <https://github.com/tgstation/tgstation/blob/b0d71024c0c10a0d276ea3119894c27ca7adf0d0/tgui/packages/tgui/interfaces/NtosNetChat.jsx#L156> Which isn't actually unique. To fix this, we instead make each channel keep track of an incrementing `id` number to assign to each message, and convert the `messages` list to an associative list using those numerical ids stringified. We don't just use the list index as a key, as we later may want to target specific messages, so a consistent unique key is important. This fixes our primary issue. In the process of making the rest of the code account for this, I noticed that the NTNRC program header that's supposed to show new messages in the active channel when the program is idle didn't actually work. Just at all. So I rewrote the entire thing, and it now tracks the last read message's id rather than the full message, and sets this when you actually background the program. The rest still runs on process tick, where it updates the header if there's a new message with a different id on top. Finally, the header part of the UI wasn't actually updating if there were no headers, so now it forwards a lack of headers change as well. ## Why It's Good For The Game Reduces more NTNRC jank. Good if shit like, actually works. ## Changelog 🆑 fix: NTNRC no longer endlessly duplicates messages with duplicate contents upon switching channels. fix: The new message header you get when NTNRC runs in the background actually works. fix: NtOS header actually updates if there are no program headers. /🆑 --------- Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com>