diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 13:40:29 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2024-07-16 13:40:29 -0400 |
commit | 59e2b90ef45adb2c76d139e5995cedb331322176 (patch) | |
tree | c63266a399fea67c379333dfee8803c87d6827e5 /Archipelago/mypainting.gd | |
parent | 0e10801d335a52d3e88ad02a5f3ff9784a53a119 (diff) | |
parent | 6b5b85f96fc855810ac21e96e1aeb9cbde0fe88e (diff) | |
download | lingo-archipelago-59e2b90ef45adb2c76d139e5995cedb331322176.tar.gz lingo-archipelago-59e2b90ef45adb2c76d139e5995cedb331322176.tar.bz2 lingo-archipelago-59e2b90ef45adb2c76d139e5995cedb331322176.zip |
Merge branch 'main' into panels
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): |