Discord RPC cleanup

- Loading Discord RPC is now handled by `load/rpc.lua`
- Removed `presence` global, call `DiscordRPC:update()` directly with what needs updating
- Game doesn't crash anymore if the Discord RPC fails to load
- Added RPC variables in the gamemode superclass to let each gamemode handle its special case
This commit is contained in:
Oshisaure
2020-10-11 02:17:48 +01:00
parent 05230ac046
commit 5d32b6a3e7
9 changed files with 96 additions and 64 deletions

View File

@@ -7,13 +7,27 @@ local main_menu_screens = {
ExitScene,
}
local mainmenuidle = {"Idle", "Twiddling their thumbs", "Admiring the main menu's BG", "Waiting for spring to come"}
local mainmenuidle = {
"Idle",
"On title screen",
"On main menu screen",
"Twiddling their thumbs",
"Admiring the main menu's BG",
"Waiting for spring to come",
"Actually not playing",
"Contemplating collecting stars",
"Preparing to put the block!!",
"Having a nap",
"In menus",
"Bottom text",
}
function TitleScene:new()
self.main_menu_state = 1
presence.details = "In menus"
presence.state = mainmenuidle[math.random(#mainmenuidle)]
discordRPC.updatePresence(presence)
DiscordRPC:update({
details = "In menus",
state = mainmenuidle[math.random(#mainmenuidle)],
})
end
function TitleScene:update()