diff --git a/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll new file mode 100644 index 0000000..087106f Binary files /dev/null and b/project/addons/discord-sdk-gd/bin/windows/~discord_game_sdk_binding_debug.dll differ diff --git a/project/addons/discord-sdk-gd/nodes/discord_autoload.gd b/project/addons/discord-sdk-gd/nodes/discord_autoload.gd index f47afc2..f6755da 100644 --- a/project/addons/discord-sdk-gd/nodes/discord_autoload.gd +++ b/project/addons/discord-sdk-gd/nodes/discord_autoload.gd @@ -1,22 +1,21 @@ ## This is a GDscript Node wich gets automatically added as Autoload while installing the addon. ## ## It can run in the background to comunicate with Discord. -## You don't need to use it unless you are using EditorPresence. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function. +## You don't need to use it. If you remove it make sure to run [code]DiscordSDK.run_callbacks()[/code] in a [code]_process[/code] function. ## ## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki -@tool extends Node func _process(_delta) -> void: - if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"): - if ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled",false) && Engine.is_editor_hint(): - if DiscordSDK.app_id != 1108142249990176808: - DiscordSDK.app_id = 1108142249990176808 - DiscordSDK.details = ProjectSettings.get_setting("application/config/name") - DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\"" - DiscordSDK.large_image = "godot" - DiscordSDK.large_image_text = str(Engine.get_version_info().string) - DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) - DiscordSDK.refresh() - if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint(): - DiscordSDK.run_callbacks() + #if GDExtensionManager.get_loaded_extensions().has("res://addons/discord-sdk-gd/bin/discord-rpc-gd.gdextension"): + #if EditorInterface.get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled") && Engine.is_editor_hint(): + #if DiscordSDK.app_id != 1108142249990176808: + #DiscordSDK.app_id = 1108142249990176808 + #DiscordSDK.details = ProjectSettings.get_setting("application/config/name") + #DiscordSDK.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\"" + #DiscordSDK.large_image = "godot" + #DiscordSDK.large_image_text = str(Engine.get_version_info().string) + #DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system()) + #DiscordSDK.refresh() + #if DiscordSDK.app_id == 1108142249990176808 || !Engine.is_editor_hint(): + DiscordSDK.run_callbacks() diff --git a/project/addons/discord-sdk-gd/plugin.gd b/project/addons/discord-sdk-gd/plugin.gd index ab9209d..07ca601 100644 --- a/project/addons/discord-sdk-gd/plugin.gd +++ b/project/addons/discord-sdk-gd/plugin.gd @@ -8,9 +8,7 @@ var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/re func _enter_tree() -> void: add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) - ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) - ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true) - ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) + EditorInterface.get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",false) func _enable_plugin() -> void: if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): @@ -25,7 +23,7 @@ func _disable_plugin() -> void: remove_autoload_singleton("DiscordSDKLoader") FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) remove_custom_type("DiscordSDKDebug") - ProjectSettings.clear("DiscordSDK/EditorPresence/enabled") + EditorInterface.get_editor_settings().erase("DiscordSDK/EditorPresence/enabled") push_warning("Please restart the editor to fully disable the DiscordSDK plugin") func save_and_restart() -> void: diff --git a/src/editor_presence.cpp b/src/editor_presence.cpp new file mode 100644 index 0000000..a50fa7f --- /dev/null +++ b/src/editor_presence.cpp @@ -0,0 +1,60 @@ +#include "editor_presence.h" +#include "lib/discord_game_sdk/cpp/discord.h" +#include +#include +#include +#include +#include + +Ref project_settings = ProjectSettings::get_singleton(); +Ref engine = Engine::get_singleton(); +Ref