2 Commits
3.0 ... 2.0

Author SHA1 Message Date
Yannik
7c66fbc474 fixed some 2.0 bugs 2023-05-17 00:58:38 +02:00
Yannik
a8c4f33fdd Merge pull request #27 from vaporvee/make-2.0-releasable
Fix bugs and round up main for 2.0
2023-05-17 00:35:58 +02:00
38 changed files with 774 additions and 719 deletions

View File

@@ -23,12 +23,6 @@ body:
label: Version label: Version
description: What version of our software are you running? description: What version of our software are you running?
options: options:
- 3.0
- 2.4
- 2.3
- 2.2
- 2.1
- 2.0
- 1.5 - 1.5
- 1.4 - 1.4
- 1.3 - 1.3

View File

@@ -1,27 +0,0 @@
name: Feature request
description: File a feature request
title: "[Feature request]: "
labels: ["enhancement"]
assignees:
- vaporvee
body:
- type: markdown
attributes:
value: Thanks for taking the time to fill out this feature request!
- type: textarea
id: idea
attributes:
label: What is your idea?
description: Tell me what you want to see in the addon.
placeholder: Tell me what you want to see!
value: "I have a cool new feature!"
validations:
required: true
- type: textarea
id: additional
attributes:
label: Additional information
description: If you have anything else tell me here
placeholder: Anything else.
validations:
required: false

5
.gitignore vendored
View File

@@ -19,7 +19,4 @@ build/
*.lib *.lib
#Clean files from the Game SDK #Clean files from the Game SDK
src/lib/discord_game_sdk/ src/lib/discord_game_sdk/
# release.py
release/

View File

@@ -1,22 +1,14 @@
<img src="/project/assets/Banner.svg" alt="Project Banner" /> <img src="/project/assets/Banner.svg" alt="Project Banner" />
**Discord Game SDK support for GDScript in Godot Engine 4.1. with the easiest code pattern!**<br><br> **Discord Game SDK support for GDScript in Godot Engine 4.0. with the easiest code pattern!**<br><br>
**Please leave a star that would really help! And thanks to all the people that already starred this project! ❤️**
<br /> <br />
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki) <br />
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start)
<br /> <br />
**A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!** **A small donation with the sponsor button would be nice if you sell your project with this addon but is of course not mandatory!**
# Features
- Activities (Make people see what you are playing)
- Invites
- Steam and launch command registering
- User information
- Overlay management
- Editor Presence (optional)
<img width="400px" src="https://camo.githubusercontent.com/e4ae18ce30a7731145376e1a85c384e9ea207420c09365e3fcdd455ef332ba98/68747470733a2f2f6769746875622d70726f64756374696f6e2d757365722d61737365742d3632313064662e73332e616d617a6f6e6177732e636f6d2f38303632313836332f3233383739343331392d35373164653262612d346635652d343062612d613263662d3839666365643963306366302e706e67">
<br />
<br /> <br />
### Credit ### Credit

View File

@@ -1,30 +0,0 @@
[configuration]
entry_symbol = "discordsdkgd_library_init"
compatibility_minimum = 4.1
[libraries]
macos.debug = "macos/libdiscord_game_sdk_binding_debug.dylib"
macos.release = "macos/libdiscord_game_sdk_binding.dylib"
windows.debug.x86_64 = "windows/discord_game_sdk_binding_debug.dll"
windows.release.x86_64 = "windows/discord_game_sdk_binding.dll"
linux.debug.x86_64 = "linux/libdiscord_game_sdk_binding_debug.so"
linux.release.x86_64 = "linux/libdiscord_game_sdk_binding.so"
linux.debug.arm64 = "linux/libdiscord_game_sdk_binding_debug.so"
linux.release.arm64 = "linux/libdiscord_game_sdk_binding.so"
linux.debug.rv64 = "linux/libdiscord_game_sdk_binding_debug.so"
linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
[dependencies]
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" }
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" }
windows.release.x86_64 = { "windows/discord_game_sdk.dll": "" }
linux.debug.x86_64 = { "linux/libdiscord_game_sdk.so": "" }
linux.release.x86_64 = { "linux/libdiscord_game_sdk.so": "" }
linux.debug.arm64 = { "linux/libdiscord_game_sdk.so": "" }
linux.release.arm64 = { "linux/libdiscord_game_sdk.so": "" }
linux.debug.rv64 = { "linux/libdiscord_game_sdk.so": "" }
linux.release.rv64 = { "linux/libdiscord_game_sdk.so": "" }

View File

@@ -0,0 +1,4 @@
Version: 1.2
Windows: build-1
Linux: build-1
MacOS: build-1

View File

@@ -0,0 +1,29 @@
[configuration]
entry_symbol = "discordsdkgd_library_init"
[libraries]
macos.debug = "bin/macos/libdiscord_game_sdk_binding_debug.dylib"
macos.release = "bin/macos/libdiscord_game_sdk_binding.dylib"
windows.debug.x86_64 = "bin/windows/discord_game_sdk_binding_debug.dll"
windows.release.x86_64 = "bin/windows/discord_game_sdk_binding.dll"
linux.debug.x86_64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
linux.release.x86_64 = "bin/linux/libdiscord_game_sdk_binding.so"
linux.debug.arm64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
linux.release.arm64 = "bin/linux/libdiscord_game_sdk_binding.so"
linux.debug.rv64 = "bin/linux/libdiscord_game_sdk_binding_debug.so"
linux.release.rv64 = "bin/linux/libdiscord_game_sdk_binding.so"
[dependencies]
macos.debug = "bin/macos/libdiscord_game_sdk.dylib"
macos.release = "bin/macos/libdiscord_game_sdk.dylib"
windows.debug.x86_64 = "bin/windows/discord_game_sdk.dll"
windows.release.x86_64 = "bin/windows/discord_game_sdk.dll"
linux.debug.x86_64 = "bin/linux/libdiscord_game_sdk.so"
linux.release.x86_64 = "bin/linux/libdiscord_game_sdk.so"
linux.debug.arm64 = "bin/linux/libdiscord_game_sdk.so"
linux.release.arm64 = "bin/linux/libdiscord_game_sdk.so"
linux.debug.rv64 = "bin/linux/libdiscord_game_sdk.so"
linux.release.rv64 = "bin/linux/libdiscord_game_sdk.so"

View File

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

@@ -0,0 +1,17 @@
@tool
extends EditorExportPlugin
func _export_file(_path, _type, features) -> void:
if features[2] == "windows":
if features[4] == "x86_64":
add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk.dll",[],"/")
elif features[4] == "x86":
add_shared_object("res://addons/discord-sdk-gd/bin/windows/discord_game_sdk_x86.dll",[],"/")
elif features[2] == "linux":
add_shared_object("res://addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk.so",[],"/")
elif features[2] == "macos":
add_shared_object("res://addons/discord-sdk-gd/bin/macos/libdiscord_game_sdk.dylib",[],"/")
add_shared_object("res://addons/discord-sdk-gd/bin/macos/libdiscord_game_sdk_aarch64.dylib",[],"/")
func _get_name():
pass

View File

