Add a chat system that actually looks nice.

This commit is contained in:
Signal 2025-11-12 03:12:56 -05:00
parent 82817a1cb4
commit 555867f000
9 changed files with 164 additions and 1 deletions

View file

@ -77,6 +77,11 @@ function ns.hud_add(m, def)
if type.defaults then
def = extend(table.copy(type.defaults), def)
end
-- Create a random name if none is given, since the
-- assumption is that the user doesn't care about the name.
if not def.name then
def.name = ""..math.random()
end
local el
if m.hud[def.name] then
el = m.hud[def.name]
@ -222,8 +227,11 @@ ns.register_hud_type {
end
end,
remove = function(e, m)
m.hud[e.name] = nil
m.object:hud_remove(e._id)
e._id = nil
-- Prevent ongoing animations from attempting to change a nonexistent element.
e.update = function() end
end
}
@ -270,5 +278,7 @@ ns.register_hud_type {
m.hud[e.name] = nil
m.object:hud_remove(e._id)
e._id = nil
-- Prevent ongoing animations from attempting to change a nonexistent element.
e.update = function() end
end
}