diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 16:14:37 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-06-06 16:14:37 -0400 |
commit | df04df9364b5537e0e8c862ca5f25826ba3ed0a9 (patch) | |
tree | 695975790f0586d66692b48924c708eb1d13ddbc /Archipelago/mypainting.gd | |
parent | 25d422064f01e7f9dcd3941e99b529e4d86b7ef6 (diff) | |
parent | 17d2b39d0dd2d94065fbe848e0dbf85e4a80ca66 (diff) | |
download | lingo-archipelago-df04df9364b5537e0e8c862ca5f25826ba3ed0a9.tar.gz lingo-archipelago-df04df9364b5537e0e8c862ca5f25826ba3ed0a9.tar.bz2 lingo-archipelago-df04df9364b5537e0e8c862ca5f25826ba3ed0a9.zip |
Merge branch 'subway'
Diffstat (limited to 'Archipelago/mypainting.gd')
-rw-r--r-- | Archipelago/mypainting.gd | 113 |
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 | ||
32 | func _looked_at(body, painting): | 32 | func _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 | ||
95 | func _dir_to_int(dir): | 94 | func _dir_to_int(dir): |