about summary refs log tree commit diff stats
path: root/Archipelago/client.gd
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-05-15 12:12:24 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2024-05-15 12:12:24 -0400
commit17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66 (patch)
treecbc1be66d1e734e2ca96ad0746eda03c841069ba /Archipelago/client.gd
parent0c25dc87e5ad9c8c8c2ff0ef5ac6502b166bc405 (diff)
downloadlingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.tar.gz
lingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.tar.bz2
lingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.zip
Send checked paintings to server
Diffstat (limited to 'Archipelago/client.gd')
-rw-r--r--Archipelago/client.gd31
1 files changed, 29 insertions, 2 deletions
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
115var _cached_iceland = 0 115var _cached_iceland = 0
116var _cached_atbash = 0 116var _cached_atbash = 0
117var _geronimo_skip = false 117var _geronimo_skip = false
118var _checked_paintings = []
118 119
119signal could_not_connect 120signal could_not_connect
120signal connect_status 121signal connect_status
@@ -356,6 +357,18 @@ func _on_data():
356 357
357 requestSync() 358 requestSync()
358 359
360 sendMessage(
361 [
362 {
363 "cmd": "Set",
364 "key": "Lingo_%d_Paintings" % [_slot],
365 "default": [],
366 "want_reply": true,
367 "operations": [{"operation": "default", "value": []}]
368 }
369 ]
370 )
371
359 emit_signal("client_connected") 372 emit_signal("client_connected")
360 373
361 elif cmd == "ConnectionRefused": 374 elif cmd == "ConnectionRefused":
@@ -471,6 +484,10 @@ func _on_data():
471 # Return the player home. 484 # Return the player home.
472 get_tree().get_root().get_node("Spatial/player/pause_menu")._reload() 485 get_tree().get_root().get_node("Spatial/player/pause_menu")._reload()
473 486
487 elif cmd == "SetReply":
488 if message.has("key") and message["key"] == ("Lingo_%d_Paintings" % _slot):
489 _checked_paintings = message["value"]
490
474 491
475func _process(_delta): 492func _process(_delta):
476 if _should_process: 493 if _should_process:
@@ -625,13 +642,14 @@ func sendLocation(loc_id):
625 _held_locations.append(loc_id) 642 _held_locations.append(loc_id)
626 643
627 644
628func setValue(key, value): 645func setValue(key, value, operation = "replace"):
629 sendMessage( 646 sendMessage(
630 [ 647 [
631 { 648 {
632 "cmd": "Set", 649 "cmd": "Set",
633 "key": "Lingo_%d_%s" % [_slot, key], 650 "key": "Lingo_%d_%s" % [_slot, key],
634 "operations": [{"operation": "replace", "value": value}] 651 "want_reply": false,
652 "operations": [{"operation": operation, "value": value}]
635 } 653 }
636 ] 654 ]
637 ) 655 )
@@ -787,6 +805,15 @@ func geronimo():
787 saveLocaldata() 805 saveLocaldata()
788 806
789 807
808func checkPainting(painting_id):
809 if _checked_paintings.has(painting_id):
810 return
811
812 _checked_paintings.append(painting_id)
813
814 setValue("Paintings", [painting_id], "add")
815
816
790func colorForItemType(flags): 817func colorForItemType(flags):
791 var int_flags = int(flags) 818 var int_flags = int(flags)
792 if int_flags & 1: # progression 819 if int_flags & 1: # progression