about summary refs log tree commit diff stats
path: root/Archipelago/mypainting.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/mypainting.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/mypainting.gd')
-rw-r--r--Archipelago/mypainting.gd113
1 files changed, 56 insertions, 57 deletions
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):