Compare commits
100 Commits
Author | SHA1 | Date | |
---|---|---|---|
55b41f85fa | |||
d468df31df | |||
a97cf81ea9 | |||
2ad1dd1e25 | |||
0c280cf2e6 | |||
91786abb15 | |||
577e6b87b4 | |||
d318d7b5f9 | |||
9d8a809b13 | |||
79c6ea8a9e | |||
0bf43164f2 | |||
605080d7ff | |||
|
1b56b8c8df | ||
|
9f49afd472 | ||
|
e016b7b582 | ||
|
4726a4488b | ||
|
bcdf52d5c6 | ||
|
c4da303a5d | ||
|
de8e4b4793 | ||
|
ecead11830 | ||
|
91074133bb | ||
37c7759cdf | |||
262450728d | |||
dab07c9f62 | |||
d3919d249b | |||
91c4946116 | |||
cd19b48ca8 | |||
|
93d424e3e7 | ||
|
96afc12c92 | ||
|
20978010a1 | ||
|
39078e7a98 | ||
dc7b4b43ad | |||
37c679d1bc | |||
9f1395c6a7 | |||
|
a52ca54bca | ||
|
7be2c5a119 | ||
0fb4526191 | |||
|
f8a84cf3d5 | ||
7859bd0a77 | |||
f5560593d0 | |||
3f58da00ad | |||
ea829e8603 | |||
1e1bc6c59d | |||
|
5153c4e9ed | ||
|
5f56cf4b26 | ||
210555d7a5 | |||
e206b11848 | |||
eea4812afb | |||
b51508fe33 | |||
11896d31ff | |||
27c7fa26f1 | |||
50e717daaa | |||
8927ba76b9 | |||
43198d0e99 | |||
5cac6404b0 | |||
899f8f4b02 | |||
78dbde81fd | |||
8de5c65cdc | |||
|
829e84c5d9 | ||
|
7a237ec460 | ||
e69c514b44 | |||
81eb0e4e45 | |||
1f2dac7a0e | |||
|
1d490a666f | ||
6fd58b0ddf | |||
dba8569ebc | |||
6121ce5418 | |||
|
d744144d6d | ||
|
c7a06b6d9a | ||
|
b24defd292 | ||
|
ae076a6403 | ||
|
a4cf76c323 | ||
|
23b4e05e83 | ||
|
58cbfe9345 | ||
|
245110f103 | ||
|
7389119992 | ||
|
a57c78146e | ||
|
0686fad440 | ||
|
4bda87c54d | ||
8c583b85b1 | |||
52f43b724c | |||
|
253013d0e9 | ||
1b43adba77 | |||
|
aa486d39c9 | ||
|
68cb2ddb44 | ||
|
30af177aa3 | ||
|
cbc0c85c76 | ||
|
ed4149e7a7 | ||
|
3b244f4a91 | ||
|
305d314224 | ||
|
0ee6a3268c | ||
|
b143809744 | ||
|
fab2efb88a | ||
|
063f559624 | ||
|
ce93ed4294 | ||
|
2b19fd9be2 | ||
|
f93fbe4a1b | ||
|
f78e2e9744 | ||
|
ea4324aba8 | ||
aedbc03f8c |
1
.github/FUNDING.yml
vendored
@@ -1 +1,2 @@
|
|||||||
|
patreon: vaporvee
|
||||||
ko_fi: vaporvee
|
ko_fi: vaporvee
|
||||||
|
53
.github/ISSUE_TEMPLATE/BUG.yml
vendored
@@ -1,6 +1,6 @@
|
|||||||
name: Bug Report
|
name: Error
|
||||||
description: File a bug report
|
description: Get help with an error or report a bug
|
||||||
title: "[Bug/Crash]: "
|
title: "[Issue/Bug]: "
|
||||||
labels: ["bug"]
|
labels: ["bug"]
|
||||||
assignees:
|
assignees:
|
||||||
- vaporvee
|
- vaporvee
|
||||||
@@ -21,20 +21,26 @@ body:
|
|||||||
id: version
|
id: version
|
||||||
attributes:
|
attributes:
|
||||||
label: Version
|
label: Version
|
||||||
description: What version of our software are you running?
|
description: What version of the Discord Game SDK Godot plugin are you running?
|
||||||
options:
|
options:
|
||||||
- 3.0
|
- 1.2.0
|
||||||
- 2.4
|
- 1.1.0
|
||||||
- 2.3
|
- 1.0.1
|
||||||
- 2.2
|
- 1.0.0
|
||||||
- 2.1
|
- 0.3.2
|
||||||
- 2.0
|
- 0.3.1
|
||||||
- 1.5
|
- 0.3.0
|
||||||
- 1.4
|
- 0.2.4
|
||||||
- 1.3
|
- 0.2.3
|
||||||
- 1.2
|
- 0.2.2
|
||||||
- 1.1
|
- 0.2.1
|
||||||
- 1.0
|
- 0.2.0
|
||||||
|
- 0.1.5
|
||||||
|
- 0.1.4
|
||||||
|
- 0.1.3
|
||||||
|
- 0.1.2
|
||||||
|
- 0.1.1
|
||||||
|
- 0.1.0
|
||||||
- Custom build
|
- Custom build
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
@@ -42,8 +48,15 @@ body:
|
|||||||
id: gd-version
|
id: gd-version
|
||||||
attributes:
|
attributes:
|
||||||
label: Godot Version
|
label: Godot Version
|
||||||
description: This addon is ONLY for 4.0 and above!
|
description: This addon is ONLY for 4.1 and above!
|
||||||
placeholder: e.g. 4.0.2-stable
|
placeholder: e.g. 4.1.0-stable
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: steps_reproduce
|
||||||
|
attributes:
|
||||||
|
label: Exact steps to reproduce this error
|
||||||
|
description: Tell what completely exactly you did from downloading and copying the plugin to the error. You can also drag and drop a zip file of how you would setup a fresh project with it.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
@@ -76,8 +89,10 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: Checks
|
label: Checks
|
||||||
description: Common mistakes (Adding more in the future sorry btw)
|
description: Common mistakes (Adding more in the future sorry btw)
|
||||||
options:
|
options:
|
||||||
- label: I tried reinstalling the addon or tried to fix it myself with other methods.
|
- label: I tried reinstalling the addon or tried to fix it myself with other methods.
|
||||||
required: true
|
required: true
|
||||||
- label: I tried restarting Discord and Godot completely.
|
- label: I tried restarting Discord and Godot completely.
|
||||||
required: true
|
required: true
|
||||||
|
- label: I did read the documentation https://vaporvee.com/docs/discord-sdk-godot/
|
||||||
|
required: true
|
||||||
|
65
.github/workflows/auto_wontfix.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: Auto Wontfix Issues
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, edited]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
auto_wontfix:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check for specific word in the issue
|
||||||
|
uses: actions/github-script@v4
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.WONTFIX_TOKEN }}
|
||||||
|
script: |
|
||||||
|
const wordToCheck = 'mac';
|
||||||
|
const issue = context.payload.issue;
|
||||||
|
|
||||||
|
if (issue.body && issue.body.toLowerCase().includes(wordToCheck)) {
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const number = issue.number;
|
||||||
|
const issueComment = "macOS is not supported, because loading libraries in Godot from third-party sources requires a paid developer certificate from Apple. You are welcome to compile and sign the library yourself.";
|
||||||
|
|
||||||
|
// Mark the issue as "wontfix"
|
||||||
|
await octokit.issues.update({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
state: 'closed',
|
||||||
|
labels: ['wontfix']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Post a comment on the issue
|
||||||
|
await octokit.issues.createComment({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
body: issueComment
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (issue.title && issue.title.toLowerCase().includes(wordToCheck)) {
|
||||||
|
const repo = context.repo.repo;
|
||||||
|
const owner = context.repo.owner;
|
||||||
|
const number = issue.number;
|
||||||
|
const issueComment = "macOS is not supported, because loading libraries in Godot from third-party sources requires a paid developer certificate from Apple. You are welcome to compile and sign the library yourself.";
|
||||||
|
|
||||||
|
// Mark the issue as "wontfix"
|
||||||
|
await octokit.issues.update({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
state: 'closed',
|
||||||
|
labels: ['wontfix']
|
||||||
|
});
|
||||||
|
|
||||||
|
// Post a comment on the issue
|
||||||
|
await octokit.issues.createComment({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: number,
|
||||||
|
body: issueComment
|
||||||
|
});
|
||||||
|
}
|
14
.gitignore
vendored
@@ -1,12 +1,14 @@
|
|||||||
# Objects.
|
# Objects.
|
||||||
.scons-cache/
|
.scons-cache/
|
||||||
*.os
|
*.os
|
||||||
|
*.o
|
||||||
|
|
||||||
# SConstruct
|
# SConstruct
|
||||||
.sconf_temp
|
.sconf_temp
|
||||||
.sconsign.dblite
|
.sconsign.dblite
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
|
|
||||||
# MacOS
|
# MacOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
@@ -17,9 +19,15 @@ build/
|
|||||||
*.obj
|
*.obj
|
||||||
*.exp
|
*.exp
|
||||||
*.lib
|
*.lib
|
||||||
|
*.a
|
||||||
|
|
||||||
#Clean files from the Game SDK
|
#Clean files from setup.py
|
||||||
src/lib/discord_game_sdk/
|
src/lib/discord_game_sdk/
|
||||||
|
|
||||||
# release.py
|
# release
|
||||||
release/
|
release/
|
||||||
|
project/export/
|
||||||
|
|
||||||
|
# venv
|
||||||
|
venv/
|
||||||
|
|
||||||
|
1
.gitmodules
vendored
@@ -1,3 +1,4 @@
|
|||||||
[submodule "src/lib/godot-cpp"]
|
[submodule "src/lib/godot-cpp"]
|
||||||
path = src/lib/godot-cpp
|
path = src/lib/godot-cpp
|
||||||
url = https://github.com/godotengine/godot-cpp
|
url = https://github.com/godotengine/godot-cpp
|
||||||
|
branch = 4.1
|
||||||
|
3
.vscode/c_cpp_properties.json
vendored
@@ -6,7 +6,8 @@
|
|||||||
"${default}",
|
"${default}",
|
||||||
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include",
|
||||||
"${workspaceFolder}/src/lib/godot-cpp/include",
|
"${workspaceFolder}/src/lib/godot-cpp/include",
|
||||||
"${workspaceFolder}/src/lib/godot-cpp/gdextension"
|
"${workspaceFolder}/src/lib/godot-cpp/gdextension",
|
||||||
|
"${workspaceFolder}/src/lib/godot-cpp/gen/include"
|
||||||
],
|
],
|
||||||
"defines": [
|
"defines": [
|
||||||
"_DEBUG",
|
"_DEBUG",
|
||||||
|
5
.vscode/extensions.json
vendored
@@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"ms-vscode.cpptools"
|
"ms-vscode.cpptools",
|
||||||
|
"ms-vscode.cpptools-extension-pack",
|
||||||
|
"geequlim.godot-tools",
|
||||||
|
"ms-python.python"
|
||||||
]
|
]
|
||||||
}
|
}
|
59
.vscode/settings.json
vendored
@@ -4,64 +4,7 @@
|
|||||||
"${workspaceFolder}/src/lib/godot-cpp/include"
|
"${workspaceFolder}/src/lib/godot-cpp/include"
|
||||||
],
|
],
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"xlocbuf": "cpp",
|
"*.gdextension": "ini"
|
||||||
"algorithm": "cpp",
|
|
||||||
"array": "cpp",
|
|
||||||
"atomic": "cpp",
|
|
||||||
"bit": "cpp",
|
|
||||||
"cctype": "cpp",
|
|
||||||
"clocale": "cpp",
|
|
||||||
"cmath": "cpp",
|
|
||||||
"compare": "cpp",
|
|
||||||
"concepts": "cpp",
|
|
||||||
"csignal": "cpp",
|
|
||||||
"cstddef": "cpp",
|
|
||||||
"cstdint": "cpp",
|
|
||||||
"cstdio": "cpp",
|
|
||||||
"cstdlib": "cpp",
|
|
||||||
"cstring": "cpp",
|
|
||||||
"ctime": "cpp",
|
|
||||||
"cwchar": "cpp",
|
|
||||||
"exception": "cpp",
|
|
||||||
"functional": "cpp",
|
|
||||||
"initializer_list": "cpp",
|
|
||||||
"ios": "cpp",
|
|
||||||
"iosfwd": "cpp",
|
|
||||||
"iostream": "cpp",
|
|
||||||
"istream": "cpp",
|
|
||||||
"iterator": "cpp",
|
|
||||||
"limits": "cpp",
|
|
||||||
"list": "cpp",
|
|
||||||
"memory": "cpp",
|
|
||||||
"new": "cpp",
|
|
||||||
"optional": "cpp",
|
|
||||||
"ostream": "cpp",
|
|
||||||
"ratio": "cpp",
|
|
||||||
"set": "cpp",
|
|
||||||
"stdexcept": "cpp",
|
|
||||||
"stop_token": "cpp",
|
|
||||||
"streambuf": "cpp",
|
|
||||||
"string": "cpp",
|
|
||||||
"system_error": "cpp",
|
|
||||||
"thread": "cpp",
|
|
||||||
"tuple": "cpp",
|
|
||||||
"type_traits": "cpp",
|
|
||||||
"typeinfo": "cpp",
|
|
||||||
"unordered_map": "cpp",
|
|
||||||
"utility": "cpp",
|
|
||||||
"vector": "cpp",
|
|
||||||
"xfacet": "cpp",
|
|
||||||
"xhash": "cpp",
|
|
||||||
"xiosbase": "cpp",
|
|
||||||
"xlocale": "cpp",
|
|
||||||
"xlocinfo": "cpp",
|
|
||||||
"xlocnum": "cpp",
|
|
||||||
"xmemory": "cpp",
|
|
||||||
"xstddef": "cpp",
|
|
||||||
"xstring": "cpp",
|
|
||||||
"xtr1common": "cpp",
|
|
||||||
"xtree": "cpp",
|
|
||||||
"xutility": "cpp"
|
|
||||||
},
|
},
|
||||||
"[python]": {
|
"[python]": {
|
||||||
"editor.defaultFormatter": "ms-python.black-formatter"
|
"editor.defaultFormatter": "ms-python.black-formatter"
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
<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.2. with the easiest code pattern!**<br><br>
|
||||||
<br />
|
<br />
|
||||||
# [Quick start :rocket: (click here)](https://github.com/vaporvee/discord-sdk-godot/wiki)
|
### [My Discord Server](https://discord.gg/EBdaTefpWy)
|
||||||
|
# [Quick start :rocket: (click here)](https://vaporvee.com/docs/discord-sdk-godot#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!**
|
||||||
@@ -12,9 +14,10 @@
|
|||||||
- Invites
|
- Invites
|
||||||
- Steam and launch command registering
|
- Steam and launch command registering
|
||||||
- User information
|
- User information
|
||||||
|
- Relationship Manager (Get friendlist and its updates)
|
||||||
- Overlay management
|
- Overlay management
|
||||||
- Editor Presence (optional)
|
- Editor Presence (optional)
|
||||||
<img width="400px" src="https://camo.githubusercontent.com/e4ae18ce30a7731145376e1a85c384e9ea207420c09365e3fcdd455ef332ba98/68747470733a2f2f6769746875622d70726f64756374696f6e2d757365722d61737365742d3632313064662e73332e616d617a6f6e6177732e636f6d2f38303632313836332f3233383739343331392d35373164653262612d346635652d343062612d613263662d3839666365643963306366302e706e67">
|
<img width="600px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/GodotEditorPresenceBanner.png">
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
23
SConstruct
@@ -1,13 +1,11 @@
|
|||||||
#!python
|
#!python
|
||||||
import os
|
import os
|
||||||
|
|
||||||
# Gets the standard flags CC, CCX, etc.
|
|
||||||
env = SConscript("src/lib/godot-cpp/SConstruct")
|
env = SConscript("src/lib/godot-cpp/SConstruct")
|
||||||
|
|
||||||
# Check our platform specifics
|
|
||||||
if env["platform"] == "macos":
|
if env["platform"] == "macos":
|
||||||
discord_library = "libdiscord_game_sdk.dylib"
|
discord_library = "libdiscord_game_sdk.dylib"
|
||||||
discord_library_second = "libdiscord_game_sdk_aarch64.dylib"
|
discord_library_second = ""
|
||||||
libexportfolder = "/macos/"
|
libexportfolder = "/macos/"
|
||||||
|
|
||||||
elif env["platform"] in ("linuxbsd", "linux"):
|
elif env["platform"] in ("linuxbsd", "linux"):
|
||||||
@@ -25,21 +23,26 @@ if env["target"] == "template_debug":
|
|||||||
else:
|
else:
|
||||||
debugsuffix = ""
|
debugsuffix = ""
|
||||||
|
|
||||||
# make sure our binding library is properly includes
|
if env.get("arch") == "arm64":
|
||||||
|
armsuffix = "_arm64"
|
||||||
|
else:
|
||||||
|
armsuffix = ""
|
||||||
|
|
||||||
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
env.Append(LIBPATH=["src/lib/discord_game_sdk/bin/"])
|
||||||
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
sources = Glob("src/lib/discord_game_sdk/cpp/*.cpp")
|
||||||
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"]) # this line for some reason doesn't get understanded by most linux distros
|
env.Append(CPPPATH=["src/lib/discord_game_sdk/cpp/"])
|
||||||
env.Append(LIBS=["discord_game_sdk"])
|
env.Append(LIBS=["discord_game_sdk"])
|
||||||
|
|
||||||
# tweak this if you want to use different folders, or more folders, to store your source code in.
|
|
||||||
env.Append(CPPPATH=["src/"])
|
env.Append(CPPPATH=["src/"])
|
||||||
sources += Glob("src/*.cpp")
|
sources += Glob("src/*.cpp")
|
||||||
|
|
||||||
# The finished exports
|
env.Append(CPPDEFINES=["HOT_RELOAD_ENABLED"])
|
||||||
|
|
||||||
library = env.SharedLibrary(
|
library = env.SharedLibrary(
|
||||||
target="project/addons/discord-sdk-gd/bin/"
|
target="project/addons/discord-sdk-gd/bin/"
|
||||||
+ libexportfolder
|
+ libexportfolder
|
||||||
+ "discord_game_sdk_binding"
|
+ "discord_game_sdk_binding"
|
||||||
|
+ armsuffix
|
||||||
+ debugsuffix,
|
+ debugsuffix,
|
||||||
source=sources,
|
source=sources,
|
||||||
)
|
)
|
||||||
@@ -51,11 +54,13 @@ env.Depends(
|
|||||||
Copy("$TARGET", "$SOURCE"),
|
Copy("$TARGET", "$SOURCE"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
if(discord_library_second != ""):
|
if discord_library_second != "":
|
||||||
env.Depends(
|
env.Depends(
|
||||||
library,
|
library,
|
||||||
Command(
|
Command(
|
||||||
"project/addons/discord-sdk-gd/bin/" + libexportfolder + discord_library_second,
|
"project/addons/discord-sdk-gd/bin/"
|
||||||
|
+ libexportfolder
|
||||||
|
+ discord_library_second,
|
||||||
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
"src/lib/discord_game_sdk/bin/" + discord_library_second,
|
||||||
Copy("$TARGET", "$SOURCE"),
|
Copy("$TARGET", "$SOURCE"),
|
||||||
),
|
),
|
||||||
|
28
build.py
@@ -1,23 +1,35 @@
|
|||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
yes = {'yes', 'y', 'ye', ''}
|
yes = {"yes", "y", "ye", ""}
|
||||||
no = {'no', 'n'}
|
no = {"no", "n"}
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
choice = sys.argv[1].removeprefix("-")
|
choice = sys.argv[1].removeprefix("-")
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(
|
sys.stdout.write(
|
||||||
"Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): ")
|
"Do you want to open only the built project instead of the Godot Editor after building? ([y]es/[n]o): "
|
||||||
|
)
|
||||||
choice = input().lower()
|
choice = input().lower()
|
||||||
if choice in yes:
|
if choice in yes:
|
||||||
os.system("python -m SCons && python -m SCons target=template_release && cd project && godot")
|
os.system(
|
||||||
|
"python -m SCons && python -m SCons target=template_release && cd project && godot"
|
||||||
|
)
|
||||||
elif choice in no:
|
elif choice in no:
|
||||||
if os.name == 'nt':
|
system = platform.system()
|
||||||
|
print("Building for: '%s'" % (system))
|
||||||
|
if system == "Windows": # Windows
|
||||||
os.system(
|
os.system(
|
||||||
"python -m SCons && python -m SCons target=template_release && godot project\project.godot")
|
"python -m SCons && python -m SCons target=template_release && godot project/project.godot"
|
||||||
else:
|
)
|
||||||
|
elif system == "Darwin": # macOS
|
||||||
os.system(
|
os.system(
|
||||||
"python -m SCons && python -m SCons target=template_release && godot project/project.godot")
|
"python -m SCons target=template_release arch=x86_64 && python -m SCons target=template_debug arch=x86_64 && python -m SCons target=template_release arch=arm64 && python -m SCons target=template_debug arch=arm64 && godot project/project.godot"
|
||||||
|
)
|
||||||
|
else: # Linux
|
||||||
|
os.system(
|
||||||
|
"python -m SCons && python -m SCons target=template_release && godot project/project.godot"
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
sys.stdout.write("Please respond with 'yes' or 'no'")
|
sys.stdout.write("Please respond with 'yes' or 'no'")
|
||||||
|
BIN
project/Node
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://ufh1hha1ehui"
|
uid="uid://ufh1hha1ehui"
|
||||||
path="res://.godot/imported/Debug.svg-c87ff9d4b4b0e718ec457560f6c420dc.ctex"
|
path="res://.godot/imported/Debug.svg-97b25f5d09dbf04212867cd1a46cf368.ctex"
|
||||||
metadata={
|
metadata={
|
||||||
"vram_texture": false
|
"vram_texture": false
|
||||||
}
|
}
|
||||||
|
|
||||||
[deps]
|
[deps]
|
||||||
|
|
||||||
source_file="res://addons/discord-sdk-gd/nodes/assets/Debug.svg"
|
source_file="res://addons/discord-sdk-gd/Debug.svg"
|
||||||
dest_files=["res://.godot/imported/Debug.svg-c87ff9d4b4b0e718ec457560f6c420dc.ctex"]
|
dest_files=["res://.godot/imported/Debug.svg-97b25f5d09dbf04212867cd1a46cf368.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
34
project/addons/discord-sdk-gd/Logo_V2_No_Bg.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://csl0e2px0cwc1"
|
||||||
|
path="res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png"
|
||||||
|
dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-9c8178062d6891c8370df63a912bd8e2.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
|
7
project/addons/discord-sdk-gd/READ_ME_PLEASE.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
MINIMUM GODOT VERSION: 4.2
|
||||||
|
|
||||||
|
PLEASE ACTIVATE THE PLUGIN UNDER Project -> Project Settings... -> Plugins -> DiscordSDK -> Status
|
||||||
|
IGNORE THE RED ERRORS ON THE FIRST 2 RESTARTS
|
||||||
|
READ THE TUTORIAL LINKED IN THE WINDOW THAT WILL OPEN ON PLUGIN ENABLE
|
||||||
|
|
||||||
|
If nothing works, enable the plugin and delete /addons/discord-sdk-gd/bin/.gdignore
|
@@ -18,8 +18,7 @@ linux.release.rv64 = "linux/libdiscord_game_sdk_binding.so"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
||||||
macos.debug = { "macos/libdiscord_game_sdk.dylib": "" }
|
macos = { "macos/libdiscord_game_sdk.dylib": "" }
|
||||||
macos.release = { "macos/libdiscord_game_sdk.dylib": "" }
|
|
||||||
windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" }
|
windows.debug.x86_64 = { "windows/discord_game_sdk.dll": "" }
|
||||||
windows.release.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.debug.x86_64 = { "linux/libdiscord_game_sdk.so": "" }
|
||||||
|
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding.so
Executable file → Normal file
BIN
project/addons/discord-sdk-gd/bin/linux/libdiscord_game_sdk_binding_debug.so
Executable file → Normal file
@@ -11,27 +11,27 @@ extends Node
|
|||||||
## [codeblock]
|
## [codeblock]
|
||||||
## func _ready():
|
## func _ready():
|
||||||
## # Application ID
|
## # Application ID
|
||||||
## discord_sdk.app_id = 1099618430065324082
|
## DiscordSDK.app_id = 1099618430065324082
|
||||||
## # this is boolean if everything worked
|
## # this is boolean if everything worked
|
||||||
## print("Discord working: " + str(discord_sdk.get_is_discord_working()))
|
## print("Discord working: " + str(DiscordSDK.get_is_discord_working()))
|
||||||
## # Set the first custom text row of the activity here
|
## # Set the first custom text row of the activity here
|
||||||
## discord_sdk.details = "A demo activity by vaporvee#1231"
|
## DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||||
## # Set the second custom text row of the activity here
|
## # Set the second custom text row of the activity here
|
||||||
## discord_sdk.state = "Checkpoint 23/23"
|
## DiscordSDK.state = "Checkpoint 23/23"
|
||||||
## # Image key for small image from "Art Assets" from the Discord Developer website
|
## # Image key for small image from "Art Assets" from the Discord Developer website
|
||||||
## discord_sdk.large_image = "game"
|
## DiscordSDK.large_image = "game"
|
||||||
## # Tooltip text for the large image
|
## # Tooltip text for the large image
|
||||||
## discord_sdk.large_image_text = "Try it now!"
|
## DiscordSDK.large_image_text = "Try it now!"
|
||||||
## # Image key for large image from "Art Assets" from the Discord Developer website
|
## # Image key for large image from "Art Assets" from the Discord Developer website
|
||||||
## discord_sdk.small_image = "boss"
|
## DiscordSDK.small_image = "boss"
|
||||||
## # Tooltip text for the small image
|
## # Tooltip text for the small image
|
||||||
## discord_sdk.small_image_text = "Fighting the end boss! D:"
|
## DiscordSDK.small_image_text = "Fighting the end boss! D:"
|
||||||
## # "02:41 elapsed" timestamp for the activity
|
## # "02:41 elapsed" timestamp for the activity
|
||||||
## discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
## DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||||
## # "59:59 remaining" timestamp for the activity
|
## # "59:59 remaining" timestamp for the activity
|
||||||
## discord_sdk.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
|
## DiscordSDK.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
|
||||||
## # Always refresh after changing the values!
|
## # Always refresh after changing the values!
|
||||||
## discord_sdk.refresh()
|
## DiscordSDK.refresh()
|
||||||
## [/codeblock]
|
## [/codeblock]
|
||||||
##
|
##
|
||||||
## @tutorial(More information here): https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start
|
## @tutorial(More information here): https://github.com/vaporvee/discord-sdk-godot/wiki/Quick-start
|
||||||
|
BIN
project/addons/discord-sdk-gd/logo.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
@@ -3,15 +3,15 @@
|
|||||||
importer="texture"
|
importer="texture"
|
||||||
type="CompressedTexture2D"
|
type="CompressedTexture2D"
|
||||||
uid="uid://csl0e2px0cwc1"
|
uid="uid://csl0e2px0cwc1"
|
||||||
path="res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex"
|
path="res://.godot/imported/logo.png-b59b4861dc0c64616d78af30082b08b5.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/logo.png"
|
||||||
dest_files=["res://.godot/imported/Logo_V2_No_Bg.png-e3342efea6196122a36ea06a342b2ba2.ctex"]
|
dest_files=["res://.godot/imported/logo.png-b59b4861dc0c64616d78af30082b08b5.ctex"]
|
||||||
|
|
||||||
[params]
|
[params]
|
||||||
|
|
@@ -9,10 +9,10 @@ resource_name = "Debug"
|
|||||||
script/source = "extends Node
|
script/source = "extends Node
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
discord_sdk.connect(\"activity_join_request\",_on_activity_join_request)
|
DiscordSDK.connect(\"activity_join_request\",_on_activity_join_request)
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
if(discord_sdk.get_is_discord_working()):
|
if(DiscordSDK.get_is_discord_working()):
|
||||||
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
|
$Panel/TextureRect.self_modulate = Color(\"#3eff8d\")
|
||||||
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
|
$Panel/TextureRect/AnimationPlayer.play(\"pulsate\")
|
||||||
debug_text_update()
|
debug_text_update()
|
||||||
@@ -20,6 +20,7 @@ func _process(_delta):
|
|||||||
$Panel/TextureRect.self_modulate = Color(\"#797979\")
|
$Panel/TextureRect.self_modulate = Color(\"#797979\")
|
||||||
$Panel/TextureRect/AnimationPlayer.stop()
|
$Panel/TextureRect/AnimationPlayer.stop()
|
||||||
debug_text_update()
|
debug_text_update()
|
||||||
|
|
||||||
|
|
||||||
func debug_text_update():
|
func debug_text_update():
|
||||||
$Panel/Info.text = \"Application ID : {id}
|
$Panel/Info.text = \"Application ID : {id}
|
||||||
@@ -44,7 +45,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))
|
$Panel/Info.text = $Panel/Info.text.replace(\"{ppublic}\",str(DiscordSDK.is_public_party)).replace(\"{instanced}\",str(DiscordSDK.instanced)).replace(\"{ssecret}\",DiscordSDK.spectate_secret).replace(\"{jsecret}\",DiscordSDK.join_secret).replace(\"{msecret}\",DiscordSDK.match_secret).replace(\"{mpartysize}\",str(DiscordSDK.max_party_size)).replace(\"{cpartysize}\",str(DiscordSDK.current_party_size)).replace(\"{partyid}\",DiscordSDK.party_id).replace(\"{id}\",str(DiscordSDK.app_id)).replace(\"{details}\",DiscordSDK.details).replace(\"{state}\",DiscordSDK.state).replace(\"{lkey}\",DiscordSDK.large_image).replace(\"{ltext}\",DiscordSDK.large_image_text).replace(\"{skey}\",DiscordSDK.small_image).replace(\"{stext}\",DiscordSDK.small_image_text).replace(\"{stimestamp}\",str(DiscordSDK.start_timestamp)).replace(\"{etimestamp}\",str(DiscordSDK.end_timestamp))
|
||||||
|
|
||||||
var user_request = {};
|
var user_request = {};
|
||||||
|
|
||||||
@@ -54,25 +55,25 @@ func _on_activity_join_request(user_requesting):
|
|||||||
|
|
||||||
func _on_accept_join_request_pressed():
|
func _on_accept_join_request_pressed():
|
||||||
if(!user_request.is_empty()):
|
if(!user_request.is_empty()):
|
||||||
discord_sdk.accept_join_request(user_request.id)
|
DiscordSDK.accept_join_request(user_request.id)
|
||||||
|
|
||||||
func _on_invite_with_user_id_text_submitted(new_text):
|
func _on_invite_with_user_id_text_submitted(new_text):
|
||||||
discord_sdk.send_invite(int(new_text),true,\"this is a test invite sent from godot\")
|
DiscordSDK.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_accept_with_user_id_text_submitted(new_text):
|
||||||
discord_sdk.accept_invite(int(new_text))
|
DiscordSDK.accept_invite(int(new_text))
|
||||||
|
|
||||||
func _on_print_current_user_on_console_pressed():
|
func _on_print_current_user_on_console_pressed():
|
||||||
print(discord_sdk.get_current_user())
|
print(DiscordSDK.get_current_user())
|
||||||
|
|
||||||
func _on_toggle_sdk_toggled(button_pressed):
|
func _on_toggle_sdk_toggled(button_pressed):
|
||||||
if(button_pressed):
|
if(button_pressed):
|
||||||
discord_sdk.unclear()
|
DiscordSDK.unclear()
|
||||||
else:
|
else:
|
||||||
discord_sdk.clear()
|
DiscordSDK.clear(false)
|
||||||
|
|
||||||
func _on_print_friends_pressed():
|
func _on_print_friends_pressed():
|
||||||
print(discord_sdk.get_all_relationships())
|
print(DiscordSDK.get_all_relationships())
|
||||||
"
|
"
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8abo6"]
|
||||||
|
@@ -1,23 +0,0 @@
|
|||||||
## [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
|
|
||||||
@tool
|
|
||||||
class_name core_updater
|
|
||||||
extends Node
|
|
||||||
|
|
||||||
func _process(_delta):
|
|
||||||
if(ProjectSettings.get_setting("DiscordSDK/EditorPresence/enabled") && Engine.is_editor_hint()):
|
|
||||||
if(discord_sdk.app_id != 1108142249990176808):
|
|
||||||
discord_sdk.app_id = 1108142249990176808
|
|
||||||
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().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()
|
|
13
project/addons/discord-sdk-gd/nodes/discord_autoload.gd
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
## 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. 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
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(_delta) -> void:
|
||||||
|
DiscordSDK.run_callbacks()
|
@@ -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="1.2.0"
|
||||||
script="plugin.gd"
|
script="plugin.gd"
|
||||||
|
@@ -2,35 +2,55 @@
|
|||||||
extends EditorPlugin
|
extends EditorPlugin
|
||||||
|
|
||||||
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/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()
|
var restart_window: ConfirmationDialog = preload("res://addons/discord-sdk-gd/restart_window.tscn").instantiate()
|
||||||
|
var plugin_cfg: ConfigFile = ConfigFile.new()
|
||||||
|
const plugin_data_filename = "/plugin_data.cfg"
|
||||||
|
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
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")
|
get_editor_interface().get_editor_settings().settings_changed.connect(_on_editor_settings_changed)
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
await get_tree().create_timer(0.5).timeout
|
||||||
|
plugin_cfg.load(get_editor_interface().get_editor_paths().get_data_dir() + plugin_data_filename)
|
||||||
|
if !get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
get_editor_interface().get_editor_settings().set_setting("DiscordSDK/EditorPresence/enabled",plugin_cfg.get_value("Discord","editor_presence",false))
|
||||||
|
|
||||||
|
func _exit_tree():
|
||||||
|
if get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
get_editor_interface().get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
|
||||||
|
|
||||||
func _enable_plugin() -> void:
|
func _enable_plugin() -> void:
|
||||||
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
|
if FileAccess.file_exists(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore"):
|
||||||
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
|
DirAccess.remove_absolute(ProjectSettings.globalize_path("res://") + "addons/discord-sdk-gd/bin/.gdignore")
|
||||||
ProjectSettings.set_setting("DiscordSDK/EditorPresence/enabled",false)
|
add_autoload_singleton("DiscordSDKLoader","res://addons/discord-sdk-gd/nodes/discord_autoload.gd")
|
||||||
ProjectSettings.set_as_basic("DiscordSDK/EditorPresence/enabled",true)
|
restart_window.connect("confirmed", save_no_restart)
|
||||||
ProjectSettings.set_initial_value("DiscordSDK/EditorPresence/enabled",false)
|
restart_window.connect("canceled", save_and_restart)
|
||||||
ProjectSettings.set_restart_if_changed("DiscordSDK/EditorPresence/enabled",true)
|
get_editor_interface().popup_dialog_centered(restart_window)
|
||||||
get_tree().root.add_child(restart_window)
|
print("IGNORE RED ERROR MESSAGES BEFORE THE SECOND RESTART!")
|
||||||
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)
|
|
||||||
push_warning("DiscordSDK Addon got disabled. PLEASE RESTART THE EDITOR!")
|
|
||||||
remove_autoload_singleton("DiscordSDKLoader")
|
remove_autoload_singleton("DiscordSDKLoader")
|
||||||
|
FileAccess.open("res://addons/discord-sdk-gd/bin/.gdignore",FileAccess.WRITE)
|
||||||
remove_custom_type("DiscordSDKDebug")
|
remove_custom_type("DiscordSDKDebug")
|
||||||
ProjectSettings.clear("DiscordSDK/EditorPresence/enabled")
|
get_editor_interface().get_editor_settings().erase("DiscordSDK/EditorPresence/enabled")
|
||||||
|
push_warning("Please restart the editor to fully disable the DiscordSDK plugin")
|
||||||
|
|
||||||
func save_restart() -> void:
|
func save_and_restart() -> void:
|
||||||
get_editor_interface().restart_editor(true)
|
get_editor_interface().restart_editor(true)
|
||||||
|
|
||||||
func restart() -> void:
|
func save_no_restart() -> void:
|
||||||
get_editor_interface().restart_editor(false)
|
get_editor_interface().restart_editor(false)
|
||||||
|
|
||||||
|
var editor_presence: Node
|
||||||
|
func _on_editor_settings_changed() -> void:
|
||||||
|
plugin_cfg.set_value("Discord","editor_presence",get_editor_interface().get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"))
|
||||||
|
plugin_cfg.save(get_editor_interface().get_editor_paths().get_data_dir() + plugin_data_filename)
|
||||||
|
if ClassDB.class_exists("EditorPresence") && editor_presence == null:
|
||||||
|
editor_presence = ClassDB.instantiate("EditorPresence")
|
||||||
|
if get_editor_interface().get_editor_settings().has_setting("DiscordSDK/EditorPresence/enabled") && get_editor_interface().get_editor_settings().get_setting("DiscordSDK/EditorPresence/enabled"):
|
||||||
|
add_child(editor_presence)
|
||||||
|
else:
|
||||||
|
editor_presence.queue_free()
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://byc4c6d5tpomq"]
|
[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"]
|
[ext_resource type="Texture2D" uid="uid://csl0e2px0cwc1" path="res://addons/discord-sdk-gd/Logo_V2_No_Bg.png" id="1_0svbg"]
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1t7mm"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1t7mm"]
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ Button/styles/focus = SubResource("StyleBoxEmpty_1t7mm")
|
|||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5vqdt"]
|
||||||
|
|
||||||
[sub_resource type="Image" id="Image_ylyvr"]
|
[sub_resource type="Image" id="Image_v4whe"]
|
||||||
data = {
|
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),
|
"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",
|
"format": "RGBA8",
|
||||||
@@ -19,32 +19,42 @@ data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
[sub_resource type="ImageTexture" id="ImageTexture_gdtpn"]
|
||||||
image = SubResource("Image_ylyvr")
|
image = SubResource("Image_v4whe")
|
||||||
|
|
||||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7v0rg"]
|
||||||
|
|
||||||
[node name="RestartWindow" type="ConfirmationDialog"]
|
[node name="RestartWindow" type="ConfirmationDialog"]
|
||||||
title = "Restart required"
|
title = "Restart required"
|
||||||
initial_position = 2
|
initial_position = 2
|
||||||
size = Vector2i(416, 400)
|
size = Vector2i(430, 500)
|
||||||
visible = true
|
visible = true
|
||||||
|
transient = false
|
||||||
unresizable = true
|
unresizable = true
|
||||||
theme = SubResource("Theme_swwco")
|
theme = SubResource("Theme_swwco")
|
||||||
ok_button_text = "Restart"
|
ok_button_text = "Restart"
|
||||||
cancel_button_text = "Save and restart"
|
cancel_button_text = "Save and restart"
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="."]
|
[node name="Panel" type="Panel" parent="."]
|
||||||
offset_left = 8.0
|
anchors_preset = 5
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -207.0
|
||||||
offset_top = 8.0
|
offset_top = 8.0
|
||||||
offset_right = 408.0
|
offset_right = 207.0
|
||||||
offset_bottom = 351.0
|
offset_bottom = 451.0
|
||||||
|
grow_horizontal = 2
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||||
custom_minimum_size = Vector2(400, 0)
|
custom_minimum_size = Vector2(400, 0)
|
||||||
layout_mode = 0
|
layout_mode = 1
|
||||||
offset_right = 400.0
|
anchors_preset = 5
|
||||||
offset_bottom = 309.0
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
offset_left = -200.0
|
||||||
|
offset_right = 200.0
|
||||||
|
offset_bottom = 389.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer"]
|
[node name="HSeparator" type="HSeparator" parent="Panel/VBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -56,6 +66,7 @@ theme_override_styles/separator = SubResource("StyleBoxEmpty_5vqdt")
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 4
|
size_flags_vertical = 4
|
||||||
|
theme_override_constants/separation = 10
|
||||||
|
|
||||||
[node name="DocsIcon" type="TextureRect" parent="Panel/VBoxContainer/HBoxContainer"]
|
[node name="DocsIcon" type="TextureRect" parent="Panel/VBoxContainer/HBoxContainer"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -68,23 +79,26 @@ stretch_mode = 2
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 8
|
size_flags_vertical = 8
|
||||||
text = "Plugin Docs"
|
mouse_default_cursor_shape = 16
|
||||||
uri = "https://github.com/vaporvee/discord-sdk-godot/wiki"
|
theme_override_font_sizes/font_size = 20
|
||||||
|
text = "HOW TO USE"
|
||||||
|
uri = "https://vaporvee.com/docs/discord-sdk-godot#quick-start"
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"]
|
[node name="TextureRect" type="TextureRect" parent="Panel/VBoxContainer"]
|
||||||
custom_minimum_size = Vector2(128, 128)
|
custom_minimum_size = Vector2(128, 128)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
texture = ExtResource("1_r3i13")
|
texture = ExtResource("1_0svbg")
|
||||||
expand_mode = 1
|
expand_mode = 1
|
||||||
|
|
||||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
||||||
custom_minimum_size = Vector2(400, 200)
|
custom_minimum_size = Vector2(400, 250)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
|
theme_override_font_sizes/normal_font_size = 16
|
||||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
|
theme_override_styles/normal = SubResource("StyleBoxEmpty_7v0rg")
|
||||||
bbcode_enabled = true
|
bbcode_enabled = true
|
||||||
text = "[center]Thanks for enabling the
|
text = "[center]Thanks for enabling the
|
||||||
@@ -93,4 +107,6 @@ made by vaporvee. ❤️
|
|||||||
|
|
||||||
|
|
||||||
You need to [wave]restart[/wave] the editor to fully enable this plugin!
|
You need to [wave]restart[/wave] the editor to fully enable this plugin!
|
||||||
Do you want to [wave]save[/wave] your project before restarting?"
|
Do you want to [wave]save[/wave] your project before restarting?
|
||||||
|
|
||||||
|
Error messages after the first two restarts are normal. Please ignore them!"
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 209 KiB After Width: | Height: | Size: 444 KiB |
BIN
project/assets/GodotEditorPresenceBanner.png
Normal file
After Width: | Height: | Size: 367 KiB |
34
project/assets/GodotEditorPresenceBanner.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dp4u0g6gvyt0a"
|
||||||
|
path="res://.godot/imported/GodotEditorPresenceBanner.png-5d1b012e64655706e9686e0163b65d30.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/GodotEditorPresenceBanner.png"
|
||||||
|
dest_files=["res://.godot/imported/GodotEditorPresenceBanner.png-5d1b012e64655706e9686e0163b65d30.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
|
184
project/assets/GodotEditorPresenceBanner.svg
Normal file
After Width: | Height: | Size: 350 KiB |
37
project/assets/GodotEditorPresenceBanner.svg.import
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://08bj2tfacvhm"
|
||||||
|
path="res://.godot/imported/GodotEditorPresenceBanner.svg-e0420faa20460520008caa2101993296.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/GodotEditorPresenceBanner.svg"
|
||||||
|
dest_files=["res://.godot/imported/GodotEditorPresenceBanner.svg-e0420faa20460520008caa2101993296.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
|
||||||
|
svg/scale=1.0
|
||||||
|
editor/scale_with_editor_scale=false
|
||||||
|
editor/convert_colors_with_editor_theme=false
|
@@ -8,7 +8,7 @@ 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="export/windows/discord-sdk-godot-demo.exe"
|
||||||
encryption_include_filters=""
|
encryption_include_filters=""
|
||||||
encryption_exclude_filters=""
|
encryption_exclude_filters=""
|
||||||
encrypt_pck=false
|
encrypt_pck=false
|
||||||
@@ -42,6 +42,7 @@ application/product_name=""
|
|||||||
application/file_description="Discord SDK Godot Test"
|
application/file_description="Discord SDK Godot Test"
|
||||||
application/copyright=""
|
application/copyright=""
|
||||||
application/trademarks=""
|
application/trademarks=""
|
||||||
|
application/export_angle=0
|
||||||
ssh_remote_deploy/enabled=false
|
ssh_remote_deploy/enabled=false
|
||||||
ssh_remote_deploy/host="user@host_ip"
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
ssh_remote_deploy/port="22"
|
ssh_remote_deploy/port="22"
|
||||||
@@ -59,3 +60,148 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
|
|||||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Linux/X11"
|
||||||
|
platform="Linux/X11"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="export/linux/discord-sdk-godot-demo.x86_64"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
binary_format/embed_pck=true
|
||||||
|
texture_format/bptc=true
|
||||||
|
texture_format/s3tc=true
|
||||||
|
texture_format/etc=false
|
||||||
|
texture_format/etc2=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||||
|
export DISPLAY=:0
|
||||||
|
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
|
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||||
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
|
rm -rf \"{temp_dir}\""
|
||||||
|
|
||||||
|
[preset.2]
|
||||||
|
|
||||||
|
name="macOS"
|
||||||
|
platform="macOS"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="export/macos/discord-sdk-godot-demo.zip"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.2.options]
|
||||||
|
|
||||||
|
export/distribution_type=0
|
||||||
|
binary_format/architecture="universal"
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
application/icon=""
|
||||||
|
application/icon_interpolation=4
|
||||||
|
application/bundle_identifier="com.vaporvee.discord-sdk-godot-demo"
|
||||||
|
application/signature=""
|
||||||
|
application/app_category="Games"
|
||||||
|
application/short_version=""
|
||||||
|
application/version=""
|
||||||
|
application/copyright=""
|
||||||
|
application/copyright_localized={}
|
||||||
|
application/min_macos_version="10.12"
|
||||||
|
application/export_angle=0
|
||||||
|
display/high_res=true
|
||||||
|
xcode/platform_build="14C18"
|
||||||
|
xcode/sdk_version="13.1"
|
||||||
|
xcode/sdk_build="22C55"
|
||||||
|
xcode/sdk_name="macosx13.1"
|
||||||
|
xcode/xcode_version="1420"
|
||||||
|
xcode/xcode_build="14C18"
|
||||||
|
codesign/codesign=1
|
||||||
|
codesign/installer_identity=""
|
||||||
|
codesign/apple_team_id=""
|
||||||
|
codesign/identity=""
|
||||||
|
codesign/entitlements/custom_file=""
|
||||||
|
codesign/entitlements/allow_jit_code_execution=false
|
||||||
|
codesign/entitlements/allow_unsigned_executable_memory=false
|
||||||
|
codesign/entitlements/allow_dyld_environment_variables=false
|
||||||
|
codesign/entitlements/disable_library_validation=false
|
||||||
|
codesign/entitlements/audio_input=false
|
||||||
|
codesign/entitlements/camera=false
|
||||||
|
codesign/entitlements/location=false
|
||||||
|
codesign/entitlements/address_book=false
|
||||||
|
codesign/entitlements/calendars=false
|
||||||
|
codesign/entitlements/photos_library=false
|
||||||
|
codesign/entitlements/apple_events=false
|
||||||
|
codesign/entitlements/debugging=false
|
||||||
|
codesign/entitlements/app_sandbox/enabled=false
|
||||||
|
codesign/entitlements/app_sandbox/network_server=false
|
||||||
|
codesign/entitlements/app_sandbox/network_client=false
|
||||||
|
codesign/entitlements/app_sandbox/device_usb=false
|
||||||
|
codesign/entitlements/app_sandbox/device_bluetooth=false
|
||||||
|
codesign/entitlements/app_sandbox/files_downloads=0
|
||||||
|
codesign/entitlements/app_sandbox/files_pictures=0
|
||||||
|
codesign/entitlements/app_sandbox/files_music=0
|
||||||
|
codesign/entitlements/app_sandbox/files_movies=0
|
||||||
|
codesign/entitlements/app_sandbox/files_user_selected=0
|
||||||
|
codesign/entitlements/app_sandbox/helper_executables=[]
|
||||||
|
codesign/custom_options=PackedStringArray()
|
||||||
|
notarization/notarization=0
|
||||||
|
privacy/microphone_usage_description=""
|
||||||
|
privacy/microphone_usage_description_localized={}
|
||||||
|
privacy/camera_usage_description=""
|
||||||
|
privacy/camera_usage_description_localized={}
|
||||||
|
privacy/location_usage_description=""
|
||||||
|
privacy/location_usage_description_localized={}
|
||||||
|
privacy/address_book_usage_description=""
|
||||||
|
privacy/address_book_usage_description_localized={}
|
||||||
|
privacy/calendar_usage_description=""
|
||||||
|
privacy/calendar_usage_description_localized={}
|
||||||
|
privacy/photos_library_usage_description=""
|
||||||
|
privacy/photos_library_usage_description_localized={}
|
||||||
|
privacy/desktop_folder_usage_description=""
|
||||||
|
privacy/desktop_folder_usage_description_localized={}
|
||||||
|
privacy/documents_folder_usage_description=""
|
||||||
|
privacy/documents_folder_usage_description_localized={}
|
||||||
|
privacy/downloads_folder_usage_description=""
|
||||||
|
privacy/downloads_folder_usage_description_localized={}
|
||||||
|
privacy/network_volumes_usage_description=""
|
||||||
|
privacy/network_volumes_usage_description_localized={}
|
||||||
|
privacy/removable_volumes_usage_description=""
|
||||||
|
privacy/removable_volumes_usage_description_localized={}
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||||
|
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
|
open \"{temp_dir}/{exe_name}.app\" --args {cmd_args}"
|
||||||
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name}.app/Contents/MacOS/{exe_name} {cmd_args}\")
|
||||||
|
rm -rf \"{temp_dir}\""
|
||||||
|
@@ -2,40 +2,40 @@ extends Node
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
set_activity()
|
set_activity()
|
||||||
discord_sdk.connect("activity_join_request",_on_activity_join_request)
|
DiscordSDK.connect("activity_join_request",_on_activity_join_request)
|
||||||
discord_sdk.connect("activity_join",_on_activity_join)
|
DiscordSDK.connect("activity_join",_on_activity_join)
|
||||||
discord_sdk.connect("activity_spectate",_on_activity_spectate)
|
DiscordSDK.connect("activity_spectate",_on_activity_spectate)
|
||||||
discord_sdk.connect("relationships_init",_on_relationship_init)
|
DiscordSDK.connect("relationships_init",_on_relationship_init)
|
||||||
discord_sdk.connect("updated_relationship", _on_updated_relationship)
|
DiscordSDK.connect("updated_relationship", _on_updated_relationship)
|
||||||
|
|
||||||
func set_activity() -> void:
|
func set_activity() -> void:
|
||||||
discord_sdk.clear()
|
DiscordSDK.clear(false)
|
||||||
discord_sdk.app_id = 1099618430065324082
|
DiscordSDK.app_id = 1099618430065324082
|
||||||
discord_sdk.details = "A demo activity by vaporvee#1231"
|
DiscordSDK.details = "A demo activity by vaporvee#1231"
|
||||||
discord_sdk.state = "Checkpoint 23/23"
|
DiscordSDK.state = "Checkpoint 23/23"
|
||||||
|
|
||||||
discord_sdk.large_image = "example_game"
|
DiscordSDK.large_image = "example_game"
|
||||||
discord_sdk.large_image_text = "Try it now!"
|
DiscordSDK.large_image_text = "Try it now!"
|
||||||
discord_sdk.small_image = "boss"
|
DiscordSDK.small_image = "boss"
|
||||||
discord_sdk.small_image_text = "Fighting the end boss! D:"
|
DiscordSDK.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
|
DiscordSDK.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 understands and
|
||||||
# returns the other variables like current_party_size, party_id etc. Most of the values must differ from the others.
|
# 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
|
DiscordSDK.party_id = "mylobbycanbeeverything_" + my_secret
|
||||||
discord_sdk.current_party_size = 1
|
DiscordSDK.current_party_size = 1
|
||||||
discord_sdk.max_party_size = 4
|
DiscordSDK.max_party_size = 4
|
||||||
discord_sdk.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
DiscordSDK.match_secret = "m_" + my_secret #better use seeds with 1 to 1 range instead of just chars
|
||||||
discord_sdk.join_secret = "j_" + my_secret
|
DiscordSDK.join_secret = "j_" + my_secret
|
||||||
discord_sdk.spectate_secret = "s_" + my_secret
|
DiscordSDK.spectate_secret = "s_" + my_secret
|
||||||
discord_sdk.is_public_party = true
|
DiscordSDK.is_public_party = true
|
||||||
discord_sdk.instanced = true #required for spectate
|
DiscordSDK.instanced = true #required for spectate
|
||||||
#discord_sdk.start_timestamp = int(Time.get_unix_time_from_system())
|
#DiscordSDK.start_timestamp = int(Time.get_unix_time_from_system())
|
||||||
discord_sdk.register_command("C:\\Users\\yanni\\Desktop\\demo\\discord_sdk.exe")
|
DiscordSDK.register_command("C:\\Users\\yanni\\Desktop\\demo\\DiscordSDK.exe")
|
||||||
#discord_sdk.register_steam(1389990)
|
#DiscordSDK.register_steam(1389990)
|
||||||
discord_sdk.refresh()
|
DiscordSDK.refresh()
|
||||||
|
|
||||||
var user_request: Dictionary;
|
var user_request: Dictionary;
|
||||||
|
|
||||||
@@ -44,13 +44,13 @@ func _on_activity_join_request(user_requesting) -> void:
|
|||||||
user_request = user_requesting
|
user_request = user_requesting
|
||||||
|
|
||||||
func _on_activity_join(secret) -> void:
|
func _on_activity_join(secret) -> void:
|
||||||
if(discord_sdk.join_secret != secret):
|
if(DiscordSDK.join_secret != secret):
|
||||||
discord_sdk.current_party_size = clamp(int(secret) + 1, 0, discord_sdk.max_party_size)
|
DiscordSDK.current_party_size = clamp(int(secret) + 1, 0, DiscordSDK.max_party_size)
|
||||||
discord_sdk.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
DiscordSDK.party_id = secret.replace("j_","mylobbycanbeeverything_")
|
||||||
discord_sdk.match_secret = secret.replace("j_","m_")
|
DiscordSDK.match_secret = secret.replace("j_","m_")
|
||||||
discord_sdk.join_secret = secret
|
DiscordSDK.join_secret = secret
|
||||||
discord_sdk.spectate_secret = secret.replace("j_","s_")
|
DiscordSDK.spectate_secret = secret.replace("j_","s_")
|
||||||
discord_sdk.refresh()
|
DiscordSDK.refresh()
|
||||||
|
|
||||||
func _on_activity_spectate(secret) -> void:
|
func _on_activity_spectate(secret) -> void:
|
||||||
print(secret)
|
print(secret)
|
||||||
|
@@ -13,12 +13,16 @@ config_version=5
|
|||||||
config/name="GDExtension DiscordSDK Test Project"
|
config/name="GDExtension DiscordSDK Test Project"
|
||||||
config/tags=PackedStringArray("vaporvee")
|
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.2")
|
||||||
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/discord_autoload.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/resizable=false
|
window/size/resizable=false
|
||||||
@@ -27,6 +31,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
|
||||||
|
32
release.py
@@ -1,15 +1,37 @@
|
|||||||
import os
|
import os
|
||||||
from distutils.dir_util import copy_tree
|
|
||||||
import shutil
|
import shutil
|
||||||
|
from distutils.dir_util import copy_tree
|
||||||
|
|
||||||
|
win_folder_path = "project/addons/discord-sdk-gd/bin/windows"
|
||||||
|
|
||||||
|
matching_files = [file for file in os.listdir(win_folder_path) if file.endswith(("TMP", "exp", "lib"))]
|
||||||
|
for file in matching_files:
|
||||||
|
file_path = os.path.join(win_folder_path, file)
|
||||||
|
os.remove(file_path)
|
||||||
|
|
||||||
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
|
if os.path.exists("release/ADDON-Discord-SDK-Godot/addons"):
|
||||||
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
|
shutil.rmtree("release/ADDON-Discord-SDK-Godot/addons", ignore_errors=True)
|
||||||
|
|
||||||
copy_tree("project/addons/", "release/temp/ADDON-Discord-SDK-Godot/addons")
|
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/")
|
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/")
|
shutil.rmtree("release/temp/")
|
||||||
|
# Export Demos
|
||||||
|
os.system("cd project && godot --headless --export-release \"Linux/X11\"")
|
||||||
|
os.system("cd project && godot --headless --export-release \"Windows Desktop\"")
|
||||||
|
os.system("cd project && godot --headless --export-release \"macOS\"")
|
||||||
|
|
||||||
|
temp_dir = "release/temp_export_dir"
|
||||||
|
os.makedirs(temp_dir, exist_ok=True)
|
||||||
|
|
||||||
|
for platform in ["windows", "linux", "macos"]:
|
||||||
|
shutil.copytree(f"project/export/{platform}", os.path.join(temp_dir, platform))
|
||||||
|
|
||||||
|
shutil.make_archive('release/Demo-Export', 'zip', temp_dir)
|
||||||
|
|
||||||
|
shutil.rmtree(temp_dir)
|
||||||
|
|
||||||
|
print("ADDON-Discord-SDK-Godot.zip and Demo-Export.zip have been created successfully.")
|
||||||
|
2
requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
setuptools
|
||||||
|
scons
|
27
setup.py
@@ -2,24 +2,21 @@ import zipfile
|
|||||||
from distutils.dir_util import copy_tree
|
from distutils.dir_util import copy_tree
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
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
|
# 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:
|
with open("src/lib/discord_game_sdk/cpp/types.h", "r+") as f:
|
||||||
s = f.read();
|
s = f.read()
|
||||||
f.seek(0);
|
f.seek(0)
|
||||||
f.write("#include <cstdint>\n" + s)
|
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",
|
||||||
"src/lib/discord_game_sdk/bin/aarch64/libdiscord_game_sdk_aarch64.dylib",
|
"src/lib/discord_game_sdk/bin/aarch64/discord_game_sdk_aarch64.dylib",
|
||||||
)
|
|
||||||
os.rename(
|
|
||||||
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.dylib",
|
|
||||||
"src/lib/discord_game_sdk/bin/x86_64/libdiscord_game_sdk.dylib",
|
|
||||||
)
|
)
|
||||||
os.rename(
|
os.rename(
|
||||||
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.so",
|
"src/lib/discord_game_sdk/bin/x86_64/discord_game_sdk.so",
|
||||||
@@ -47,4 +44,18 @@ shutil.rmtree("src/lib/discord_game_sdk/bin/x86/", ignore_errors=True)
|
|||||||
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
|
shutil.rmtree("src/lib/discord_game_sdk/bin/x86_64/", ignore_errors=True)
|
||||||
os.remove("src/lib/discord_game_sdk/README.md")
|
os.remove("src/lib/discord_game_sdk/README.md")
|
||||||
|
|
||||||
os.system("git submodule update --init")
|
if sys.platform == "darwin":
|
||||||
|
# Combine the two libraries into one
|
||||||
|
os.system(
|
||||||
|
"lipo src/lib/discord_game_sdk/bin/{discord_game_sdk.dylib,discord_game_sdk_aarch64.dylib} -output src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib -create"
|
||||||
|
)
|
||||||
|
# Change the install name to (library's location)/(its new name)
|
||||||
|
os.system(
|
||||||
|
"install_name_tool -id '@loader_path/libdiscord_game_sdk.dylib'\
|
||||||
|
src/lib/discord_game_sdk/bin/libdiscord_game_sdk.dylib"
|
||||||
|
)
|
||||||
|
# Remove the ones it's made of
|
||||||
|
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk.dylib")
|
||||||
|
os.remove("src/lib/discord_game_sdk/bin/discord_game_sdk_aarch64.dylib")
|
||||||
|
|
||||||
|
os.system("git submodule update --init --remote")
|
||||||
|
@@ -1,144 +1,116 @@
|
|||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
#include "lib/discord_game_sdk/cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
#include <godot_cpp/classes/editor_plugin.hpp>
|
|
||||||
#include <godot_cpp/variant/utility_functions.hpp>
|
#include <godot_cpp/variant/utility_functions.hpp>
|
||||||
#include <godot_cpp/classes/time.hpp>
|
|
||||||
|
|
||||||
using namespace godot;
|
#define BIND_METHOD(method, ...) godot::ClassDB::bind_method(D_METHOD(#method, ##__VA_ARGS__), &DiscordSDK::method)
|
||||||
|
#define BIND_SET_GET(property_name, variant_type) \
|
||||||
discord_sdk *discord_sdk::singleton = nullptr;
|
godot::ClassDB::bind_method(D_METHOD("get_" #property_name), &DiscordSDK::get_##property_name); \
|
||||||
|
godot::ClassDB::bind_method(D_METHOD("set_" #property_name, #variant_type), &DiscordSDK::set_##property_name); \
|
||||||
|
godot::ClassDB::add_property(get_class_static(), PropertyInfo(variant_type, #property_name), "set_" #property_name, "get_" #property_name)
|
||||||
|
#define BIND_SIGNAL(signal_name, ...) godot::ClassDB::add_signal(get_class_static(), MethodInfo(#signal_name, ##__VA_ARGS__))
|
||||||
|
#define SET_GET(variable, setter, ...) /*getter isn't mandatory for this project*/ \
|
||||||
|
decltype(DiscordSDK::variable) DiscordSDK::get_##variable() { return variable; } \
|
||||||
|
void DiscordSDK::set_##variable(decltype(DiscordSDK::variable) value) \
|
||||||
|
{ \
|
||||||
|
variable = value; \
|
||||||
|
setter; \
|
||||||
|
}
|
||||||
|
|
||||||
|
DiscordSDK *DiscordSDK::singleton = nullptr;
|
||||||
discord::Core *core{};
|
discord::Core *core{};
|
||||||
discord::Result result;
|
discord::Result result;
|
||||||
discord::Activity activity{};
|
discord::Activity activity{};
|
||||||
discord::User user{};
|
discord::User user{};
|
||||||
|
|
||||||
void discord_sdk::_bind_methods()
|
void DiscordSDK::_bind_methods()
|
||||||
{
|
{
|
||||||
ClassDB::bind_method(D_METHOD("debug"), &discord_sdk::debug);
|
BIND_SET_GET(app_id, Variant::INT);
|
||||||
ClassDB::bind_method(D_METHOD("coreupdate"), &discord_sdk::coreupdate);
|
BIND_SET_GET(state, Variant::STRING);
|
||||||
|
BIND_SET_GET(details, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("get_app_id"), &discord_sdk::get_app_id);
|
BIND_SET_GET(large_image, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("set_app_id", "app_id"), &discord_sdk::set_app_id);
|
BIND_SET_GET(large_image_text, Variant::STRING);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "app_id"), "set_app_id", "get_app_id");
|
BIND_SET_GET(small_image, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("get_state"), &discord_sdk::get_state);
|
BIND_SET_GET(small_image_text, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("set_state", "state"), &discord_sdk::set_state);
|
BIND_SET_GET(start_timestamp, Variant::INT);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "state"), "set_state", "get_state");
|
BIND_SET_GET(end_timestamp, Variant::INT);
|
||||||
ClassDB::bind_method(D_METHOD("get_details"), &discord_sdk::get_details);
|
BIND_SET_GET(party_id, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("set_details", "details"), &discord_sdk::set_details);
|
BIND_SET_GET(current_party_size, Variant::INT);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "details"), "set_details", "get_details");
|
BIND_SET_GET(max_party_size, Variant::INT);
|
||||||
|
BIND_SET_GET(match_secret, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image"), &discord_sdk::get_large_image);
|
BIND_SET_GET(join_secret, Variant::STRING);
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image", "large_image"), &discord_sdk::set_large_image);
|
BIND_SET_GET(spectate_secret, Variant::STRING);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image"), "set_large_image", "get_large_image");
|
BIND_SET_GET(instanced, Variant::BOOL);
|
||||||
ClassDB::bind_method(D_METHOD("get_large_image_text"), &discord_sdk::get_large_image_text);
|
BIND_SET_GET(is_public_party, Variant::BOOL);
|
||||||
ClassDB::bind_method(D_METHOD("set_large_image_text", "large_image_text"), &discord_sdk::set_large_image_text);
|
BIND_SIGNAL(activity_join, PropertyInfo(Variant::STRING, "join_secret"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "large_image_text"), "set_large_image_text", "get_large_image_text");
|
BIND_SIGNAL(activity_spectate, PropertyInfo(Variant::STRING, "spectate_secret"));
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image"), &discord_sdk::get_small_image);
|
BIND_SIGNAL(activity_join_request, PropertyInfo(Variant::DICTIONARY, "user_requesting"));
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image", "small_image"), &discord_sdk::set_small_image);
|
BIND_SIGNAL(updated_relationship, PropertyInfo(Variant::DICTIONARY, "relationship"));
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image"), "set_small_image", "get_small_image");
|
BIND_SIGNAL(overlay_toggle, PropertyInfo(Variant::BOOL, "is_locked"));
|
||||||
ClassDB::bind_method(D_METHOD("get_small_image_text"), &discord_sdk::get_small_image_text);
|
BIND_SIGNAL(relationships_init);
|
||||||
ClassDB::bind_method(D_METHOD("set_small_image_text", "large_small_text"), &discord_sdk::set_small_image_text);
|
BIND_METHOD(debug);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "small_image_text"), "set_small_image_text", "get_small_image_text");
|
BIND_METHOD(run_callbacks);
|
||||||
|
BIND_METHOD(refresh);
|
||||||
ClassDB::bind_method(D_METHOD("get_start_timestamp"), &discord_sdk::get_start_timestamp);
|
ClassDB::bind_method(D_METHOD("clear", "reset_values"), &DiscordSDK::clear, DEFVAL(false));
|
||||||
ClassDB::bind_method(D_METHOD("set_start_timestamp", "start_timestamp"), &discord_sdk::set_start_timestamp);
|
BIND_METHOD(unclear);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "start_timestamp"), "set_start_timestamp", "get_start_timestamp");
|
BIND_METHOD(register_command, "command");
|
||||||
ClassDB::bind_method(D_METHOD("get_end_timestamp"), &discord_sdk::get_end_timestamp);
|
BIND_METHOD(register_steam, "steam_id");
|
||||||
ClassDB::bind_method(D_METHOD("set_end_timestamp", "end_timestamp"), &discord_sdk::set_end_timestamp);
|
BIND_METHOD(accept_join_request, "user_id");
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "end_timestamp"), "set_end_timestamp", "get_end_timestamp");
|
BIND_METHOD(send_invite, "user_id", "is_spectate", "message_content");
|
||||||
|
BIND_METHOD(accept_invite, "user_id");
|
||||||
ClassDB::bind_method(D_METHOD("get_party_id"), &discord_sdk::get_party_id);
|
BIND_METHOD(get_current_user);
|
||||||
|
BIND_METHOD(get_all_relationships);
|
||||||
ClassDB::bind_method(D_METHOD("set_party_id", "party_id"), &discord_sdk::set_party_id);
|
BIND_METHOD(get_is_overlay_enabled);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "party_id"), "set_party_id", "get_party_id");
|
BIND_METHOD(get_is_overlay_locked);
|
||||||
|
BIND_METHOD(open_invite_overlay, "is_spectate");
|
||||||
ClassDB::bind_method(D_METHOD("get_current_party_size"), &discord_sdk::get_current_party_size);
|
BIND_METHOD(open_server_invite_overlay, "invite_code");
|
||||||
ClassDB::bind_method(D_METHOD("set_current_party_size", "current_party_size"), &discord_sdk::set_current_party_size);
|
BIND_METHOD(open_voice_settings);
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "current_party_size"), "set_current_party_size", "get_current_party_size");
|
BIND_METHOD(get_is_discord_working);
|
||||||
ClassDB::bind_method(D_METHOD("get_max_party_size"), &discord_sdk::get_max_party_size);
|
BIND_METHOD(get_result_int);
|
||||||
ClassDB::bind_method(D_METHOD("set_max_party_size", "max_party_size"), &discord_sdk::set_max_party_size);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "max_party_size"), "set_max_party_size", "get_max_party_size");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_match_secret"), &discord_sdk::get_match_secret);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_match_secret", "match_secret"), &discord_sdk::set_match_secret);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "match_secret"), "set_match_secret", "get_match_secret");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_join_secret"), &discord_sdk::get_join_secret);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_join_secret", "join_secret"), &discord_sdk::set_join_secret);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "join_secret"), "set_join_secret", "get_join_secret");
|
|
||||||
ClassDB::bind_method(D_METHOD("get_spectate_secret"), &discord_sdk::get_spectate_secret);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_spectate_secret", "spectate_secret"), &discord_sdk::set_spectate_secret);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "spectate_secret"), "set_spectate_secret", "get_spectate_secret");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_instanced"), &discord_sdk::get_instanced);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_instanced", "instanced"), &discord_sdk::set_instanced);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "instanced"), "set_instanced", "get_instanced");
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_is_public_party"), &discord_sdk::get_is_public_party);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_is_public_party", "is_public_party"), &discord_sdk::set_is_public_party);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_public_party"), "set_is_public_party", "get_is_public_party");
|
|
||||||
|
|
||||||
ADD_SIGNAL(MethodInfo("activity_join", PropertyInfo(Variant::STRING, "join_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("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("clear", "reset_values"), &discord_sdk::clear, DEFVAL(false));
|
|
||||||
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_steam", "steam_id"), &discord_sdk::register_steam);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("accept_join_request", "user_id"), &discord_sdk::accept_join_request);
|
|
||||||
ClassDB::bind_method(D_METHOD("send_invite", "user_id", "is_spectate", "message_content"), &discord_sdk::send_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_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_locked"), &discord_sdk::get_is_overlay_locked);
|
|
||||||
ClassDB::bind_method(D_METHOD("set_is_overlay_locked", "is_overlay_locked"), &discord_sdk::set_is_overlay_locked);
|
|
||||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "is_overlay_locked"), "set_is_overlay_locked", "get_is_overlay_locked");
|
|
||||||
ClassDB::bind_method(D_METHOD("open_invite_overlay", "is_spectate"), &discord_sdk::open_invite_overlay);
|
|
||||||
ClassDB::bind_method(D_METHOD("open_server_invite_overlay", "invite_code"), &discord_sdk::open_server_invite_overlay);
|
|
||||||
ClassDB::bind_method(D_METHOD("open_voice_settings"), &discord_sdk::open_voice_settings);
|
|
||||||
ADD_SIGNAL(MethodInfo("overlay_toggle", PropertyInfo(Variant::BOOL, "is_locked")));
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_is_discord_working"), &discord_sdk::get_is_discord_working);
|
|
||||||
|
|
||||||
ClassDB::bind_method(D_METHOD("get_result_int"), &discord_sdk::get_result_int);
|
|
||||||
}
|
}
|
||||||
|
SET_GET(state, activity.SetState(value.utf8().get_data()))
|
||||||
|
SET_GET(details, activity.SetDetails(value.utf8().get_data()))
|
||||||
|
SET_GET(large_image, activity.GetAssets().SetLargeImage(value.utf8().get_data()))
|
||||||
|
SET_GET(large_image_text, activity.GetAssets().SetLargeText(value.utf8().get_data()))
|
||||||
|
SET_GET(small_image, activity.GetAssets().SetSmallImage(value.utf8().get_data()))
|
||||||
|
SET_GET(small_image_text, activity.GetAssets().SetSmallText(value.utf8().get_data()))
|
||||||
|
SET_GET(start_timestamp, activity.GetTimestamps().SetStart(value))
|
||||||
|
SET_GET(end_timestamp, activity.GetTimestamps().SetEnd(value))
|
||||||
|
SET_GET(party_id, activity.GetParty().SetId(value.utf8().get_data()))
|
||||||
|
SET_GET(current_party_size, activity.GetParty().GetSize().SetCurrentSize(value))
|
||||||
|
SET_GET(max_party_size, activity.GetParty().GetSize().SetMaxSize(value))
|
||||||
|
SET_GET(match_secret, activity.GetSecrets().SetMatch(value.utf8().get_data()))
|
||||||
|
SET_GET(join_secret, activity.GetSecrets().SetJoin(value.utf8().get_data()))
|
||||||
|
SET_GET(spectate_secret, activity.GetSecrets().SetSpectate(value.utf8().get_data()))
|
||||||
|
SET_GET(instanced, activity.SetInstance(value))
|
||||||
|
SET_GET(is_public_party, activity.GetParty().SetPrivacy(static_cast<discord::ActivityPartyPrivacy>(value)))
|
||||||
|
|
||||||
discord_sdk *discord_sdk::get_singleton()
|
DiscordSDK::DiscordSDK()
|
||||||
{
|
|
||||||
return singleton;
|
|
||||||
}
|
|
||||||
|
|
||||||
discord_sdk::discord_sdk()
|
|
||||||
{
|
{
|
||||||
ERR_FAIL_COND(singleton != nullptr);
|
ERR_FAIL_COND(singleton != nullptr);
|
||||||
singleton = this;
|
singleton = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
discord_sdk::~discord_sdk()
|
DiscordSDK::~DiscordSDK()
|
||||||
{
|
{
|
||||||
|
app_id = 0;
|
||||||
|
delete core; // couldn't use destructor because it would not compile on linux
|
||||||
|
core = nullptr;
|
||||||
ERR_FAIL_COND(singleton != this);
|
ERR_FAIL_COND(singleton != this);
|
||||||
singleton = nullptr;
|
singleton = nullptr;
|
||||||
delete core;
|
|
||||||
core = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::coreupdate()
|
DiscordSDK *DiscordSDK::get_singleton()
|
||||||
|
{
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DiscordSDK::run_callbacks()
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (result == discord::Result::Ok && app_id > 0)
|
||||||
::core->RunCallbacks();
|
::core->RunCallbacks();
|
||||||
}
|
}
|
||||||
void discord_sdk::debug()
|
void DiscordSDK::debug()
|
||||||
{
|
{
|
||||||
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
result = discord::Core::Create(1080224638845591692, DiscordCreateFlags_NoRequireDiscord, &core);
|
||||||
activity.SetState("Test from Godot!");
|
activity.SetState("Test from Godot!");
|
||||||
@@ -156,7 +128,7 @@ void discord_sdk::debug()
|
|||||||
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::set_app_id(int64_t value)
|
void DiscordSDK::set_app_id(int64_t value)
|
||||||
{
|
{
|
||||||
app_id = value;
|
app_id = value;
|
||||||
if (app_id > 0)
|
if (app_id > 0)
|
||||||
@@ -165,62 +137,42 @@ void discord_sdk::set_app_id(int64_t value)
|
|||||||
|
|
||||||
if (result == discord::Result::Ok)
|
if (result == discord::Result::Ok)
|
||||||
{
|
{
|
||||||
// initialize currentuser stuff
|
// initialize currentuser
|
||||||
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
core->UserManager().OnCurrentUserUpdate.Connect([]()
|
||||||
{discord::User user{};
|
{discord::User user{};
|
||||||
core->UserManager().GetCurrentUser(&user); });
|
core->UserManager().GetCurrentUser(&user); });
|
||||||
// signals
|
// signals
|
||||||
core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
|
core->ActivityManager().OnActivityJoin.Connect([](const char *secret)
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("activity_join", secret); });
|
->emit_signal("activity_join", secret); });
|
||||||
core->ActivityManager().OnActivitySpectate.Connect([](const char *secret)
|
core->ActivityManager().OnActivitySpectate.Connect([](const char *secret)
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("activity_spectate", secret); });
|
->emit_signal("activity_spectate", secret); });
|
||||||
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
core->ActivityManager().OnActivityJoinRequest.Connect([this](discord::User const &user)
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("activity_join_request", user2dict(user)); });
|
->emit_signal("activity_join_request", user2dict(user)); });
|
||||||
|
|
||||||
core->OverlayManager().OnToggle.Connect([](bool is_locked)
|
core->OverlayManager().OnToggle.Connect([](bool is_locked)
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("overlay_toggle", is_locked); });
|
->emit_signal("overlay_toggle", is_locked); });
|
||||||
core->RelationshipManager().OnRefresh.Connect([&]()
|
core->RelationshipManager().OnRefresh.Connect([&]()
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("relationships_init"); });
|
->emit_signal("relationships_init"); });
|
||||||
core->RelationshipManager().OnRelationshipUpdate.Connect([&](discord::Relationship const &relationship)
|
core->RelationshipManager().OnRelationshipUpdate.Connect([&](discord::Relationship const &relationship)
|
||||||
{ discord_sdk::get_singleton()
|
{ DiscordSDK::get_singleton()
|
||||||
->emit_signal("updated_relationship", relationship2dict(relationship)); });
|
->emit_signal("updated_relationship", relationship2dict(relationship)); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int64_t discord_sdk::get_app_id()
|
int64_t DiscordSDK::get_app_id()
|
||||||
{
|
{
|
||||||
if (app_id != 0)
|
if (app_id != 0)
|
||||||
return app_id;
|
return app_id;
|
||||||
return old_app_id;
|
return old_app_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::set_state(String value)
|
void DiscordSDK::refresh()
|
||||||
{
|
{
|
||||||
state = value;
|
if (get_is_discord_working())
|
||||||
activity.SetState(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_state()
|
|
||||||
{
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_details(String value)
|
|
||||||
{
|
|
||||||
details = value;
|
|
||||||
activity.SetDetails(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_details()
|
|
||||||
{
|
|
||||||
return details;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::refresh()
|
|
||||||
{
|
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
|
||||||
{
|
{
|
||||||
activity.GetParty().SetPrivacy(discord::ActivityPartyPrivacy::Public);
|
activity.GetParty().SetPrivacy(discord::ActivityPartyPrivacy::Public);
|
||||||
activity.SetType(discord::ActivityType::Playing);
|
activity.SetType(discord::ActivityType::Playing);
|
||||||
@@ -230,9 +182,9 @@ 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 DiscordSDK::clear(bool reset_values = false)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok)
|
if (get_is_discord_working())
|
||||||
{
|
{
|
||||||
if (reset_values)
|
if (reset_values)
|
||||||
{
|
{
|
||||||
@@ -258,13 +210,13 @@ void discord_sdk::clear(bool reset_values = false)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
old_app_id = app_id;
|
old_app_id = app_id;
|
||||||
set_app_id(0);
|
app_id = 0;
|
||||||
delete core;
|
delete core;
|
||||||
core = nullptr;
|
core = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::unclear()
|
void DiscordSDK::unclear()
|
||||||
{
|
{
|
||||||
if (old_app_id > 0)
|
if (old_app_id > 0)
|
||||||
{
|
{
|
||||||
@@ -276,205 +228,72 @@ void discord_sdk::unclear()
|
|||||||
UtilityFunctions::push_warning("Discord Activity couldn't be uncleared. Maybe it didn't get cleared before?");
|
UtilityFunctions::push_warning("Discord Activity couldn't be uncleared. Maybe it didn't get cleared before?");
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::set_large_image(String value)
|
bool DiscordSDK::get_is_overlay_enabled()
|
||||||
{
|
|
||||||
large_image = value;
|
|
||||||
activity.GetAssets().SetLargeImage(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_large_image()
|
|
||||||
{
|
|
||||||
return large_image;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_large_image_text(String value)
|
|
||||||
{
|
|
||||||
large_image_text = value;
|
|
||||||
activity.GetAssets().SetLargeText(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_large_image_text()
|
|
||||||
{
|
|
||||||
return large_image_text;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_small_image(String value)
|
|
||||||
{
|
|
||||||
small_image = value;
|
|
||||||
activity.GetAssets().SetSmallImage(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_small_image()
|
|
||||||
{
|
|
||||||
return small_image;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_small_image_text(String value)
|
|
||||||
{
|
|
||||||
small_image_text = value;
|
|
||||||
activity.GetAssets().SetSmallText(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_small_image_text()
|
|
||||||
{
|
|
||||||
return small_image_text;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::set_start_timestamp(int64_t value)
|
|
||||||
{
|
|
||||||
start_timestamp = value;
|
|
||||||
activity.GetTimestamps().SetStart(value);
|
|
||||||
}
|
|
||||||
int64_t discord_sdk::get_start_timestamp()
|
|
||||||
{
|
|
||||||
return activity.GetTimestamps().GetStart();
|
|
||||||
}
|
|
||||||
void discord_sdk::set_end_timestamp(int64_t value)
|
|
||||||
{
|
|
||||||
end_timestamp = value;
|
|
||||||
activity.GetTimestamps().SetEnd(value);
|
|
||||||
}
|
|
||||||
int64_t discord_sdk::get_end_timestamp()
|
|
||||||
{
|
|
||||||
return activity.GetTimestamps().GetEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::set_party_id(String value)
|
|
||||||
{
|
|
||||||
party_id = value;
|
|
||||||
activity.GetParty().SetId(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_party_id()
|
|
||||||
{
|
|
||||||
return party_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::set_current_party_size(int32_t value)
|
|
||||||
{
|
|
||||||
current_party_size = value;
|
|
||||||
activity.GetParty().GetSize().SetCurrentSize(value);
|
|
||||||
}
|
|
||||||
int32_t discord_sdk::get_current_party_size()
|
|
||||||
{
|
|
||||||
return current_party_size;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_max_party_size(int32_t value)
|
|
||||||
{
|
|
||||||
max_party_size = value;
|
|
||||||
activity.GetParty().GetSize().SetMaxSize(value);
|
|
||||||
}
|
|
||||||
int32_t discord_sdk::get_max_party_size()
|
|
||||||
{
|
|
||||||
return max_party_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::set_match_secret(String value)
|
|
||||||
{
|
|
||||||
match_secret = value;
|
|
||||||
activity.GetSecrets().SetMatch(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_match_secret()
|
|
||||||
{
|
|
||||||
return match_secret;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_join_secret(String value)
|
|
||||||
{
|
|
||||||
join_secret = value;
|
|
||||||
activity.GetSecrets().SetJoin(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_join_secret()
|
|
||||||
{
|
|
||||||
return join_secret;
|
|
||||||
}
|
|
||||||
void discord_sdk::set_spectate_secret(String value)
|
|
||||||
{
|
|
||||||
spectate_secret = value;
|
|
||||||
activity.GetSecrets().SetSpectate(value.utf8().get_data());
|
|
||||||
}
|
|
||||||
String discord_sdk::get_spectate_secret()
|
|
||||||
{
|
|
||||||
return spectate_secret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::set_instanced(bool value)
|
|
||||||
{
|
|
||||||
instanced = value;
|
|
||||||
activity.SetInstance(value);
|
|
||||||
}
|
|
||||||
bool discord_sdk::get_instanced()
|
|
||||||
{
|
|
||||||
return instanced;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool discord_sdk::get_is_overlay_enabled()
|
|
||||||
{
|
{
|
||||||
bool ie;
|
bool ie;
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().IsEnabled(&ie);
|
core->OverlayManager().IsEnabled(&ie);
|
||||||
return ie;
|
return ie;
|
||||||
}
|
}
|
||||||
bool discord_sdk::get_is_overlay_locked()
|
bool DiscordSDK::get_is_overlay_locked()
|
||||||
{
|
{
|
||||||
bool il;
|
bool il;
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().IsLocked(&il);
|
core->OverlayManager().IsLocked(&il);
|
||||||
return il;
|
return il;
|
||||||
}
|
}
|
||||||
void discord_sdk::set_is_overlay_locked(bool value)
|
void DiscordSDK::set_is_overlay_locked(bool value)
|
||||||
{
|
{
|
||||||
is_overlay_locked = value;
|
is_overlay_locked = value;
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().SetLocked(value, {});
|
core->OverlayManager().SetLocked(value, {});
|
||||||
}
|
}
|
||||||
void discord_sdk::open_invite_overlay(bool is_spectate)
|
void DiscordSDK::open_invite_overlay(bool is_spectate)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().OpenActivityInvite(static_cast<discord::ActivityActionType>(is_spectate + 1), {});
|
core->OverlayManager().OpenActivityInvite(static_cast<discord::ActivityActionType>(is_spectate + 1), {});
|
||||||
}
|
}
|
||||||
void discord_sdk::open_server_invite_overlay(String invite_code)
|
void DiscordSDK::open_server_invite_overlay(String invite_code)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().OpenGuildInvite(invite_code.utf8().get_data(), {});
|
core->OverlayManager().OpenGuildInvite(invite_code.utf8().get_data(), {});
|
||||||
}
|
}
|
||||||
void discord_sdk::open_voice_settings()
|
void DiscordSDK::open_voice_settings()
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->OverlayManager().OpenVoiceSettings({});
|
core->OverlayManager().OpenVoiceSettings({});
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::set_is_public_party(bool value)
|
void DiscordSDK::accept_join_request(int64_t user_id)
|
||||||
{
|
{
|
||||||
is_public_party = value;
|
if (get_is_discord_working())
|
||||||
activity.GetParty().SetPrivacy(static_cast<discord::ActivityPartyPrivacy>(value)); // normaly true
|
|
||||||
}
|
|
||||||
bool discord_sdk::get_is_public_party()
|
|
||||||
{
|
|
||||||
return is_public_party;
|
|
||||||
}
|
|
||||||
|
|
||||||
void discord_sdk::accept_join_request(int64_t user_id)
|
|
||||||
{
|
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
|
||||||
core->ActivityManager().SendRequestReply(user_id, static_cast<discord::ActivityJoinRequestReply>(1), {});
|
core->ActivityManager().SendRequestReply(user_id, static_cast<discord::ActivityJoinRequestReply>(1), {});
|
||||||
}
|
}
|
||||||
void discord_sdk::send_invite(int64_t user_id, bool is_spectate = false, String message_content = "")
|
void DiscordSDK::send_invite(int64_t user_id, bool is_spectate = false, String message_content = "")
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->ActivityManager().SendInvite(user_id, static_cast<discord::ActivityActionType>(is_spectate + 1), message_content.utf8().get_data(), {});
|
core->ActivityManager().SendInvite(user_id, static_cast<discord::ActivityActionType>(is_spectate + 1), message_content.utf8().get_data(), {});
|
||||||
}
|
}
|
||||||
void discord_sdk::accept_invite(int64_t user_id)
|
void DiscordSDK::accept_invite(int64_t user_id)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->ActivityManager().AcceptInvite(user_id, {});
|
core->ActivityManager().AcceptInvite(user_id, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void discord_sdk::register_command(String value)
|
void DiscordSDK::register_command(String value)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->ActivityManager().RegisterCommand(value.utf8().get_data());
|
core->ActivityManager().RegisterCommand(value.utf8().get_data());
|
||||||
}
|
}
|
||||||
void discord_sdk::register_steam(int32_t value)
|
void DiscordSDK::register_steam(int32_t value)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
core->ActivityManager().RegisterSteam(value);
|
core->ActivityManager().RegisterSteam(value);
|
||||||
}
|
}
|
||||||
Dictionary discord_sdk::get_current_user()
|
Dictionary DiscordSDK::get_current_user()
|
||||||
{
|
{
|
||||||
Dictionary userdict;
|
Dictionary userdict;
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
{
|
{
|
||||||
discord::User user{};
|
discord::User user{};
|
||||||
core->UserManager().GetCurrentUser(&user);
|
core->UserManager().GetCurrentUser(&user);
|
||||||
@@ -483,9 +302,9 @@ Dictionary discord_sdk::get_current_user()
|
|||||||
return userdict;
|
return userdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary discord_sdk::get_relationship(int64_t user_id)
|
Dictionary DiscordSDK::get_relationship(int64_t user_id)
|
||||||
{
|
{
|
||||||
if (result == discord::Result::Ok && app_id > 0)
|
if (get_is_discord_working())
|
||||||
{
|
{
|
||||||
discord::Relationship relationship{};
|
discord::Relationship relationship{};
|
||||||
core->RelationshipManager().Get(user_id, &relationship);
|
core->RelationshipManager().Get(user_id, &relationship);
|
||||||
@@ -495,7 +314,7 @@ Dictionary discord_sdk::get_relationship(int64_t user_id)
|
|||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
Array discord_sdk::get_all_relationships()
|
Array DiscordSDK::get_all_relationships()
|
||||||
{
|
{
|
||||||
Array all_relationships;
|
Array all_relationships;
|
||||||
core->RelationshipManager().Filter(
|
core->RelationshipManager().Filter(
|
||||||
@@ -506,23 +325,18 @@ Array discord_sdk::get_all_relationships()
|
|||||||
for (int i = 0; i < friendcount; i++)
|
for (int i = 0; i < friendcount; i++)
|
||||||
{
|
{
|
||||||
discord::Relationship relationship{};
|
discord::Relationship relationship{};
|
||||||
core->RelationshipManager().GetAt(2, &relationship);
|
core->RelationshipManager().GetAt(i, &relationship);
|
||||||
all_relationships.append(relationship2dict(relationship));
|
all_relationships.append(relationship2dict(relationship));
|
||||||
}
|
}
|
||||||
return all_relationships;
|
return all_relationships;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool discord_sdk::get_is_discord_working()
|
int DiscordSDK::get_result_int()
|
||||||
{
|
|
||||||
return result == discord::Result::Ok && app_id > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int discord_sdk::get_result_int()
|
|
||||||
{
|
{
|
||||||
return static_cast<int>(result);
|
return static_cast<int>(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary discord_sdk::user2dict(discord::User user)
|
Dictionary DiscordSDK::user2dict(discord::User user)
|
||||||
{
|
{
|
||||||
Dictionary userdict;
|
Dictionary userdict;
|
||||||
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
|
userdict["avatar"] = user.GetAvatar(); // can be empty when user has no avatar
|
||||||
@@ -538,7 +352,7 @@ Dictionary discord_sdk::user2dict(discord::User user)
|
|||||||
return userdict;
|
return userdict;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dictionary discord_sdk::relationship2dict(discord::Relationship relationship)
|
Dictionary DiscordSDK::relationship2dict(discord::Relationship relationship)
|
||||||
{
|
{
|
||||||
Dictionary dict_relationship;
|
Dictionary dict_relationship;
|
||||||
Dictionary presence;
|
Dictionary presence;
|
||||||
@@ -608,4 +422,9 @@ Dictionary discord_sdk::relationship2dict(discord::Relationship relationship)
|
|||||||
dict_relationship["presence"] = presence;
|
dict_relationship["presence"] = presence;
|
||||||
dict_relationship.make_read_only();
|
dict_relationship.make_read_only();
|
||||||
return dict_relationship;
|
return dict_relationship;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DiscordSDK::get_is_discord_working()
|
||||||
|
{
|
||||||
|
return result == discord::Result::Ok && app_id > 0;
|
||||||
}
|
}
|
@@ -3,124 +3,75 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "lib/discord_game_sdk/cpp/discord.h"
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
#include <godot_cpp/classes/ref_counted.hpp>
|
#include <godot_cpp/classes/object.hpp>
|
||||||
#include <godot_cpp/core/class_db.hpp>
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
|
||||||
|
#define H_SET_GET(variable_type, property_name) \
|
||||||
|
variable_type property_name; \
|
||||||
|
variable_type get_##property_name(); \
|
||||||
|
void set_##property_name(variable_type value);
|
||||||
|
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
class discord_sdk : public RefCounted
|
class DiscordSDK : public Object
|
||||||
{
|
{
|
||||||
GDCLASS(discord_sdk, Object);
|
GDCLASS(DiscordSDK, Object);
|
||||||
|
|
||||||
static discord_sdk *singleton;
|
static DiscordSDK *singleton;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static void _bind_methods();
|
static void _bind_methods();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static discord_sdk *
|
static DiscordSDK *
|
||||||
get_singleton();
|
get_singleton();
|
||||||
|
|
||||||
discord_sdk();
|
DiscordSDK();
|
||||||
~discord_sdk();
|
~DiscordSDK();
|
||||||
|
|
||||||
// INTERBNAL
|
// INTERBNAL
|
||||||
int64_t old_app_id;
|
int64_t old_app_id;
|
||||||
Dictionary relationship2dict(discord::Relationship relationship);
|
Dictionary relationship2dict(discord::Relationship relationship);
|
||||||
Dictionary user2dict(discord::User user);
|
Dictionary user2dict(discord::User user);
|
||||||
///
|
///
|
||||||
|
void set_app_id(int64_t value);
|
||||||
int64_t app_id = 0;
|
int64_t get_app_id();
|
||||||
|
int64_t app_id = 0; // needs to be directly setted to 0 or it will crash randomly
|
||||||
String state;
|
H_SET_GET(String, state)
|
||||||
String details;
|
H_SET_GET(String, details)
|
||||||
|
H_SET_GET(String, large_image)
|
||||||
String large_image;
|
H_SET_GET(String, large_image_text)
|
||||||
String large_image_text;
|
H_SET_GET(String, small_image)
|
||||||
String small_image;
|
H_SET_GET(String, small_image_text)
|
||||||
String small_image_text;
|
H_SET_GET(int64_t, start_timestamp)
|
||||||
|
H_SET_GET(int64_t, end_timestamp)
|
||||||
int64_t start_timestamp;
|
H_SET_GET(String, party_id)
|
||||||
int64_t end_timestamp;
|
H_SET_GET(int32_t, current_party_size)
|
||||||
|
H_SET_GET(int32_t, max_party_size)
|
||||||
String party_id;
|
H_SET_GET(String, match_secret)
|
||||||
int32_t current_party_size;
|
H_SET_GET(String, join_secret)
|
||||||
int32_t max_party_size;
|
H_SET_GET(String, spectate_secret)
|
||||||
String match_secret;
|
H_SET_GET(bool, is_public_party)
|
||||||
String join_secret;
|
H_SET_GET(bool, instanced)
|
||||||
String spectate_secret;
|
H_SET_GET(bool, is_overlay_locked)
|
||||||
|
|
||||||
bool is_public_party;
|
|
||||||
|
|
||||||
bool instanced;
|
|
||||||
|
|
||||||
bool is_overlay_locked;
|
|
||||||
|
|
||||||
void debug();
|
void debug();
|
||||||
void coreupdate();
|
void run_callbacks();
|
||||||
void refresh();
|
void refresh();
|
||||||
void clear(bool reset_values);
|
void clear(bool reset_values);
|
||||||
|
|
||||||
void unclear();
|
void unclear();
|
||||||
int64_t get_app_id();
|
|
||||||
void set_app_id(int64_t value);
|
|
||||||
String get_state();
|
|
||||||
void set_state(String value);
|
|
||||||
String get_details();
|
|
||||||
void set_details(String value);
|
|
||||||
|
|
||||||
String get_large_image();
|
|
||||||
void set_large_image(String value);
|
|
||||||
String get_large_image_text();
|
|
||||||
void set_large_image_text(String value);
|
|
||||||
String get_small_image();
|
|
||||||
void set_small_image(String value);
|
|
||||||
String get_small_image_text();
|
|
||||||
void set_small_image_text(String value);
|
|
||||||
|
|
||||||
int64_t get_start_timestamp();
|
|
||||||
void set_start_timestamp(int64_t value);
|
|
||||||
int64_t get_end_timestamp();
|
|
||||||
void set_end_timestamp(int64_t value);
|
|
||||||
|
|
||||||
String get_party_id();
|
|
||||||
void set_party_id(String value);
|
|
||||||
|
|
||||||
int32_t get_current_party_size();
|
|
||||||
void set_current_party_size(int32_t value);
|
|
||||||
int32_t get_max_party_size();
|
|
||||||
void set_max_party_size(int32_t value);
|
|
||||||
String get_match_secret();
|
|
||||||
void set_match_secret(String value);
|
|
||||||
String get_join_secret();
|
|
||||||
void set_join_secret(String value);
|
|
||||||
String get_spectate_secret();
|
|
||||||
void set_spectate_secret(String value);
|
|
||||||
|
|
||||||
bool get_is_public_party();
|
|
||||||
void set_is_public_party(bool value);
|
|
||||||
|
|
||||||
bool get_instanced();
|
|
||||||
void set_instanced(bool value);
|
|
||||||
|
|
||||||
bool get_is_overlay_enabled();
|
bool get_is_overlay_enabled();
|
||||||
bool get_is_overlay_locked();
|
|
||||||
void set_is_overlay_locked(bool value);
|
|
||||||
void open_invite_overlay(bool is_spectate);
|
void open_invite_overlay(bool is_spectate);
|
||||||
void open_server_invite_overlay(String invite_code);
|
void open_server_invite_overlay(String invite_code);
|
||||||
void open_voice_settings();
|
void open_voice_settings();
|
||||||
|
|
||||||
void accept_join_request(int64_t user_id);
|
void accept_join_request(int64_t user_id);
|
||||||
void send_invite(int64_t user_id, bool is_spectate, String message_content);
|
void send_invite(int64_t user_id, bool is_spectate, String message_content);
|
||||||
void accept_invite(int64_t user_id);
|
void accept_invite(int64_t user_id);
|
||||||
|
|
||||||
void register_command(String value);
|
void register_command(String value);
|
||||||
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);
|
Dictionary get_relationship(int64_t user_id);
|
||||||
Array get_all_relationships();
|
Array get_all_relationships();
|
||||||
|
|
||||||
bool get_is_discord_working();
|
bool get_is_discord_working();
|
||||||
int get_result_int();
|
int get_result_int();
|
||||||
};
|
};
|
||||||
|
55
src/editor_presence.cpp
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#include "editor_presence.h"
|
||||||
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
#include <godot_cpp/variant/utility_functions.hpp>
|
||||||
|
#include <godot_cpp/classes/scene_tree.hpp>
|
||||||
|
|
||||||
|
EditorPresence *EditorPresence::singleton = nullptr;
|
||||||
|
|
||||||
|
void EditorPresence::_bind_methods()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
EditorPresence::EditorPresence()
|
||||||
|
{
|
||||||
|
singleton = this;
|
||||||
|
}
|
||||||
|
EditorPresence::~EditorPresence()
|
||||||
|
{
|
||||||
|
singleton = nullptr;
|
||||||
|
delete core; // couldn't use destructor because it would not compile on linux
|
||||||
|
core = nullptr;
|
||||||
|
}
|
||||||
|
EditorPresence *EditorPresence::get_singleton()
|
||||||
|
{
|
||||||
|
return singleton;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorPresence::_ready()
|
||||||
|
{
|
||||||
|
result = discord::Core::Create(1108142249990176808, DiscordCreateFlags_NoRequireDiscord, &core);
|
||||||
|
activity.SetState("Editing a project...");
|
||||||
|
activity.SetDetails(String(project_settings->get_setting("application/config/name")).utf8());
|
||||||
|
if (project_settings->has_setting("application/config/name"))
|
||||||
|
{
|
||||||
|
activity.GetAssets().SetLargeImage("godot");
|
||||||
|
}
|
||||||
|
activity.GetAssets().SetLargeText(String(engine->get_version_info()["string"]).utf8());
|
||||||
|
activity.GetTimestamps().SetStart(time->get_unix_time_from_system());
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
|
else
|
||||||
|
UtilityFunctions::push_warning("EditorPresence couldn't be loaded! Maybe your Discord isn't running?");
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorPresence::_process(double delta)
|
||||||
|
{
|
||||||
|
if (state_string.utf8() != activity.GetState())
|
||||||
|
{
|
||||||
|
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||||
|
activity.SetState(String("Editing: \"" + edited_scene_root->get_scene_file_path() + "\"").replace("res://", "").utf8());
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
|
}
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
core->RunCallbacks();
|
||||||
|
}
|
44
src/editor_presence.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef EDITOR_PRESENCE_H
|
||||||
|
#define EDITOR_PRESENCE_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "lib/discord_game_sdk/cpp/discord.h"
|
||||||
|
#include <godot_cpp/classes/node.hpp>
|
||||||
|
#include <godot_cpp/core/class_db.hpp>
|
||||||
|
#include <godot_cpp/classes/project_settings.hpp>
|
||||||
|
#include <godot_cpp/classes/engine.hpp>
|
||||||
|
#include <godot_cpp/classes/time.hpp>
|
||||||
|
#include <godot_cpp/classes/tree.hpp>
|
||||||
|
|
||||||
|
using namespace godot;
|
||||||
|
|
||||||
|
class EditorPresence : public Node
|
||||||
|
{
|
||||||
|
GDCLASS(EditorPresence, Node);
|
||||||
|
|
||||||
|
static EditorPresence *singleton;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static void _bind_methods();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static EditorPresence *
|
||||||
|
get_singleton();
|
||||||
|
|
||||||
|
godot::Engine *engine = godot::Engine::get_singleton();
|
||||||
|
godot::ProjectSettings *project_settings = godot::ProjectSettings::get_singleton();
|
||||||
|
godot::Time *time = godot::Time::get_singleton();
|
||||||
|
|
||||||
|
discord::Core *core{};
|
||||||
|
discord::Result result;
|
||||||
|
discord::Activity activity{};
|
||||||
|
|
||||||
|
String state_string;
|
||||||
|
|
||||||
|
EditorPresence();
|
||||||
|
~EditorPresence();
|
||||||
|
void _ready() override;
|
||||||
|
void _process(double delta) override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -7,17 +7,19 @@
|
|||||||
#include <godot_cpp/godot.hpp>
|
#include <godot_cpp/godot.hpp>
|
||||||
|
|
||||||
#include "discordgodot.h"
|
#include "discordgodot.h"
|
||||||
|
#include "editor_presence.h"
|
||||||
using namespace godot;
|
using namespace godot;
|
||||||
|
|
||||||
static discord_sdk *discordsdk;
|
static DiscordSDK *discordsdk;
|
||||||
|
|
||||||
void initialize_discordsdk_module(ModuleInitializationLevel p_level)
|
void initialize_discordsdk_module(ModuleInitializationLevel p_level)
|
||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
ClassDB::register_class<discord_sdk>();
|
ClassDB::register_class<DiscordSDK>();
|
||||||
discordsdk = memnew(discord_sdk);
|
discordsdk = memnew(DiscordSDK);
|
||||||
Engine::get_singleton()->register_singleton("discord_sdk", discord_sdk::get_singleton());
|
Engine::get_singleton()->register_singleton("DiscordSDK", DiscordSDK::get_singleton());
|
||||||
|
ClassDB::register_class<EditorPresence>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,7 +27,7 @@ void uninitialize_discordsdk_module(ModuleInitializationLevel p_level)
|
|||||||
{
|
{
|
||||||
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
if (p_level == MODULE_INITIALIZATION_LEVEL_SCENE)
|
||||||
{
|
{
|
||||||
Engine::get_singleton()->unregister_singleton("discord_sdk");
|
Engine::get_singleton()->unregister_singleton("DiscordSDK");
|
||||||
memdelete(discordsdk);
|
memdelete(discordsdk);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|