crash fix for missing party invite resources
This commit is contained in:
@@ -1,22 +1,17 @@
|
||||
[gd_scene load_steps=6 format=3 uid="uid://dyc3kseph4el7"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://dyc3kseph4el7"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://b3qm246m7pnsx" path="res://assets/Logo_V2.png" id="2_gd222"]
|
||||
[ext_resource type="Script" uid="uid://kmubk5a6i385" path="res://discord_connector.gd" id="3_h2yge"]
|
||||
[ext_resource type="Script" uid="uid://46tue7u6crd6" path="res://addons/discord-rpc-gd/nodes/debug.gd" id="6_ujijw"]
|
||||
|
||||
[sub_resource type="RichPresence" id="RichPresence_h2yge"]
|
||||
state = "Inside a Node"
|
||||
details = "Godot -> Discord Social SDK"
|
||||
state = "Inside a Node"
|
||||
large_image = "example_game"
|
||||
large_text = "Example"
|
||||
small_image = "boss"
|
||||
small_text = "Fighting the boss D:"
|
||||
|
||||
[sub_resource type="PartyInvite" id="PartyInvite_h2yge"]
|
||||
id = "test"
|
||||
join_secret = "test2"
|
||||
is_public_party = true
|
||||
|
||||
[node name="Node" type="Node"]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
@@ -62,7 +57,6 @@ script = ExtResource("3_h2yge")
|
||||
|
||||
[node name="DiscordActivity" type="DiscordActivity" parent="DiscordConnector"]
|
||||
rich_presence = SubResource("RichPresence_h2yge")
|
||||
party_invite = SubResource("PartyInvite_h2yge")
|
||||
root_connector = NodePath("..")
|
||||
|
||||
[node name="DiscordLobby" type="DiscordLobby" parent="DiscordConnector"]
|
||||
|
@@ -35,8 +35,9 @@ void DiscordActivity::set_party_invite(Ref<PartyInvite> value)
|
||||
|
||||
void DiscordActivity::update()
|
||||
{
|
||||
if(rich_presence.is_valid()){
|
||||
discordpp::Activity activity;
|
||||
if (rich_presence.is_valid())
|
||||
{
|
||||
activity.SetState(rich_presence->get_state().utf8().get_data());
|
||||
activity.SetDetails(rich_presence->get_details().utf8().get_data());
|
||||
discordpp::ActivityAssets assets;
|
||||
@@ -49,7 +50,9 @@ void DiscordActivity::update()
|
||||
timestamps.SetStart(rich_presence->get_timestamps_start());
|
||||
timestamps.SetEnd(rich_presence->get_timestamps_end());
|
||||
activity.SetTimestamps(timestamps);
|
||||
|
||||
}
|
||||
if (party_invite.is_valid())
|
||||
{
|
||||
discordpp::ActivityParty party;
|
||||
party.SetCurrentSize(party_invite->get_current_size());
|
||||
party.SetMaxSize(party_invite->get_max_size());
|
||||
@@ -59,8 +62,9 @@ void DiscordActivity::update()
|
||||
secrets.SetJoin(party_invite->get_join_secret().utf8().get_data());
|
||||
activity.SetSecrets(secrets);
|
||||
activity.SetParty(party);
|
||||
//TODO: Supported platforms
|
||||
//activity.SetSupportedPlatforms();
|
||||
connector->client->UpdateRichPresence(activity, [](discordpp::ClientResult result){});
|
||||
// TODO: Supported platforms
|
||||
// activity.SetSupportedPlatforms();
|
||||
// TODO: Error on invalid values inside getters
|
||||
}
|
||||
connector->client->UpdateRichPresence(activity, [](discordpp::ClientResult result) {});
|
||||
}
|
@@ -2,8 +2,8 @@
|
||||
|
||||
void RichPresence::_bind_methods()
|
||||
{
|
||||
BIND_SET_GET(RichPresence, state, Variant::STRING);
|
||||
BIND_SET_GET(RichPresence, details, Variant::STRING);
|
||||
BIND_SET_GET(RichPresence, state, Variant::STRING);
|
||||
ADD_GROUP("Large Image", "large_");
|
||||
BIND_SET_GET(RichPresence, large_image, Variant::STRING);
|
||||
BIND_SET_GET(RichPresence, large_text, Variant::STRING);
|
||||
@@ -14,16 +14,6 @@ void RichPresence::_bind_methods()
|
||||
|
||||
RichPresence::RichPresence() {}
|
||||
|
||||
void RichPresence::set_state(String value)
|
||||
{
|
||||
state = value;
|
||||
}
|
||||
|
||||
String RichPresence::get_state()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
void RichPresence::set_details(String value)
|
||||
{
|
||||
details = value;
|
||||
@@ -34,6 +24,16 @@ String RichPresence::get_details()
|
||||
return details;
|
||||
}
|
||||
|
||||
void RichPresence::set_state(String value)
|
||||
{
|
||||
state = value;
|
||||
}
|
||||
|
||||
String RichPresence::get_state()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
void RichPresence::set_large_image(String value)
|
||||
{
|
||||
large_image = value;
|
||||
|
@@ -9,16 +9,16 @@
|
||||
|
||||
using namespace godot;
|
||||
|
||||
class RichPresence : public Resource {
|
||||
class RichPresence : public Resource
|
||||
{
|
||||
GDCLASS(RichPresence, Resource);
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
public:
|
||||
|
||||
H_SET_GET(state, "")
|
||||
H_SET_GET(details, "")
|
||||
H_SET_GET(state, "")
|
||||
H_SET_GET(large_image, "")
|
||||
H_SET_GET(large_text, "")
|
||||
H_SET_GET(small_image, "")
|
||||
|
Reference in New Issue
Block a user