diff options
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r-- | Archipelago/client.gd | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Archipelago/client.gd b/Archipelago/client.gd index b3d1359..905a0a1 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd | |||
@@ -34,6 +34,7 @@ var _painting_ids_by_item = {} | |||
34 | var _mentioned_paintings = [] | 34 | var _mentioned_paintings = [] |
35 | var _panel_ids_by_location = {} | 35 | var _panel_ids_by_location = {} |
36 | var _localdata_file = "" | 36 | var _localdata_file = "" |
37 | var _death_link = false | ||
37 | 38 | ||
38 | var _map_loaded = false | 39 | var _map_loaded = false |
39 | var _held_items = [] | 40 | var _held_items = [] |
@@ -146,6 +147,10 @@ func _on_data(): | |||
146 | if _slot_data.has("panel_ids_by_location_id"): | 147 | if _slot_data.has("panel_ids_by_location_id"): |
147 | _panel_ids_by_location = _slot_data["panel_ids_by_location_id"] | 148 | _panel_ids_by_location = _slot_data["panel_ids_by_location_id"] |
148 | 149 | ||
150 | _death_link = _slot_data.has("death_link") and _slot_data["death_link"] | ||
151 | if _death_link: | ||
152 | sendConnectUpdate(["DeathLink"]) | ||
153 | |||
149 | _localdata_file = "user://archipelago/%s_%d" % [_seed, _slot] | 154 | _localdata_file = "user://archipelago/%s_%d" % [_seed, _slot] |
150 | var ap_file = File.new() | 155 | var ap_file = File.new() |
151 | if ap_file.file_exists(_localdata_file): | 156 | if ap_file.file_exists(_localdata_file): |
@@ -220,6 +225,25 @@ func _on_data(): | |||
220 | if message["receiving"] != _slot: | 225 | if message["receiving"] != _slot: |
221 | messages_node.showMessage("Sent %s to %s" % [item_name, player_name]) | 226 | messages_node.showMessage("Sent %s to %s" % [item_name, player_name]) |
222 | 227 | ||
228 | elif cmd == "Bounced": | ||
229 | if ( | ||
230 | _death_link | ||
231 | and message.has("tags") | ||
232 | and message.has("data") | ||
233 | and message["tags"].has("DeathLink") | ||
234 | ): | ||
235 | var messages_node = get_tree().get_root().get_node("Spatial/AP_Messages") | ||
236 | var first_sentence = "Received Death" | ||
237 | var second_sentence = "" | ||
238 | if message["data"].has("source"): | ||
239 | first_sentence = "Received Death from %s" % message["data"]["source"] | ||
240 | if message["data"].has("cause"): | ||
241 | second_sentence = ". Reason: %s" % message["data"]["cause"] | ||
242 | messages_node.showMessage(first_sentence + second_sentence) | ||
243 | |||
244 | # Return the player home. | ||
245 | get_tree().get_root().get_node("Spatial/player/pause_menu")._reload() | ||
246 | |||
223 | 247 | ||
224 | func _process(_delta): | 248 | func _process(_delta): |
225 | if _should_process: | 249 | if _should_process: |
@@ -316,6 +340,10 @@ func connectToRoom(): | |||
316 | ) | 340 | ) |
317 | 341 | ||
318 | 342 | ||
343 | func sendConnectUpdate(tags): | ||
344 | sendMessage([{"cmd": "ConnectUpdate", "tags": tags}]) | ||
345 | |||
346 | |||
319 | func requestSync(): | 347 | func requestSync(): |
320 | sendMessage([{"cmd": "Sync"}]) | 348 | sendMessage([{"cmd": "Sync"}]) |
321 | 349 | ||