diff --git a/src/components/DiscordStatus.gd b/src/components/DiscordStatus.gd index 7f9c6d2..cb9d8df 100644 --- a/src/components/DiscordStatus.gd +++ b/src/components/DiscordStatus.gd @@ -3,14 +3,34 @@ class_name DiscordStatus func _ready(): DiscordRPC.app_id = ENV.DISCORD_APP_ID # Application ID - DiscordRPC.details = "Main menu" - DiscordRPC.state = "Checkpoint 23/23" + DiscordRPC.details = init_state.details + DiscordRPC.state = init_state.desc DiscordRPC.large_image = 'icon' # Image key from "Art Assets" - DiscordRPC.large_image_text = "Try it now!" - DiscordRPC.small_image = 'icon' # Image key from "Art Assets" - DiscordRPC.small_image_text = "Fighting the end boss! D:" + DiscordRPC.refresh() - DiscordRPC.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed" - # DiscordRPC.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time / "01:00:00 remaining" +const init_state := { + details = "Main menu", + desc = "Chilling", +} - DiscordRPC.refresh() # Always refresh after changing the values! +const loop_state := { + details = "In Game", + desc = "Level: %s", +} + +func set_state(details: String, desc: String, with_time: bool = false): + DiscordRPC.details = details + DiscordRPC.state = desc + if with_time: + DiscordRPC.start_timestamp = int(Time.get_unix_time_from_system()) # "02:46 elapsed" + DiscordRPC.refresh() + +func set_menu_state(): + set_state(init_state.details, init_state.desc) + +func set_loop_state(level := 0): + set_state( + loop_state.details, + loop_state.desc % level if level else "tutorial", + true + )