Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
249fe68abd | ||
|
852e3b09ea | ||
|
0d25a45a57 |
15
README.md
15
README.md
@@ -1,4 +1,4 @@
|
|||||||
<img src="/project/assets/discordgodot_banner.png" alt="Project Banner" />
|
<img src="/project/assets/discordgodot_banner.png" alt="Project Banner">
|
||||||
|
|
||||||
Discord recently released its new SDK. This plugin will get a huge overhaul and new docs as soon as possible.
|
Discord recently released its new SDK. This plugin will get a huge overhaul and new docs as soon as possible.
|
||||||
<a href="https://discord.com/blog/announcing-discord-social-sdk-to-power-game-comms" target="_blank">Discord's anouncement</a>
|
<a href="https://discord.com/blog/announcing-discord-social-sdk-to-power-game-comms" target="_blank">Discord's anouncement</a>
|
||||||
@@ -7,10 +7,10 @@ Discord recently released its new SDK. This plugin will get a huge overhaul and
|
|||||||
|
|
||||||
### This is for the Discord Game SDK NOT the Embedded App SDK
|
### This is for the Discord Game SDK NOT the Embedded App SDK
|
||||||
**Discord RPC Plugin for GDScript with an easy-to-use code pattern in Godot Engine 4.1+, with optional Editor Rich Presence! (Compatible with Linux, Windows, & MacOS)**<br><br>
|
**Discord RPC Plugin for GDScript with an easy-to-use code pattern in Godot Engine 4.1+, with optional Editor Rich Presence! (Compatible with Linux, Windows, & MacOS)**<br><br>
|
||||||
<br />
|
<br>
|
||||||
### [My Discord Server](https://discord.gg/3gqUrtbaur)
|
### [My Discord Server](https://discord.gg/3gqUrtbaur)
|
||||||
# [Quick start :rocket: (click here)](https://docs.vaporvee.com/discord-rpc-godot#quick-start)
|
# [Quick start :rocket: (click here)](https://docs.vaporvee.com/discord-rpc-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!**
|
||||||
|
|
||||||
@@ -21,14 +21,15 @@ Discord recently released its new SDK. This plugin will get a huge overhaul and
|
|||||||
- User information
|
- User information
|
||||||
- Relationship Manager (Get friendlist and its updates)
|
- Relationship Manager (Get friendlist and its updates)
|
||||||
- Overlay management
|
- Overlay management
|
||||||
- Editor Presence (optional)
|
- Editor Presence (optional) <br>
|
||||||
|
<br>
|
||||||
<img width="600px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/GodotEditorPresenceBanner.png">
|
<img width="600px" src="https://raw.githubusercontent.com/vaporvee/discord-sdk-godot/main/project/assets/GodotEditorPresenceBanner.png">
|
||||||
<br />
|
<br>
|
||||||
|
|
||||||
<br />
|
<br>
|
||||||
|
|
||||||
### Credit
|
### Credit
|
||||||
[@Pukimaa](https://github.com/pukimaa) - Designer<br>
|
[@Pukimaa](https://github.com/pukimaa) - Designer<br>
|
||||||
<br />
|
<br>
|
||||||
|
|
||||||
*This project is not endorsed or affiliated with Discord Inc. or the Godot Foundation.*
|
*This project is not endorsed or affiliated with Discord Inc. or the Godot Foundation.*
|
||||||
|
@@ -43,13 +43,39 @@ void EditorPresence::_ready()
|
|||||||
|
|
||||||
void EditorPresence::_process(double delta)
|
void EditorPresence::_process(double delta)
|
||||||
{
|
{
|
||||||
if (state_string.utf8() != activity.GetState())
|
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
||||||
|
|
||||||
|
if (edited_scene_root != nullptr)
|
||||||
{
|
{
|
||||||
godot::Node *edited_scene_root = get_tree()->get_edited_scene_root();
|
godot::String scene_path = edited_scene_root->get_scene_file_path();
|
||||||
activity.SetState(String("Editing: \"" + edited_scene_root->get_scene_file_path() + "\"").replace("res://", "").utf8());
|
|
||||||
if (result == discord::Result::Ok)
|
if (scene_path.is_empty())
|
||||||
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
{
|
||||||
|
state_string = "Editing: (not saved scene)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state_string = "Editing: \"" + scene_path.replace("res://", "") + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state_string.utf8() != activity.GetState())
|
||||||
|
{
|
||||||
|
activity.SetState(state_string.utf8());
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
godot::String default_state = "No Scene Loaded";
|
||||||
|
if (default_state.utf8() != activity.GetState())
|
||||||
|
{
|
||||||
|
activity.SetState(default_state.utf8());
|
||||||
|
if (result == discord::Result::Ok)
|
||||||
|
core->ActivityManager().UpdateActivity(activity, [](discord::Result result) {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (result == discord::Result::Ok)
|
if (result == discord::Result::Ok)
|
||||||
core->RunCallbacks();
|
core->RunCallbacks();
|
||||||
}
|
}
|
Reference in New Issue
Block a user