removed custom loader node and did a bit documentation

This commit is contained in:
Yannik
2023-05-17 12:02:53 +02:00
parent 3913736a42
commit 52ec3392fa
6 changed files with 49 additions and 45 deletions

View File

@@ -1,25 +1,38 @@
class_name DiscordSDKTutorial
extends Node
# 1. Put the addons/ folder in your Godot project
# 2. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". (if it doesn't show up restart your project and try again)
# 3. Restart your project
# 4. Create an Application under https://discord.com/developers/applications and get the Application ID
# 5. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys
#SELECT THE TEXT WITH YOUR MOUSE AND CTR + K TO UNCOMMENT THE FOLLOWING
#func _ready():
# discord_sdk.app_id = 1099618430065324082 # Application ID
# print("Discord working: " + str(discord_sdk.get_is_discord_working())) # A boolean if everything worked
# discord_sdk.details = "A demo activity by vaporvee#1231"
# discord_sdk.state = "Checkpoint 23/23"
#
# discord_sdk.large_image = "game" # Image key from "Art Assets"
# discord_sdk.large_image_text = "Try it now!"
# discord_sdk.small_image = "boss" # Image key from "Art Assets"
# discord_sdk.small_image_text = "Fighting the end boss! D:"
#
# discord_sdk.start_timestamp = int(Time.get_unix_time_from_system()) # "02:41 elapsed"
# discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
#
# discord_sdk.refresh() # Always refresh after changing the values!
## 1. Put the addons/ folder in your Godot project[br]
## 2. Enable the addon in your Project Settings under "Plugins" and "DiscordSDK". [br](if it doesn't show up restart your project and try again)[br]
## 3. Restart your project[br]
## 4. Create an Application under https://discord.com/developers/applications and get the Application ID br]
## 5. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys[br]
##
## This is your [code]_ready()[/code] function wich could be anywhere
## [codeblock]
## func _ready():
## # Application ID
## discord_sdk.app_id = 1099618430065324082
## # this is boolean if everything worked
## print("Discord working: " + str(discord_sdk.get_is_discord_working()))
## # Set the first custom text row of the activity here
## discord_sdk.details = "A demo activity by vaporvee#1231"
## # Set the second custom text row of the activity here
## discord_sdk.state = "Checkpoint 23/23"
## # Image key for small image from "Art Assets" from the Discord Developer website
## discord_sdk.large_image = "game"
## # Tooltip text for the large image
## discord_sdk.large_image_text = "Try it now!"
## # Image key for large image from "Art Assets" from the Discord Developer website
## discord_sdk.small_image = "boss"
## # Tooltip text for the small image
## discord_sdk.small_image_text = "Fighting the end boss! D:"
## # "02:41 elapsed" timestamp for the activity
## discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
## # "59:59 remaining" timestamp for the activity
## discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
## # Always refresh after changing the values!
## discord_sdk.refresh()
## [/codeblock]
##
## @tutorial(More information here): https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start
## @tutorial(Make your Application ID and else here): https://discord.com/developers/applications

View File

@@ -1,7 +0,0 @@
[gd_scene load_steps=2 format=3 uid="uid://dkbtuqbtdlqnk"]
[ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/core_updater.gd" id="1_8fjwg"]
[node name="DiscordSDKLoader" type="Node"]
editor_description = "This always needs to run in the background if you want to comunicate with the discord client."
script = ExtResource("1_8fjwg")

View File

@@ -1,8 +1,12 @@
## This always needs to run in the background if you want to comunicate with the discord client.
## [color=yellow]PLEASE IGNORE![/color] This is a important Node wich gets automatically added as Singleton.
##
## The DiscordSDKLoader Node automatically gets added as Singleton while installing the addon.
## It has to run in the background to comunicate with Discord.
## You don't need to use it.
##
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
class_name core_updater
extends Node
@export var is_running: bool =false
func _process(delta) -> void:
discord_sdk.coreupdate()
is_running = true

View File

@@ -1,4 +1,8 @@
## This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input
## This is a Debug Node wich will show some usefull info and buttons/input
##
## The DiscordSDK Debug Node will show info about the current values of its variables and some buttons to change them.
##
## @tutorial: https://github.com/vaporvee/discord-sdk-godot/wiki
extends Node
func _ready() -> void:

View File

@@ -1,10 +1,6 @@
@tool
extends EditorPlugin
const DiscordSDKLoader = preload("res://addons/discord-sdk-gd/nodes/core_updater.gd")
const DiscordSDKLoader_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Group_1.svg")
var loaded_DiscordSDKLoader = DiscordSDKLoader.new()
const DiscordSDKDebug = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg")
var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
@@ -15,7 +11,6 @@ var loaded_exportplugin = ExportPlugin.new()
func _enter_tree() -> void:
add_custom_type("DiscordSDKLoader","Node",DiscordSDKLoader,DiscordSDKLoader_icon)
add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd")
add_export_plugin(loaded_exportplugin)
@@ -29,7 +24,6 @@ func _enable_plugin():
func _disable_plugin() -> void:
print("DiscordSDK Addon got disabled")
remove_autoload_singleton("DiscordSDKLoader")
remove_custom_type("DiscordSDKLoader")
remove_custom_type("DiscordSDKDebug")
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")

View File

@@ -8,10 +8,6 @@
config_version=5
[DiscordSDK]
EditorPresence/enabled=true
[application]
config/name="GDExtension DiscordSDK Test Project"