mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 10:31:50 +00:00
fix: duplicating core:chat event handlers in in-game chat
This commit is contained in:
parent
bb135d33b5
commit
52829023c2
1 changed files with 6 additions and 2 deletions
|
|
@ -19,7 +19,7 @@ local function update_line(line, uptime)
|
|||
end
|
||||
end
|
||||
|
||||
events.on("core:chat", function(message)
|
||||
local core_chat_handler = events.on("core:chat", function(message)
|
||||
while #lines >= max_lines do
|
||||
document[lines[1][1]]:destruct()
|
||||
table.remove(lines, 1)
|
||||
|
|
@ -36,7 +36,7 @@ end)
|
|||
function on_open()
|
||||
if not initialized then
|
||||
initialized = true
|
||||
|
||||
|
||||
document.root:setInterval(1/animation_fps * 1000, function ()
|
||||
local uptime = time.uptime()
|
||||
for _, line in ipairs(lines) do
|
||||
|
|
@ -52,3 +52,7 @@ function on_open()
|
|||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function on_destroy()
|
||||
events.remove("core:chat", core_chat_handler)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue