fix key event + run callbacks more

This commit is contained in:
m 2023-12-17 15:21:26 -06:00
parent dde3449195
commit 1d2fccdf8b
3 changed files with 9 additions and 7 deletions

View File

@ -18,9 +18,6 @@ function canasktojoin(userid)
end end
history[userid] = true history[userid] = true
game:ontimeout(function()
history[userid] = nil
end, 15000)
return true return true
end end
@ -206,6 +203,7 @@ function addrequest(request)
invite:registerEventHandler("end_invite", function() invite:registerEventHandler("end_invite", function()
close() close()
discord.respond(request.userid, discord.reply.ignore) discord.respond(request.userid, discord.reply.ignore)
history[request.userid] = nil
end) end)
local bar = LUI.UIImage.new({ local bar = LUI.UIImage.new({

View File

@ -143,8 +143,6 @@ namespace discord
void update_discord() void update_discord()
{ {
Discord_RunCallbacks();
// reset presence data // reset presence data
const auto saved_time = discord_presence.startTimestamp; const auto saved_time = discord_presence.startTimestamp;
discord_presence = {}; discord_presence = {};
@ -314,7 +312,13 @@ namespace discord
Discord_Initialize("947125042930667530", &handlers, 1, nullptr); Discord_Initialize("947125042930667530", &handlers, 1, nullptr);
scheduler::once(download_default_avatar, scheduler::pipeline::async); scheduler::once(download_default_avatar, scheduler::pipeline::async);
scheduler::once([]()
{
scheduler::once(update_discord, scheduler::pipeline::async);
scheduler::loop(update_discord, scheduler::pipeline::async, 5s); scheduler::loop(update_discord, scheduler::pipeline::async, 5s);
scheduler::loop(Discord_RunCallbacks, scheduler::pipeline::async, 1s);
}, scheduler::pipeline::main);
initialized_ = true; initialized_ = true;
} }

View File

@ -36,7 +36,7 @@ namespace input
void cl_key_event_stub(const int local_client_num, const int key, const int down) void cl_key_event_stub(const int local_client_num, const int key, const int down)
{ {
if (game::environment::is_sp() && ui_scripting::lui_running()) if (ui_scripting::lui_running())
{ {
ui_scripting::notify(down ? "keydown" : "keyup", ui_scripting::notify(down ? "keydown" : "keyup",
{ {