about summary refs log tree commit diff stats
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
parent0c25dc87e5ad9c8c8c2ff0ef5ac6502b166bc405 (diff)
downloadlingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.tar.gz
lingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.tar.bz2
lingo-archipelago-17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66.zip
Send checked paintings to server
-rw-r--r--Archipelago/client.gd31
-rw-r--r--Archipelago/mypainting.gd113
2 files changed, 85 insertions, 59 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
diff --git a/Archipelago/mypainting.gd b/Archipelago/mypainting.gd index 999b122..7aee434 100644 --- a/Archipelago/mypainting.gd +++ b/Archipelago/mypainting.gd
@@ -30,66 +30,65 @@ func movePainting():
30 30
31 31
32func _looked_at(body, painting): 32func _looked_at(body, painting):
33 if ( 33 if body.is_in_group("player") and (painting.get_name() == self.get_parent().get_name()):
34 target != null 34 var apclient = global.get_node("Archipelago")
35 and body.is_in_group("player") 35 apclient.checkPainting(painting.get_name())
36 and (painting.get_name() == self.get_parent().get_name())
37 ):
38 var target_dir = _dir_to_int(target.orientation)
39 var source_dir = _dir_to_int(orientation)
40 var rotate = target_dir - source_dir
41 if rotate < 0:
42 rotate += 4
43 rotate *= 90
44 36
45 var target_painting = target.get_parent() 37 if target != null:
38 var target_dir = _dir_to_int(target.orientation)
39 var source_dir = _dir_to_int(orientation)
40 var rotate = target_dir - source_dir
41 if rotate < 0:
42 rotate += 4
43 rotate *= 90
46 44
47 # this is ACW 45 var target_painting = target.get_parent()
48 if rotate == 0:
49 body.translation.x = (
50 target_painting.translation.x + (body.translation.x - painting.translation.x)
51 )
52 body.translation.y = (
53 target_painting.translation.y + (body.translation.y - painting.translation.y)
54 )
55 body.translation.z = (
56 target_painting.translation.z + (body.translation.z - painting.translation.z)
57 )
58 elif rotate == 180:
59 body.translation.x = (
60 target_painting.translation.x - (body.translation.x - painting.translation.x)
61 )
62 body.translation.y = (
63 target_painting.translation.y + (body.translation.y - painting.translation.y)
64 )
65 body.translation.z = (
66 target_painting.translation.z - (body.translation.z - painting.translation.z)
67 )
68 body.rotate_y(PI)
69 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), PI)
70 elif rotate == 90:
71 var diff_x = body.translation.x - painting.translation.x
72 var diff_y = body.translation.y - painting.translation.y
73 var diff_z = body.translation.z - painting.translation.z
74 body.translation.x = target_painting.translation.x + diff_z
75 body.translation.y = target_painting.translation.y + diff_y
76 body.translation.z = target_painting.translation.z - diff_x
77 body.rotate_y(PI / 2)
78 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), PI / 2)
79 elif rotate == 270:
80 var diff_x = body.translation.x - painting.translation.x
81 var diff_y = body.translation.y - painting.translation.y
82 var diff_z = body.translation.z - painting.translation.z
83 body.translation.x = target_painting.translation.x - diff_z
84 body.translation.y = target_painting.translation.y + diff_y
85 body.translation.z = target_painting.translation.z + diff_x
86 body.rotate_y(3 * PI / 2)
87 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), 3 * PI / 2)
88 46
89 var apclient = global.get_node("Archipelago") 47 # this is ACW
90 if !apclient._pilgrimage_allows_paintings: 48 if rotate == 0:
91 global.sunwarp = 1 49 body.translation.x = (
92 body.get_node("pivot/camera/sunwarp_background").visible = false 50 target_painting.translation.x + (body.translation.x - painting.translation.x)
51 )
52 body.translation.y = (
53 target_painting.translation.y + (body.translation.y - painting.translation.y)
54 )
55 body.translation.z = (
56 target_painting.translation.z + (body.translation.z - painting.translation.z)
57 )
58 elif rotate == 180:
59 body.translation.x = (
60 target_painting.translation.x - (body.translation.x - painting.translation.x)
61 )
62 body.translation.y = (
63 target_painting.translation.y + (body.translation.y - painting.translation.y)
64 )
65 body.translation.z = (
66 target_painting.translation.z - (body.translation.z - painting.translation.z)
67 )
68 body.rotate_y(PI)
69 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), PI)
70 elif rotate == 90:
71 var diff_x = body.translation.x - painting.translation.x
72 var diff_y = body.translation.y - painting.translation.y
73 var diff_z = body.translation.z - painting.translation.z
74 body.translation.x = target_painting.translation.x + diff_z
75 body.translation.y = target_painting.translation.y + diff_y
76 body.translation.z = target_painting.translation.z - diff_x
77 body.rotate_y(PI / 2)
78 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), PI / 2)
79 elif rotate == 270:
80 var diff_x = body.translation.x - painting.translation.x
81 var diff_y = body.translation.y - painting.translation.y
82 var diff_z = body.translation.z - painting.translation.z
83 body.translation.x = target_painting.translation.x - diff_z
84 body.translation.y = target_painting.translation.y + diff_y
85 body.translation.z = target_painting.translation.z + diff_x
86 body.rotate_y(3 * PI / 2)
87 body.velocity = body.velocity.rotated(Vector3(0, 1, 0), 3 * PI / 2)
88
89 if !apclient._pilgrimage_allows_paintings:
90 global.sunwarp = 1
91 body.get_node("pivot/camera/sunwarp_background").visible = false
93 92
94 93
95func _dir_to_int(dir): 94func _dir_to_int(dir):