mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-05-13 20:21:25 -05:00
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:
@@ -5,13 +5,10 @@ function GameScene:new(game_mode, ruleset)
|
||||
self.game = game_mode()
|
||||
self.ruleset = ruleset()
|
||||
self.game:initialize(self.ruleset)
|
||||
if game_mode.name == "Demon Mode" and math.random(1, 7) == 7 then
|
||||
presence.details = "Suffering"
|
||||
else
|
||||
presence.details = "In game"
|
||||
end
|
||||
presence.state = game_mode.name
|
||||
discordRPC.updatePresence(presence)
|
||||
DiscordRPC:update({
|
||||
details = self.game.rpc_details,
|
||||
state = self.game.name,
|
||||
})
|
||||
end
|
||||
|
||||
function GameScene:update()
|
||||
|
||||
@@ -16,10 +16,11 @@ function ConfigScene:new()
|
||||
-- load current config
|
||||
self.config = config.input
|
||||
self.highlight = 1
|
||||
|
||||
presence.details = "In menus"
|
||||
presence.state = "Changing game config"
|
||||
discordRPC.updatePresence(presence)
|
||||
|
||||
DiscordRPC:update({
|
||||
details = "In menus",
|
||||
state = "Changing game settings",
|
||||
})
|
||||
end
|
||||
|
||||
function ConfigScene:update()
|
||||
|
||||
@@ -23,9 +23,10 @@ function ConfigScene:new()
|
||||
self.config = config.input
|
||||
self.input_state = 1
|
||||
|
||||
presence.details = "In menus"
|
||||
presence.state = "Changing input config"
|
||||
discordRPC.updatePresence(presence)
|
||||
DiscordRPC:update({
|
||||
details = "In menus",
|
||||
state = "Changing input config",
|
||||
})
|
||||
end
|
||||
|
||||
function ConfigScene:update()
|
||||
|
||||
@@ -47,9 +47,10 @@ function ModeSelectScene:new()
|
||||
ruleset = current_ruleset,
|
||||
select = "mode",
|
||||
}
|
||||
presence.details = "In menus"
|
||||
presence.state = "Choosing a mode"
|
||||
discordRPC.updatePresence(presence)
|
||||
DiscordRPC:update({
|
||||
details = "In menus",
|
||||
state = "Choosing a mode",
|
||||
})
|
||||
end
|
||||
|
||||
function ModeSelectScene:update()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user