@@ -1,8 +1,6 @@
[gd_scene load_steps=9 format=3 uid="uid://c1slhdnlsv2qt"] [gd_scene load_steps=68 format=3 uid="uid://c1slhdnlsv2qt"]
[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://addons/discord-sdk-gd/nodes/assets/Checked.svg" id="2_q6tao"] [ext_resource type="Texture2D" uid="uid://cq8lwj2matk6x" path="res://addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png" id="4_gvc3o"]
[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg" id="3_5cyem"]
[ext_resource type="Texture2D" uid="uid://dtc6ckladq0td" path="res://addons/discord-sdk-gd/nodes/assets/circle.svg" id="3_goflf"]
[sub_resource type="GDScript" id="GDScript_ak1tp"] [sub_resource type="GDScript" id="GDScript_ak1tp"]
resource_name = "Debug" resource_name = "Debug"
@@ -13,16 +11,15 @@ func _ready():
func _process(_delta): func _process(_delta):
if(discord_sdk.get_is_discord_working()): if(discord_sdk.get_is_discord_working()):
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\") $AnimatedSprite2D.play(\"default\")
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
debug_text_update() debug_text_update()
else: else:
$Panel/TextureRect.self_modulate = Color(\"#797979\") $AnimatedSprite2D.stop()
$Panel/TextureRect/AnimationPlayer.stop() $AnimatedSprite2D.animation = \"gray\"
debug_text_update() debug_text_update()
func debug_text_update(): func debug_text_update():
$Panel/Info.text = \"Application ID : {id} $Info.text = \"Application ID : {id}
Details: {details} Details: {details}
State: {state} State: {state}
@@ -44,7 +41,7 @@ Is party public: {ppublic} (needs to be activated in Discord client settings)
Is instanced: {instanced} Is instanced: {instanced}
\" \"
$Panel/Info.text = $Panel/Info.text.replace(\"{ppublic}\",str(discord_sdk.is_public_party)).replace(\"{instanced}\",str(discord_sdk.instanced)).replace(\"{ssecret}\",discord_sdk.spectate_secret).replace(\"{jsecret}\",discord_sdk.join_secret).replace(\"{msecret}\",discord_sdk.match_secret).replace(\"{mpartysize}\",str(discord_sdk.max_party_size)).replace(\"{cpartysize}\",str(discord_sdk.current_party_size)).replace(\"{partyid}\",discord_sdk.party_id).replace(\"{id}\",str(discord_sdk.app_id)).replace(\"{details}\",discord_sdk.details).replace(\"{state}\",discord_sdk.state).replace(\"{lkey}\",discord_sdk.large_image).replace(\"{ltext}\",discord_sdk.large_image_text).replace(\"{skey}\",discord_sdk.small_image).replace(\"{stext}\",discord_sdk.small_image_text).replace(\"{stimestamp}\",str(discord_sdk.start_timestamp)).replace(\"{etimestamp}\",str(discord_sdk.end_timestamp)) $Info.text = $Info.text.replace(\"{ppublic}\",str(discord_sdk.is_public_party)).replace(\"{instanced}\",str(discord_sdk.instanced)).replace(\"{ssecret}\",discord_sdk.spectate_secret).replace(\"{jsecret}\",discord_sdk.join_secret).replace(\"{msecret}\",discord_sdk.match_secret).replace(\"{mpartysize}\",str(discord_sdk.max_party_size)).replace(\"{cpartysize}\",str(discord_sdk.current_party_size)).replace(\"{partyid}\",discord_sdk.party_id).replace(\"{id}\",str(discord_sdk.app_id)).replace(\"{details}\",discord_sdk.details).replace(\"{state}\",discord_sdk.state).replace(\"{lkey}\",discord_sdk.large_image).replace(\"{ltext}\",discord_sdk.large_image_text).replace(\"{skey}\",discord_sdk.small_image).replace(\"{stext}\",discord_sdk.small_image_text).replace(\"{stimestamp}\",str(discord_sdk.start_timestamp)).replace(\"{etimestamp}\",str(discord_sdk.end_timestamp))
var user_request = {}; var user_request = {};
@@ -52,87 +49,504 @@ func _on_activity_join_request(user_requesting):
print(user_requesting) print(user_requesting)
user_request = user_requesting user_request = user_requesting
func _on_accept_join_request_pressed(): func _on_button_pressed():
if(!user_request.is_empty()): if(!user_request.is_empty()):
discord_sdk.accept_join_request(user_request.id) discord_sdk.accept_join_request(user_request.id)
func _on_invite_with_user_id_text_submitted(new_text): func _on_line_edit_text_submitted(new_text):
discord_sdk.send_invite(int(new_text),true,\"this is a test invite sent from godot\") discord_sdk.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
func _on_accept_with_user_id_text_submitted(new_text): func _on_line_edit_2_text_submitted(new_text):
discord_sdk.accept_invite(int(new_text)) discord_sdk.accept_invite(int(new_text))
func _on_print_current_user_on_console_pressed(): func _on_button_2_pressed():
print(discord_sdk.get_current_user()) print(discord_sdk.get_current_user())
func _on_toggle_sdk_toggled(button_pressed): func _on_check_button_toggled(button_pressed):
if(button_pressed): if(button_pressed):
discord_sdk.unclear() debug_text_update()
else: else:
discord_sdk.clear() discord_sdk.clear()
debug_text_update()
func _on_print_friends_pressed():
print(discord_sdk.get_all_relationships())
" "
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"] [sub_resource type="AtlasTexture" id="AtlasTexture_85oj4"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 0, 512, 512)
[sub_resource type="Animation" id="Animation_mmtmn"] [sub_resource type="AtlasTexture" id="AtlasTexture_vv4mb"]
length = 0.001 atlas = ExtResource("4_gvc3o")
tracks/0/type = "value" region = Rect2(1024, 0, 512, 512)
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.4),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(0.5, 0.5)]
}
[sub_resource type="Animation" id="Animation_5u02v"] [sub_resource type="AtlasTexture" id="AtlasTexture_kwv3j"]
resource_name = "pulsate" atlas = ExtResource("4_gvc3o")
loop_mode = 1 region = Rect2(1536, 0, 512, 512)
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.5, 1),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [Vector2(0.5, 0.5), Vector2(0.8, 0.8), Vector2(0.5, 0.5)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_a7ofc"] [sub_resource type="AtlasTexture" id="AtlasTexture_ij57t"]
_data = { atlas = ExtResource("4_gvc3o")
"RESET": SubResource("Animation_mmtmn"), region = Rect2(2048, 0, 512, 512)
"pulsate": SubResource("Animation_5u02v")
} [sub_resource type="AtlasTexture" id="AtlasTexture_w2du1"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 512, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_4pma1"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 512, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_fcoqp"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 512, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_tjcb7"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 512, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_oudh8"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 512, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_csja0"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 1024, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_0xbpk"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 1024, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_p84pv"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 1024, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_1gjwh"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 1024, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_mrm73"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 1024, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_8rkne"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 1536, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_c15qo"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 1536, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_74tpk"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 1536, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_v5nxq"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 1536, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_0mf44"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 1536, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_kb0hn"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 2048, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_o22ug"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 2048, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_21q7w"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 2048, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_gitfl"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 2048, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_8hg1o"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 2048, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_niuoc"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 2560, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_mt5ft"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 2560, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_ub7uo"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 2560, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_2uxnl"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 2560, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_bh4ts"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 2560, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_lcu0i"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 3072, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_mmqt1"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 3072, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_orode"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 3072, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_ricn8"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 3072, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_6ftll"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 3072, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_fm4jy"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 3584, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_7qcot"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 3584, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_2y47g"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 3584, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_gpr0t"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 3584, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_nn332"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 3584, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_jg384"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 4096, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_g0wvw"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 4096, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_e6fmf"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 4096, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_n1rtv"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 4096, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_365g3"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 4096, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_frkrx"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 4608, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_j8adw"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 4608, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_76fh7"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 4608, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_gmmrx"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 4608, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_rlh42"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 4608, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_wijf7"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 5120, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_2n5hs"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 5120, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_yrp6k"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 5120, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_w411h"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 5120, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_pe7po"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 5120, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_sr5kq"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 5632, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_kgesr"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 5632, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_vfk6x"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 5632, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_4d1t3"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 5632, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_6bexm"]
atlas = ExtResource("4_gvc3o")
region = Rect2(2048, 5632, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_tadlo"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 6144, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_g2h20"]
atlas = ExtResource("4_gvc3o")
region = Rect2(512, 6144, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_x351d"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1024, 6144, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_0jq3r"]
atlas = ExtResource("4_gvc3o")
region = Rect2(1536, 6144, 512, 512)
[sub_resource type="AtlasTexture" id="AtlasTexture_1eeyl"]
atlas = ExtResource("4_gvc3o")
region = Rect2(0, 0, 512, 512)
[sub_resource type="SpriteFrames" id="SpriteFrames_kudgl"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_85oj4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vv4mb")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kwv3j")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ij57t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w2du1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4pma1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fcoqp")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tjcb7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_oudh8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_csja0")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0xbpk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_p84pv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_1gjwh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mrm73")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8rkne")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_c15qo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_74tpk")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_v5nxq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0mf44")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kb0hn")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_o22ug")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_21q7w")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gitfl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8hg1o")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_niuoc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mt5ft")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ub7uo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2uxnl")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_bh4ts")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_lcu0i")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_mmqt1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_orode")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ricn8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6ftll")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_fm4jy")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7qcot")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2y47g")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gpr0t")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_nn332")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jg384")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g0wvw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e6fmf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_n1rtv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_365g3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_frkrx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_j8adw")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_76fh7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gmmrx")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_rlh42")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_wijf7")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_2n5hs")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_yrp6k")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_w411h")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_pe7po")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_sr5kq")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_kgesr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vfk6x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_4d1t3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6bexm")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_tadlo")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g2h20")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_x351d")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_0jq3r")
}],
"loop": true,
"name": &"default",
"speed": 30.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_1eeyl")
}],
"loop": true,
"name": &"gray",
"speed": 5.0
}]
[node name="DebugNodeGroup" type="Node"] [node name="DebugNodeGroup" type="Node"]
editor_description = "This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input" editor_description = "This is a Debug Node wich will show (only if the project runs) some usefull info and buttons/input"
script = SubResource("GDScript_ak1tp") script = SubResource("GDScript_ak1tp")
[node name="Panel" type="Panel" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
anchors_preset = -1 position = Vector2(389, 477.375)
anchor_right = 0.373 scale = Vector2(0.14209, 0.14209)
anchor_bottom = 1.0 sprite_frames = SubResource("SpriteFrames_kudgl")
offset_left = -5.0 frame_progress = 0.417812
offset_right = 0.303955
grow_horizontal = 2
grow_vertical = 2
[node name="Info" type="RichTextLabel" parent="Panel"] [node name="Info" type="RichTextLabel" parent="."]
layout_mode = 0 offset_left = 7.0
offset_left = 12.0 offset_top = 6.0
offset_top = 21.0 offset_right = 424.0
offset_right = 429.0 offset_bottom = 312.0
offset_bottom = 461.0
theme_override_font_sizes/normal_font_size = 14 theme_override_font_sizes/normal_font_size = 14
text = "Application ID : {id} text = "Application ID : {id}
Details: {details} Details: {details}
@@ -158,109 +572,52 @@ Is instanced: {instanced}
" "
fit_content = true fit_content = true
[node name="PrintCurrentUserOnConsole" type="Button" parent="Panel"] [node name="PrintCurrentUserOnConsole" type="Button" parent="."]
layout_mode = 1
anchors_preset = 4 anchors_preset = 4
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = 12.0 offset_left = 7.0
offset_top = 138.375 offset_top = 141.375
offset_right = 245.0 offset_right = 240.0
offset_bottom = 171.375 offset_bottom = 174.375
grow_vertical = 2 grow_vertical = 2
text = "Print current user on console" text = "Print current user on console"
[node name="PrintFriends" type="Button" parent="Panel"] [node name="AcceptInviteRequest" type="Button" parent="."]
layout_mode = 1
anchors_preset = 4 anchors_preset = 4
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = 12.0 offset_left = 7.0
offset_top = 176.5 offset_top = 178.875
offset_right = 204.0 offset_right = 149.0
offset_bottom = 207.5 offset_bottom = 209.875
grow_vertical = 2
text = "Print friends on console"
[node name="AcceptJoinRequest" type="Button" parent="Panel"]
layout_mode = 1
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 12.0
offset_top = 212.875
offset_right = 154.0
offset_bottom = 243.875
grow_vertical = 2 grow_vertical = 2
text = "ACCEPT REQUEST" text = "ACCEPT REQUEST"
[node name="InviteWithUserID" type="LineEdit" parent="Panel"] [node name="InviteWithUserID" type="LineEdit" parent="."]
layout_mode = 1
anchors_preset = 4 anchors_preset = 4
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = 11.0 offset_left = 6.0
offset_top = 250.375 offset_top = 215.375
offset_right = 210.0 offset_right = 205.0
offset_bottom = 281.375 offset_bottom = 246.375
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
placeholder_text = "Invite with user_id here" placeholder_text = "Invite with user_id here"
[node name="AcceptWithUserID" type="LineEdit" parent="Panel"] [node name="AcceptWithUserID" type="LineEdit" parent="."]
layout_mode = 1
anchors_preset = 4 anchors_preset = 4
anchor_top = 0.5 anchor_top = 0.5
anchor_bottom = 0.5 anchor_bottom = 0.5
offset_left = 11.0 offset_left = 6.0
offset_top = 286.875 offset_top = 250.875
offset_right = 260.0 offset_right = 255.0
offset_bottom = 317.875 offset_bottom = 281.875
grow_vertical = 2 grow_vertical = 2
placeholder_text = "Accept Invite with user_id here" placeholder_text = "Accept Invite with user_id here"
[node name="ToggleSDK" type="CheckButton" parent="Panel"] [connection signal="pressed" from="PrintCurrentUserOnConsole" to="." method="_on_button_2_pressed"]
layout_mode = 1 [connection signal="pressed" from="AcceptInviteRequest" to="." method="_on_button_pressed"]
anchors_preset = 4 [connection signal="text_submitted" from="InviteWithUserID" to="." method="_on_line_edit_text_submitted"]
anchor_top = 0.5 [connection signal="text_submitted" from="AcceptWithUserID" to="." method="_on_line_edit_2_text_submitted"]
anchor_bottom = 0.5
offset_left = 298.0
offset_top = 157.375
offset_right = 1144.0
offset_bottom = 665.375
grow_vertical = 2
scale = Vector2(0.05, 0.05)
theme_override_icons/checked = ExtResource("2_q6tao")
theme_override_icons/unchecked = ExtResource("3_5cyem")
theme_override_styles/focus = SubResource("StyleBoxEmpty_8abo6")
button_pressed = true
[node name="TextureRect" type="TextureRect" parent="Panel"]
self_modulate = Color(0.47451, 0.47451, 0.47451, 1)
layout_mode = 1
anchors_preset = -1
anchor_left = 0.88
anchor_top = 0.762
anchor_right = 0.88
anchor_bottom = 0.762
offset_left = -28.8
offset_top = -28.776
offset_right = 28.0841
offset_bottom = 28.1082
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(0.5, 0.5)
pivot_offset = Vector2(29.0693, 29.0693)
texture = ExtResource("3_goflf")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Panel/TextureRect"]
libraries = {
"": SubResource("AnimationLibrary_a7ofc")
}
[connection signal="pressed" from="Panel/PrintCurrentUserOnConsole" to="." method="_on_print_current_user_on_console_pressed"]
[connection signal="pressed" from="Panel/PrintFriends" to="." method="_on_print_friends_pressed"]
[connection signal="pressed" from="Panel/AcceptJoinRequest" to="." method="_on_accept_join_request_pressed"]
[connection signal="text_submitted" from="Panel/InviteWithUserID" to="." method="_on_invite_with_user_id_text_submitted"]
[connection signal="text_submitted" from="Panel/AcceptWithUserID" to="." method="_on_accept_with_user_id_text_submitted"]
[connection signal="toggled" from="Panel/ToggleSDK" to="." method="_on_toggle_sdk_toggled"]

View File

@@ -0,0 +1,7 @@
[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

@@ -0,0 +1,4 @@
<svg width="16" height="14" viewBox="0 0 16 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.35776 4.35954C0.15745 6.80425 -0.158183 9.20437 0.0679444 11.5772C1.29133 12.4811 2.66066 13.1685 4.11639 13.6096C4.44417 13.1687 4.73422 12.701 4.98346 12.2115C4.51007 12.0346 4.05317 11.8165 3.61804 11.5596C3.73256 11.4765 3.84456 11.3909 3.95279 11.3079C5.21891 11.9033 6.60083 12.212 7.99997 12.212C9.39912 12.212 10.781 11.9033 12.0472 11.3079C12.1566 11.3972 12.2686 11.4828 12.3819 11.5596C11.9459 11.8169 11.4882 12.0355 11.014 12.2127C11.2629 12.7021 11.553 13.1694 11.881 13.6096C13.338 13.1703 14.7084 12.4832 15.932 11.5785C16.1887 8.91658 15.71 6.52885 14.6441 4.35954H1.35776ZM3.90119 8.15294C3.90119 9.03386 4.55307 9.74992 5.34212 9.74992C6.14627 9.74992 6.76795 9.03386 6.78179 8.15294C6.79563 7.27203 6.14879 6.54967 5.3396 6.54967C4.53042 6.54967 3.90119 7.27203 3.90119 8.15294ZM9.21815 8.15294C9.21815 9.03386 9.86752 9.74992 10.6578 9.74992C11.462 9.74992 12.0824 9.03386 12.0962 8.15294C12.1101 7.27203 11.4683 6.54967 10.6578 6.54967C9.84738 6.54967 9.21815 7.27203 9.21815 8.15294Z" fill="#5865F2"/>
<path d="M4.31337 0.711094C4.97409 0.378693 5.67883 0.1583 6.39124 0C6.67624 0.478046 6.93634 0.995727 7.16285 1.50181C7.43169 1.45692 7.70147 1.4403 7.97234 1.43708V1.43666C7.97402 1.43666 7.97578 1.43708 7.97746 1.43708C7.97907 1.43708 7.98082 1.43666 7.98271 1.43666V1.43708C8.25308 1.4403 8.5231 1.45692 8.79187 1.50181C9.01852 0.995727 9.27877 0.478046 9.56334 0C10.2761 0.1583 10.9807 0.378693 11.6415 0.711094C11.6264 1.29423 11.5887 1.85296 11.5124 2.42051C11.7685 2.58482 12.0385 2.72584 12.2781 2.91819C12.522 3.10544 12.7702 3.28458 12.9907 3.50357C13.4312 3.21235 13.8976 2.93868 14.3777 2.6971C14.8955 3.25402 15.3798 3.85511 15.7752 4.52774C15.5165 4.9441 15.1789 5.43899 14.8223 5.88763H1.13254C0.823832 5.50544 0.490472 5.01534 0.179688 4.52774C0.575141 3.85511 1.05924 3.25402 1.57697 2.6971C2.05728 2.93868 2.52351 3.21235 2.96401 3.50357C3.18451 3.28458 3.43322 3.10544 3.67673 2.91819C3.9164 2.72584 4.18607 2.58482 4.44266 2.42051C4.3662 1.85296 4.32848 1.29423 4.31337 0.711094Z" fill="#5865F2"/>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://dtc6ckladq0td" uid="uid://c70jidlptani4"
path="res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex" path="res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://addons/discord-sdk-gd/nodes/assets/circle.svg" source_file="res://addons/discord-sdk-gd/nodes/assets/Group_1.svg"
dest_files=["res://.godot/imported/circle.svg-ca71b895eb1c5e7e6f2f2afe081d28dd.ctex"] dest_files=["res://.godot/imported/Group_1.svg-8cf36058739c5884a9a47a4dfa7d001a.ctex"]
[params] [params]

View File

@@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg id="Ebene_1" data-name="Ebene 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 44.72 44.72">
<defs>
<style>
.cls-1 {
fill: #fff;
}
</style>
</defs>
<circle class="cls-1" cx="22.36" cy="22.36" r="22.36"/>
</svg>

Before

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

View File

@@ -2,16 +2,16 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://csl0e2px0cwc1" uid="uid://cq8lwj2matk6x"
path="res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex" path="res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://assets/Logo_V2_No_Bg.png" source_file="res://addons/discord-sdk-gd/nodes/assets/flow_spritesheet.png"
dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex"] dest_files=["res://.godot/imported/flow_spritesheet.png-4637bb4103771b4d4bbc78a0bb858512.ctex"]
[params] [params]

View File

@@ -1,23 +1,8 @@
## [color=yellow]PLEASE IGNORE![/color] This is a important Node wich gets automatically added as Singleton. ## This always needs to run in the background if you want to comunicate with the discord client.
##
## 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
@tool
class_name core_updater
extends Node extends Node
func _process(_delta): @export var is_running: bool =false
if(ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled") && Engine.is_editor_hint()):
if(discord_sdk.app_id != 1108142249990176808): func _process(delta) -> void:
discord_sdk.app_id = 1108142249990176808 discord_sdk.coreupdate()
discord_sdk.details = ProjectSettings.get_setting("application/config/name") is_running = true
discord_sdk.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
discord_sdk.large_image = "godot"
discord_sdk.large_image_text = str(Engine.get_version_info().string)
discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
discord_sdk.refresh()
if(discord_sdk.app_id == 1108142249990176808 || !Engine.is_editor_hint()):
discord_sdk.coreupdate()

View File

@@ -1,9 +1,4 @@
## This is a Debug Node wich will show some usefull info and buttons/input ## This is a Debug Node wich will show (only if the project runs) 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
@tool
extends Node extends Node
func _ready() -> void: func _ready() -> void:

View File

@@ -1,96 +0,0 @@
[gd_scene load_steps=8 format=3 uid="uid://byc4c6d5tpomq"]
[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://assets/Logo_V2_No_Bg.png" id="1_r3i13"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1t7mm"]
[sub_resource type="Theme" id="Theme_swwco"]
Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
[sub_resource type="Image" id="Image_ylyvr"]
data = {
"data": PackedByteArray(255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 168, 224, 224, 224, 233, 224, 224, 224, 236, 224, 224, 224, 170, 231, 231, 231, 31, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 234, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 239, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 168, 224, 224, 224, 255, 224, 224, 224, 186, 224, 224, 224, 32, 224, 224, 224, 33, 224, 224, 224, 187, 224, 224, 224, 255, 225, 225, 225, 167, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 227, 227, 227, 36, 224, 224, 224, 255, 224, 224, 224, 234, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 237, 224, 224, 224, 255, 224, 224, 224, 33, 255, 255, 255, 0, 255, 255, 255, 0, 229, 229, 229, 38, 224, 224, 224, 255, 224, 224, 224, 229, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 164, 224, 224, 224, 255, 224, 224, 224, 187, 225, 225, 225, 34, 227, 227, 227, 36, 224, 224, 224, 192, 224, 224, 224, 255, 224, 224, 224, 162, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 225, 225, 225, 215, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 229, 224, 224, 224, 32, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 24, 224, 224, 224, 216, 224, 224, 224, 255, 224, 224, 224, 210, 224, 224, 224, 161, 224, 224, 224, 232, 224, 224, 224, 231, 225, 225, 225, 159, 230, 230, 230, 30, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 107, 224, 224, 224, 255, 224, 224, 224, 210, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 105, 230, 230, 230, 20, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 224, 224, 224, 130, 255, 255, 255, 1, 255, 255, 255, 1, 225, 225, 225, 134, 224, 224, 224, 224, 225, 225, 225, 223, 224, 224, 224, 132, 255, 255, 255, 1, 255, 255, 255, 6, 224, 224, 224, 137, 224, 224, 224, 231, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 130, 225, 225, 225, 133, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 129, 224, 224, 224, 137, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 220, 225, 225, 225, 223, 224, 224, 224, 255, 226, 226, 226, 61, 224, 224, 224, 65, 224, 224, 224, 255, 224, 224, 224, 222, 224, 224, 224, 231, 224, 224, 224, 255, 227, 227, 227, 62, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 222, 224, 224, 224, 255, 227, 227, 227, 63, 225, 225, 225, 67, 224, 224, 224, 255, 224, 224, 224, 219, 224, 224, 224, 230, 224, 224, 224, 255, 227, 227, 227, 63, 255, 255, 255, 0, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 127, 224, 224, 224, 129, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 225, 225, 225, 126, 225, 225, 225, 135, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 255, 255, 255, 255, 0, 224, 224, 224, 255, 224, 224, 224, 255, 224, 224, 224, 221, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 1, 224, 224, 224, 128, 224, 224, 224, 220, 224, 224, 224, 219, 225, 225, 225, 127, 255, 255, 255, 0, 255, 255, 255, 5, 225, 225, 225, 134, 224, 224, 224, 229, 224, 224, 224, 255, 255, 255, 255, 0),
"format": "RGBA8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
image = SubResource("Image_ylyvr")
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
[node name="RestartWindow" type="ConfirmationDialog"]
title = "Restart required"
initial_position = 2
size = Vector2i(416, 400)
visible = true
unresizable = true
theme = SubResource("Theme_swwco")
ok_button_text = "Restart"
cancel_button_text = "Save and restart"
[node name="Panel" type="Panel" parent="."]
offset_left = 8.0
offset_top = 8.0
offset_right = 408.0
offset_bottom = 351.0
mouse_filter = 1
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
custom_minimum_size = Vector2(400, 0)
layout_mode = 0
offset_right = 400.0
offset_bottom = 309.0
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer"]
layout_mode = 2
mouse_filter = 1
theme_override_constants/separation = 15
theme_override_styles/separator = SubResource("StyleBoxEmpty_5vqdt")
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="DocsIcon" type="TextureRect" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 8
size_flags_vertical = 4
texture = SubResource("ImageTexture_gdtpn")
stretch_mode = 2
[node name="LinkButton" type="LinkButton" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 8
text = "Plugin Docs"
uri = "https://github.com/vaporvee/discord-sdk-godot/wiki"
[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"]
custom_minimum_size = Vector2(128, 128)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
texture = ExtResource("1_r3i13")
expand_mode = 1
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
custom_minimum_size = Vector2(400, 200)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 0
mouse_filter = 1
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
bbcode_enabled = true
text = "[center]Thanks for enabling the
[rainbow]Discord Game SDK Plugin[/rainbow]
made by vaporvee. ❤️
You need to [wave]restart[/wave] the editor to fully enable this plugin!
Do you want to [wave]save[/wave] your project before restarting?"

View File

@@ -3,5 +3,5 @@
name="DiscordSDK" name="DiscordSDK"
description="Discord Game SDK support for GDScript in Godot" description="Discord Game SDK support for GDScript in Godot"
author="vaporvee" author="vaporvee"
version="3.0" version="2.0"
script="plugin.gd" script="plugin.gd"

View File

@@ -1,36 +1,47 @@
@tool @tool
extends EditorPlugin 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 = preload("res://addons/discord-sdk-gd/nodes/debug.gd")
const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg") const DiscordSDKDebug_icon = preload("res://addons/discord-sdk-gd/nodes/assets/Debug.svg")
var loaded_DiscordSDKDebug = DiscordSDKDebug.new() var loaded_DiscordSDKDebug = DiscordSDKDebug.new()
var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/nodes/restart_window.tscn").instantiate()
const ExportPlugin = preload("res://addons/discord-sdk-gd/export.gd")
var loaded_exportplugin = ExportPlugin.new()
func _enter_tree() -> void: func _enter_tree() -> void:
add_custom_type("DiscordSDKLoader","Node",DiscordSDKLoader,DiscordSDKLoader_icon)
add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon) add_custom_type("DiscordSDKDebug","Node",DiscordSDKDebug,DiscordSDKDebug_icon)
add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd") add_autoload_singleton("DiscordSDKLoader", "res://addons/discord-sdk-gd/nodes/core_updater.gd")
add_export_plugin(loaded_exportplugin)
func _enable_plugin() -> void: func _enable_plugin():
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"): print("DiscordSDK Addon got enabled")
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false)
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false) ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true) ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true)
get_tree().root.add_child(restart_window)
restart_window.connect("canceled",save_restart)
restart_window.connect("confirmed",restart)
func _disable_plugin() -> void: func _disable_plugin() -> void:
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE) print("DiscordSDK Addon got disabled")
push_warning("DiscordSDK Addon got disabled. PLEASE RESTART THE EDITOR!")
remove_autoload_singleton("DiscordSDKLoader") remove_autoload_singleton("DiscordSDKLoader")
remove_custom_type("DiscordSDKLoader")
remove_custom_type("DiscordSDKDebug") remove_custom_type("DiscordSDKDebug")
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled") ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")
func save_restart() -> void: func _process(_delta):
get_editor_interface().restart_editor(true) if(ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled")&&!get_editor_interface().is_playing_scene()):
if(discord_sdk.app_id != 1108142249990176808):
func restart() -> void: discord_sdk.app_id = 1108142249990176808
get_editor_interface().restart_editor(false) discord_sdk.details = ProjectSettings.get_setting("application/config/name")
discord_sdk.state = "Editing: \""+ str(get_tree().edited_scene_root.scene_file_path).replace("res://","") +"\""
discord_sdk.large_image = "godot"
discord_sdk.large_image_text = str(Engine.get_version_info())
discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
discord_sdk.refresh()
if(discord_sdk.app_id == 1108142249990176808):
discord_sdk.coreupdate()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bjns3n0prshdy"
path="res://.godot/imported/Logo_V2_No_Bg_Small.png-6c9c0ba88b8e0a9cb7aa1acb948a1191.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/Logo_V2_No_Bg_Small.png"
dest_files=["res://.godot/imported/Logo_V2_No_Bg_Small.png-6c9c0ba88b8e0a9cb7aa1acb948a1191.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -8,17 +8,18 @@ custom_features=""
export_filter="all_resources" export_filter="all_resources"
include_filter="" include_filter=""
exclude_filter="" exclude_filter=""
export_path="../../testexpoort/discord_sdk_demo.exe" export_path="../../demo/discord_sdk.exe"
encryption_include_filters="" encryption_include_filters=""
encryption_exclude_filters="" encryption_exclude_filters=""
encrypt_pck=false encrypt_pck=false
encrypt_directory=false encrypt_directory=false
script_encryption_key=""
[preset.0.options] [preset.0.options]
custom_template/debug="" custom_template/debug=""
custom_template/release="" custom_template/release=""
debug/export_console_wrapper=1 debug/export_console_script=1
binary_format/embed_pck=true binary_format/embed_pck=true
texture_format/bptc=true texture_format/bptc=true
texture_format/s3tc=true texture_format/s3tc=true
@@ -26,20 +27,23 @@ texture_format/etc=false
texture_format/etc2=false texture_format/etc2=false
binary_format/architecture="x86_64" binary_format/architecture="x86_64"
codesign/enable=false codesign/enable=false
codesign/identity_type=0
codesign/identity=""
codesign/password=""
codesign/timestamp=true codesign/timestamp=true
codesign/timestamp_server_url="" codesign/timestamp_server_url=""
codesign/digest_algorithm=1 codesign/digest_algorithm=1
codesign/description="" codesign/description=""
codesign/custom_options=PackedStringArray() codesign/custom_options=PackedStringArray()
application/modify_resources=true application/modify_resources=false
application/icon="res://assets/Logo_V2.png" application/icon=""
application/console_wrapper_icon="" application/console_wrapper_icon=""
application/icon_interpolation=4 application/icon_interpolation=4
application/file_version="" application/file_version=""
application/product_version="" application/product_version=""
application/company_name="" application/company_name=""
application/product_name="" application/product_name=""
application/file_description="Discord SDK Godot Test" application/file_description=""
application/copyright="" application/copyright=""
application/trademarks="" application/trademarks=""
ssh_remote_deploy/enabled=false ssh_remote_deploy/enabled=false

View File

@@ -5,8 +5,6 @@ func _ready() -> void:
discord_sdk.connect("activity_join_request",_on_activity_join_request) discord_sdk.connect("activity_join_request",_on_activity_join_request)
discord_sdk.connect("activity_join",_on_activity_join) discord_sdk.connect("activity_join",_on_activity_join)
discord_sdk.connect("activity_spectate",_on_activity_spectate) discord_sdk.connect("activity_spectate",_on_activity_spectate)
discord_sdk.connect("relationships_init",_on_relationship_init)
discord_sdk.connect("updated_relationship", _on_updated_relationship)
func set_activity() -> void: func set_activity() -> void:
discord_sdk.clear() discord_sdk.clear()
@@ -20,8 +18,8 @@ func set_activity() -> void:
discord_sdk.small_image_text = "Fighting the end boss! D:" discord_sdk.small_image_text = "Fighting the end boss! D:"
discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600 # +1 hour in unix time
# It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server understands and # It is NOT recommended to manage secrets locally! It's meant to be a payload wich the server
# returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others. # understands and returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others.
var my_secret: String = str(randi_range(0,999999)) var my_secret: String = str(randi_range(0,999999))
discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret discord_sdk.party_id = "mylobbycanbeeverything_" + my_secret
@@ -54,10 +52,9 @@ func _on_activity_join(secret) -> void:
func _on_activity_spectate(secret) -> void: func _on_activity_spectate(secret) -> void:
print(secret) print(secret)
func _on_relationship_init(): func _on_toggle_sdk_toggled(button_pressed):
print("initialized") if(button_pressed):
set_activity()
func _on_updated_relationship(relationship): else:
print(relationship) discord_sdk.clear()

View File

@@ -1,9 +1,13 @@
[gd_scene load_steps=4 format=3 uid="uid://dyc3kseph4el7"] [gd_scene load_steps=7 format=3 uid="uid://dyc3kseph4el7"]
[ext_resource type="Script" path="res://main.gd" id="1_kl8ri"] [ext_resource type="Script" path="res://main.gd" id="1_kl8ri"]
[ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"] [ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"]
[ext_resource type="Texture2D" uid="uid://dnfq6kug4x6o2" path="res://addons/discord-sdk-gd/nodes/assets/Checked.svg" id="3_wajuo"]
[ext_resource type="Texture2D" uid="uid://compmm3kviqqe" path="res://addons/discord-sdk-gd/nodes/assets/Unchecked.svg" id="4_8hvtu"]
[ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/debug.gd" id="6_ujijw"] [ext_resource type="Script" path="res://addons/discord-sdk-gd/nodes/debug.gd" id="6_ujijw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_phc3u"]
[node name="Node" type="Node"] [node name="Node" type="Node"]
script = ExtResource("1_kl8ri") script = ExtResource("1_kl8ri")
@@ -19,7 +23,7 @@ color = Color(0.345098, 0.396078, 0.94902, 1)
[node name="Sprite2D" type="Sprite2D" parent="."] [node name="Sprite2D" type="Sprite2D" parent="."]
texture_filter = 4 texture_filter = 4
position = Vector2(789, 330.5) position = Vector2(580, 308)
scale = Vector2(0.408203, 0.408203) scale = Vector2(0.408203, 0.408203)
texture = ExtResource("2_gd222") texture = ExtResource("2_gd222")
@@ -29,10 +33,10 @@ anchor_left = 0.293
anchor_top = 0.59 anchor_top = 0.59
anchor_right = 0.736 anchor_right = 0.736
anchor_bottom = 0.727 anchor_bottom = 0.727
offset_left = 208.464 offset_left = -0.536011
offset_top = 22.18 offset_top = -0.319977
offset_right = 209.128 offset_right = 0.12793
offset_bottom = 22.4039 offset_bottom = -0.0960388
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
size_flags_horizontal = 4 size_flags_horizontal = 4
@@ -42,3 +46,20 @@ text = "[center][font s=60]DiscordSDK Test"
[node name="DiscordSDKDebug" type="Node" parent="."] [node name="DiscordSDKDebug" type="Node" parent="."]
script = ExtResource("6_ujijw") script = ExtResource("6_ujijw")
[node name="ToggleSDK" type="CheckButton" parent="."]
anchors_preset = 4
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 293.0
offset_top = 142.375
offset_right = 1139.0
offset_bottom = 650.375
grow_vertical = 2
scale = Vector2(0.05, 0.05)
theme_override_icons/checked = ExtResource("3_wajuo")
theme_override_icons/unchecked = ExtResource("4_8hvtu")
theme_override_styles/focus = SubResource("StyleBoxEmpty_phc3u")
button_pressed = true
[connection signal="toggled" from="ToggleSDK" to="." method="_on_toggle_sdk_toggled"]

View File

@@ -8,17 +8,24 @@
config_version=5 config_version=5
[DiscordSDK]
EditorPresence/enabled=true
[application] [application]
config/name="GDExtension DiscordSDK Test Project" config/name="GDExtension DiscordSDK Test Project"
config/tags=PackedStringArray("vaporvee")
run/main_scene="res://main.tscn" run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.1") config/features=PackedStringArray("4.0")
boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1) boot_splash/bg_color=Color(0.25098, 0.305882, 0.929412, 1)
boot_splash/image="res://assets/Banner_v1.png" boot_splash/image="res://assets/Banner_v1.png"
boot_splash/fullsize=false boot_splash/fullsize=false
config/icon="res://assets/Logo_V2.png" config/icon="res://assets/Logo_V2.png"
[autoload]
DiscordSDKLoader="*res://addons/discord-sdk-gd/nodes/core_updater.gd"
[display] [display]
window/size/resizable=false window/size/resizable=false
@@ -27,6 +34,10 @@ window/size/resizable=false
project/assembly_name="GDExtension Test Project" project/assembly_name="GDExtension Test Project"
[editor_plugins]
enabled=PackedStringArray("res://addons/discord-sdk-gd/plugin.cfg")
[filesystem] [filesystem]
import/blender/enabled=false import/blender/enabled=false

View File

@@ -1,15 +0,0 @@
import os
from distutils.dir_util import copy_tree
import shutil
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons")
open(
"release/temp/ADDON-Discord-SDK-Godot/addons/discord-sdk-gd/bin/.gdignore", "a"
).close()
shutil.make_archive("release/ADDON-Discord-SDK-Godot", "zip", "release/temp/")
shutil.rmtree("release/temp/")

View File

@@ -6,12 +6,6 @@ import os
with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref: with zipfile.ZipFile("src/lib/discord_game_sdk.zip", "r") as zip_ref:
zip_ref.extractall("src/lib/discord_game_sdk/") zip_ref.extractall("src/lib/discord_game_sdk/")
# Patch the SDK to actually build, since it's missing an include
with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f:
s = f.read();
f.seek(0);
f.write("#include <cstdint>\n" + s)
copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/") copy_tree("src/lib/discord_game_sdk/lib/", "src/lib/discord_game_sdk/bin/")
os.rename( os.rename(
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib", "src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk.dylib",

View File

@@ -83,12 +83,8 @@ void discord_sdk::_bind_methods()
ADD_SIGNAL(MethodInfo("activity_spectate", PropertyInfo(Variant::STRING, "spectate_secret"))); ADD_SIGNAL(MethodInfo("activity_spectate", PropertyInfo(Variant::STRING, "spectate_secret")));
ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting"))); ADD_SIGNAL(MethodInfo("activity_join_request", PropertyInfo(Variant::DICTIONARY, "user_requesting")));
ADD_SIGNAL(MethodInfo("relationships_init"));
ADD_SIGNAL(MethodInfo("updated_relationship", PropertyInfo(Variant::DICTIONARY, "relationship")));
ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh); ClassDB::bind_method(D_METHOD("refresh"), &discord_sdk::refresh);
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &discord_sdk::clear, DEFVAL(false)); ClassDB::bind_method(D_METHOD("clear"), &discord_sdk::clear);
ClassDB::bind_method(D_METHOD("unclear"), &discord_sdk::unclear);
ClassDB::bind_method(D_METHOD("register_command", "command"), &discord_sdk::register_command); ClassDB::bind_method(D_METHOD("register_command", "command"), &discord_sdk::register_command);
ClassDB::bind_method(D_METHOD("register_steam", "steam_id"), &discord_sdk::register_steam); ClassDB::bind_method(D_METHOD("register_steam", "steam_id"), &discord_sdk::register_steam);
@@ -98,7 +94,6 @@ void discord_sdk::_bind_methods()
ClassDB::bind_method(D_METHOD("accept_invite", "user_id"), &discord_sdk::accept_invite); ClassDB::bind_method(D_METHOD("accept_invite", "user_id"), &discord_sdk::accept_invite);
ClassDB::bind_method(D_METHOD("get_current_user"), &discord_sdk::get_current_user); ClassDB::bind_method(D_METHOD("get_current_user"), &discord_sdk::get_current_user);
ClassDB::bind_method(D_METHOD("get_all_relationships"), &discord_sdk::get_all_relationships);
ClassDB::bind_method(D_METHOD("get_is_overlay_enabled"), &discord_sdk::get_is_overlay_enabled); ClassDB::bind_method(D_METHOD("get_is_overlay_enabled"), &discord_sdk::get_is_overlay_enabled);
ClassDB::bind_method(D_METHOD("get_is_overlay_locked"), &discord_sdk::get_is_overlay_locked); ClassDB::bind_method(D_METHOD("get_is_overlay_locked"), &discord_sdk::get_is_overlay_locked);
@@ -159,44 +154,44 @@ void discord_sdk::debug()
void discord_sdk::set_app_id(int64_t value) void discord_sdk::set_app_id(int64_t value)
{ {
app_id = value; app_id = value;
if (app_id > 0) result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything
if (result == discord::Result::Ok && app_id > 0)
{ {
result = discord::Core::Create(value, DiscordCreateFlags_NoRequireDiscord, &core); // after setting app_ID it initializes everything // initialize currentuser stuff
core->UserManager().OnCurrentUserUpdate.Connect([]()
if (result == discord::Result::Ok) {discord::User user{};
{ core->UserManager().GetCurrentUser(&user); });
// initialize currentuser stuff // signals
core->UserManager().OnCurrentUserUpdate.Connect([]() core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
{discord::User user{}; { discord_sdk::get_singleton()
core->UserManager().GetCurrentUser(&user); }); ->emit_signal("activity_join", secret); });
// signals core->ActivityManager().OnActivitySpectate.Connect([](const char *secret)
core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
{ discord_sdk::get_singleton() { discord_sdk::get_singleton()
->emit_signal("activity_join", secret); }); ->emit_signal("activity_spectate", secret); });
core->ActivityManager().OnActivitySpectate.Connect([](const char *secret) core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
{ discord_sdk::get_singleton() { Dictionary user_requesting;
->emit_signal("activity_spectate", secret); }); user_requesting["avatar"] = user.GetAvatar(); //can be empty when user has no avatar
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user) user_requesting["is_bot"] = user.GetBot();
{ discord_sdk::get_singleton() user_requesting["discriminator"] = user.GetDiscriminator();
->emit_signal("activity_join_request", user2dict(user)); }); user_requesting["id"] = user.GetId();
user_requesting["username"] = user.GetUsername();
if(String(user_requesting["avatar"]).is_empty())
user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((user_requesting["discriminator"].INT % 5) - 1)+ ".png").c_str());
else
user_requesting["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str());//I don't know what the hell i did there but removing ?size=512 will crash the whole editor
user_requesting.make_read_only();
discord_sdk::get_singleton()
->emit_signal("activity_join_request",user_requesting); });
core->OverlayManager().OnToggle.Connect([](bool is_locked) core->OverlayManager().OnToggle.Connect([](bool is_locked)
{ discord_sdk::get_singleton() { discord_sdk::get_singleton()
->emit_signal("overlay_toggle", is_locked); }); ->emit_signal("overlay_toggle", is_locked); });
core->RelationshipManager().OnRefresh.Connect([&]()
{ discord_sdk::get_singleton()
->emit_signal("relationships_init"); });
core->RelationshipManager().OnRelationshipUpdate.Connect([&](discord::Relationship const &relationship)
{ discord_sdk::get_singleton()
->emit_signal("updated_relationship", relationship2dict(relationship)); });
}
} }
} }
int64_t discord_sdk::get_app_id() int64_t discord_sdk::get_app_id()
{ {
if (app_id != 0) return app_id;
return app_id;
return old_app_id;
} }
void discord_sdk::set_state(String value) void discord_sdk::set_state(String value)
@@ -230,52 +225,34 @@ void discord_sdk::refresh()
UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!"); UtilityFunctions::push_warning("Discord Activity couldn't be updated. It could be that Discord isn't running!");
} }
void discord_sdk::clear(bool reset_values = false) void discord_sdk::clear()
{ {
if (result == discord::Result::Ok) if (result == discord::Result::Ok)
{ {
if (reset_values) app_id = 0;
{ state = "";
old_app_id = 0; details = "";
set_state(""); large_image = "";
set_details(""); large_image_text = "";
set_large_image(""); small_image = "";
set_large_image_text(""); small_image_text = "";
set_small_image(""); start_timestamp = 0;
set_small_image_text(""); end_timestamp = 0;
set_start_timestamp(0); party_id = "";
set_end_timestamp(0); current_party_size = 0;
set_party_id(""); max_party_size = 0;
set_current_party_size(0); match_secret = "";
set_max_party_size(0); join_secret = "";
set_match_secret(""); spectate_secret = "";
set_join_secret(""); instanced = false;
set_spectate_secret(""); is_public_party = false;
set_instanced(false); is_overlay_locked = false;
set_is_public_party(false);
set_is_overlay_locked(false);
core->ActivityManager().ClearActivity([](discord::Result result) {});
}
else
old_app_id = app_id;
set_app_id(0);
delete core; delete core;
core = nullptr; core = nullptr;
} }
} }
void discord_sdk::unclear()
{
if (old_app_id > 0)
{
set_app_id(old_app_id);
refresh();
old_app_id = 0;
}
else
UtilityFunctions::push_warning("Discord Activity couldn't be uncleared. Maybe it didn't get cleared before?");
}
void discord_sdk::set_large_image(String value) void discord_sdk::set_large_image(String value)
{ {
large_image = value; large_image = value;
@@ -478,40 +455,20 @@ Dictionary discord_sdk::get_current_user()
{ {
discord::User user{}; discord::User user{};
core->UserManager().GetCurrentUser(&user); core->UserManager().GetCurrentUser(&user);
return user2dict(user); userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
userdict["is_bot"] = user.GetBot();
userdict["discriminator"] = user.GetDiscriminator();
userdict["id"] = user.GetId();
userdict["username"] = user.GetUsername();
if (String(userdict["avatar"]).is_empty())
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str());
else
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png?size=512").c_str());
userdict.make_read_only();
} }
return userdict; return userdict;
} }
Dictionary discord_sdk::get_relationship(int64_t user_id)
{
if (result == discord::Result::Ok && app_id > 0)
{
discord::Relationship relationship{};
core->RelationshipManager().Get(user_id, &relationship);
return relationship2dict(relationship);
}
Dictionary dict;
return dict;
}
Array discord_sdk::get_all_relationships()
{
Array all_relationships;
core->RelationshipManager().Filter(
[](discord::Relationship const &relationship) -> bool
{ return true; });
int32_t friendcount{0};
core->RelationshipManager().Count(&friendcount);
for (int i = 0; i < friendcount; i++)
{
discord::Relationship relationship{};
core->RelationshipManager().GetAt(2, &relationship);
all_relationships.append(relationship2dict(relationship));
}
return all_relationships;
}
bool discord_sdk::get_is_discord_working() bool discord_sdk::get_is_discord_working()
{ {
return result == discord::Result::Ok && app_id > 0; return result == discord::Result::Ok && app_id > 0;
@@ -521,91 +478,3 @@ int discord_sdk::get_result_int()
{ {
return static_cast<int>(result); return static_cast<int>(result);
} }
Dictionary discord_sdk::user2dict(discord::User user)
{
Dictionary userdict;
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
userdict["is_bot"] = user.GetBot();
userdict["discriminator"] = user.GetDiscriminator();
userdict["id"] = user.GetId();
userdict["username"] = user.GetUsername();
if (String(userdict["avatar"]).is_empty())
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/embed/avatars/" + std::to_string((userdict["discriminator"].INT % 5) - 1) + ".png").c_str());
else
userdict["avatar_url"] = String(std::string("https://cdn.discordapp.com/avatars/" + std::to_string(user.GetId()) + "/" + user.GetAvatar() + ".png").c_str());
userdict.make_read_only();
return userdict;
}
Dictionary discord_sdk::relationship2dict(discord::Relationship relationship)
{
Dictionary dict_relationship;
Dictionary presence;
Dictionary presence_activity;
switch (static_cast<int>(relationship.GetPresence().GetStatus()))
{
case 0:
presence["status"] = "Offline";
break;
case 1:
presence["status"] = "Online";
break;
case 2:
presence["status"] = "Idle";
break;
case 3:
presence["status"] = "DoNotDisturb";
break;
default:
presence["status"] = "NotAvailable";
break;
}
presence_activity["application_id"] = relationship.GetPresence().GetActivity().GetApplicationId();
presence_activity["name"] = relationship.GetPresence().GetActivity().GetName();
presence_activity["state"] = relationship.GetPresence().GetActivity().GetState();
presence_activity["details"] = relationship.GetPresence().GetActivity().GetDetails();
presence_activity["large_image"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeImage();
presence_activity["large_text"] = relationship.GetPresence().GetActivity().GetAssets().GetLargeText();
presence_activity["small_image"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallImage();
presence_activity["small_text"] = relationship.GetPresence().GetActivity().GetAssets().GetSmallText();
presence_activity["timestamps_start"] = relationship.GetPresence().GetActivity().GetTimestamps().GetStart();
presence_activity["timestamps_end"] = relationship.GetPresence().GetActivity().GetTimestamps().GetEnd();
presence_activity["instance"] = relationship.GetPresence().GetActivity().GetInstance();
presence_activity["party_id"] = relationship.GetPresence().GetActivity().GetParty().GetId();
presence_activity["current_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetCurrentSize();
presence_activity["max_party_size"] = relationship.GetPresence().GetActivity().GetParty().GetSize().GetMaxSize();
presence_activity["join_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetJoin();
presence_activity["spectate_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetSpectate();
presence_activity["match_secret"] = relationship.GetPresence().GetActivity().GetSecrets().GetMatch();
presence["activity"] = presence_activity;
presence.make_read_only();
switch (relationship.GetType())
{
case discord::RelationshipType::None:
dict_relationship["type"] = "None";
break;
case discord::RelationshipType::Friend:
dict_relationship["type"] = "Friend";
break;
case discord::RelationshipType::Blocked:
dict_relationship["type"] = "Blocked";
break;
case discord::RelationshipType::PendingIncoming:
dict_relationship["type"] = "PendingIncoming";
break;
case discord::RelationshipType::PendingOutgoing:
dict_relationship["type"] = "PendingOutgoing";
break;
case discord::RelationshipType::Implicit:
dict_relationship["type"] = "Implicit";
break;
default:
dict_relationship["type"] = "NotAvailable";
break;
}
dict_relationship["user"] = user2dict(relationship.GetUser());
dict_relationship["presence"] = presence;
dict_relationship.make_read_only();
return dict_relationship;
}

View File

@@ -17,24 +17,12 @@ class discord_sdk : public RefCounted
protected: protected:
static void _bind_methods(); static void _bind_methods();
public: private:
static discord_sdk * int64_t app_id;
get_singleton();
discord_sdk();
~discord_sdk();
// INTERBNAL
int64_t old_app_id;
Dictionary relationship2dict(discord::Relationship relationship);
Dictionary user2dict(discord::User user);
///
int64_t app_id = 0;
String state; String state;
String details; String details;
// just want to make pr
String large_image; String large_image;
String large_image_text; String large_image_text;
String small_image; String small_image;
@@ -56,12 +44,18 @@ public:
bool is_overlay_locked; bool is_overlay_locked;
public:
static discord_sdk *
get_singleton();
discord_sdk();
~discord_sdk();
void debug(); void debug();
void coreupdate(); void coreupdate();
void refresh(); void refresh();
void clear(bool reset_values); void clear();
void unclear();
int64_t get_app_id(); int64_t get_app_id();
void set_app_id(int64_t value); void set_app_id(int64_t value);
String get_state(); String get_state();
@@ -118,8 +112,7 @@ public:
void register_steam(int32_t value); void register_steam(int32_t value);
Dictionary get_current_user(); Dictionary get_current_user();
Dictionary get_relationship(int64_t user_id); void set_current_user(Dictionary value);
Array get_all_relationships();
bool get_is_discord_working(); bool get_is_discord_working();
int get_result_int(); int get_result_int();

View File

@@ -11,7 +11,7 @@ using namespace godot;
static discord_sdk *discordsdk; static discord_sdk *discordsdk;
void initialize_discordsdk_module(ModuleInitializationLevel p_level) void gdextension_initialize(ModuleInitializationLevel p_level)
{ {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
{ {
@@ -21,7 +21,7 @@ void initialize_discordsdk_module(ModuleInitializationLevel p_level)
} }
} }
void uninitialize_discordsdk_module(ModuleInitializationLevel p_level) void gdextension_terminate(ModuleInitializationLevel p_level)
{ {
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE) if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
{ {
@@ -32,12 +32,12 @@ void uninitialize_discordsdk_module(ModuleInitializationLevel p_level)
extern "C" extern "C"
{ {
GDExtensionBool GDE_EXPORT discordsdkgd_library_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) GDExtensionBool GDE_EXPORT discordsdkgd_library_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization)
{ {
godot::GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization); godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
init_obj.register_initializer(initialize_discordsdk_module); init_obj.register_initializer(gdextension_initialize);
init_obj.register_terminator(uninitialize_discordsdk_module); init_obj.register_terminator(gdextension_terminate);
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE); init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
return init_obj.init(); return init_obj.init();