Skip to content

Commit 41c155c

Browse files
authored
Merge pull request #167 from TaloDev/develop
Release 0.38.0
2 parents c7afd13 + c089e25 commit 41c155c

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

addons/talo/apis/players_api.gd

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,20 @@ func update() -> TaloPlayer:
7676
return null
7777

7878
## Merge all of the data from player_id2 into player_id1 and delete player_id2.
79-
func merge(player_id1: String, player_id2: String) -> TaloPlayer:
79+
func merge(player_id1: String, player_id2: String, options := MergeOptions.new()) -> TaloPlayer:
8080
var res := await client.make_request(HTTPClient.METHOD_POST, "/merge", {
8181
playerId1 = player_id1,
8282
playerId2 = player_id2
8383
})
8484

8585
match res.status:
8686
200:
87-
return TaloPlayer.new(res.body.player)
87+
var player := TaloPlayer.new(res.body.player)
88+
if options.post_merge_identity_service != "":
89+
var alias := player.get_alias(options.post_merge_identity_service)
90+
if alias != null:
91+
await identify(alias.service, alias.identifier)
92+
return player
8893
_:
8994
return null
9095

@@ -169,3 +174,6 @@ class SearchPage:
169174
self.count = count
170175
self.items_per_page = items_per_page
171176
self.is_last_page = is_last_page
177+
178+
class MergeOptions:
179+
var post_merge_identity_service: String = ""

addons/talo/apis/saves_api.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ func update_save(save: TaloGameSave, new_name: String = "") -> TaloGameSave:
140140
_saves_manager.replace_save(save)
141141
return save
142142

143-
## Delete the given save.
144-
func delete_save(save: TaloGameSave) -> void:
143+
## Delete the given save. Optionally unload the save if it is the current save (default false).
144+
func delete_save(save: TaloGameSave, unload_if_current_save: bool = false) -> void:
145145
if not await Talo.is_offline():
146146
if Talo.identity_check() != OK:
147147
return
@@ -153,7 +153,8 @@ func delete_save(save: TaloGameSave) -> void:
153153
_saves_manager.all_saves = _saves_manager.all_saves.filter(func (s: TaloGameSave): s.id != save.id)
154154
_saves_manager.delete_offline_save(save)
155155

156-
if _saves_manager.current_save and _saves_manager.current_save.id == save.id:
156+
var is_current_save := _saves_manager.current_save and _saves_manager.current_save.id == save.id
157+
if unload_if_current_save and is_current_save:
157158
unload_current_save()
158159

159160
## Get the format version for the current save.

addons/talo/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="Talo Game Services"
44
description="Talo (https://trytalo.com) is an open-source game backend. Talo's Godot plugin is the easiest way to add leaderboards, player authentication, socket-based multiplayer and more to your game."
55
author="trytalo"
6-
version="0.37.0"
6+
version="0.38.0"
77
script="talo_autoload.gd"

addons/talo/talo_client.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class_name TaloClient extends Node
22

33
# automatically updated with a pre-commit hook
4-
const TALO_CLIENT_VERSION = "0.37.0"
4+
const TALO_CLIENT_VERSION = "0.38.0"
55

66
var _base_url: String
77

@@ -39,6 +39,7 @@ func make_request(method: HTTPClient.Method, url: String, body: Dictionary = {},
3939
var http_request := HTTPRequest.new()
4040
add_child(http_request)
4141
http_request.timeout = 5
42+
http_request.accept_gzip = true
4243
http_request.name = "%s %s" % [_get_method_name(method), url]
4344

4445
http_request.request(full_url, all_headers, method, request_body)

addons/talo/utils/session_manager.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func get_verification_alias_id() -> int:
4141

4242
func handle_session_created(alias: Dictionary, session_token: String, socket_token: String) -> void:
4343
Talo.current_alias = TaloPlayerAlias.new(alias)
44-
Talo.players.identified.emit(Talo.current_player)
4544
_save_session(session_token)
45+
Talo.players.identified.emit(Talo.current_player)
4646
Talo.socket.set_socket_token(socket_token)
4747

4848
func check_for_session() -> bool:

0 commit comments

Comments
 (0)