From 17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 15 May 2024 12:12:24 -0400 Subject: Send checked paintings to server --- Archipelago/client.gd | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'Archipelago/client.gd') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 7903df2..0625c82 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -115,6 +115,7 @@ var _cached_slowness = 0 var _cached_iceland = 0 var _cached_atbash = 0 var _geronimo_skip = false +var _checked_paintings = [] signal could_not_connect signal connect_status @@ -356,6 +357,18 @@ func _on_data(): requestSync() + sendMessage( + [ + { + "cmd": "Set", + "key": "Lingo_%d_Paintings" % [_slot], + "default": [], + "want_reply": true, + "operations": [{"operation": "default", "value": []}] + } + ] + ) + emit_signal("client_connected") elif cmd == "ConnectionRefused": @@ -471,6 +484,10 @@ func _on_data(): # Return the player home. get_tree().get_root().get_node("Spatial/player/pause_menu")._reload() + elif cmd == "SetReply": + if message.has("key") and message["key"] == ("Lingo_%d_Paintings" % _slot): + _checked_paintings = message["value"] + func _process(_delta): if _should_process: @@ -625,13 +642,14 @@ func sendLocation(loc_id): _held_locations.append(loc_id) -func setValue(key, value): +func setValue(key, value, operation = "replace"): sendMessage( [ { "cmd": "Set", "key": "Lingo_%d_%s" % [_slot, key], - "operations": [{"operation": "replace", "value": value}] + "want_reply": false, + "operations": [{"operation": operation, "value": value}] } ] ) @@ -787,6 +805,15 @@ func geronimo(): saveLocaldata() +func checkPainting(painting_id): + if _checked_paintings.has(painting_id): + return + + _checked_paintings.append(painting_id) + + setValue("Paintings", [painting_id], "add") + + func colorForItemType(flags): var int_flags = int(flags) if int_flags & 1: # progression -- cgit 1.4.1