TTT2
TTT2 copied to clipboard
RFC: MSTACK Toasts
Is your feature request related to a problem? Please describe.
- MSTACK spams a lot of messages which disappear relatively quickly.
- Counter-intuitively, it also quickly fills the screen with information that can limit visibility.
- The MSTACK should have an ability to refresh existing notifications to minimize noise.
Describe the solution you'd like
Goal
- The player gets a notification on a subject.
- When a new notification on the same subject arrives, it "refreshes" the message timer and visually moves up the stack.
Implementation
An API similar to:
local uuid = MSTACK:AddMessage("win_showreport")
-- some time in the future:
MSTACK:UpdateMessage(uuid, "round_begintime")
-- further still:
MSTACK:UpdateMessage(uuid, "round_selected")
MSTACK:UpdateMessage(uuid, "round_started")
or something like:
-- completely hypothetical server-sided code:
notif.Push("round_state", "round_begintime")
-- later:
notif.Push("round_state", "round_selected")
notif.Push("round_state", "round_started")
which on the client, would manifest as:
MSTACK.keys = {}
local function notif()
local key = net.ReadString()
local msg = net.ReadString()
local uuid = MSTACK.keys[key]
if uuid then
MSTACK:UpdateMessage(uuid, msg)
else
MSTACK.keys[key] = MSTACK:AddMessage(msg)
end
end
net.Receive("ttt2_notif_push", notif)
or more likely something to do with MSTACK.msgs
Describe alternatives you've considered
- ripping out things and replacing it with netmessages
Additional context
More difficult, as most of the MSTACK stuff has it, traces through exclusively client code:
EndRound
LANG.Msg
LANG.ProcessMsg
LANG.ShowStyledMsg
LANG.Styles
Which, as an aside, makes it extremely difficult to send a client a message in their native language which includes parameter tokens that are also interpreted from their native language (e.g. a weapon name inside a notification regarding the weapon they're trying to lift originating from the server, referring to another language string -- this requires a lot of single-purpose netmessages that serve the same goal).