mirror of
https://github.com/XLabsProject/s1x-client.git
synced 2023-08-02 15:02:12 +02:00
Fix discord presence
This commit is contained in:
parent
505c72c9f9
commit
78aaebb926
@ -17,11 +17,13 @@ namespace discord
|
||||
{
|
||||
Discord_RunCallbacks();
|
||||
|
||||
if (!game::CL_IsCgameInitialized() || game::Dvar_FindVar("virtualLobbyActive")->current.enabled == 1)
|
||||
auto* dvar = game::Dvar_FindVar("virtualLobbyActive");
|
||||
if (!game::CL_IsCgameInitialized() || (dvar && dvar->current.enabled == 1))
|
||||
{
|
||||
discord_presence.details = game::environment::is_sp() ? "Singleplayer" : "Multiplayer";
|
||||
|
||||
if (game::Dvar_FindVar("virtualLobbyInFiringRange")->current.enabled == 1)
|
||||
|
||||
dvar = game::Dvar_FindVar("virtualLobbyInFiringRange");
|
||||
if (dvar && dvar->current.enabled == 1)
|
||||
{
|
||||
discord_presence.state = "Firing Range";
|
||||
}
|
||||
@ -103,10 +105,11 @@ namespace discord
|
||||
// change ID
|
||||
Discord_Initialize("823223724013912124", &handlers, 1, nullptr);
|
||||
|
||||
scheduler::on_game_initialized([]()
|
||||
scheduler::once([]()
|
||||
{
|
||||
scheduler::once(update_discord, scheduler::pipeline::async);
|
||||
scheduler::loop(update_discord, scheduler::pipeline::async, 20s);
|
||||
});
|
||||
}, scheduler::pipeline::main);
|
||||
|
||||
initialized_ = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user