diff options
Diffstat (limited to 'Archipelago')
-rw-r--r-- | Archipelago/effects.gd | 112 | ||||
-rw-r--r-- | Archipelago/load.gd | 9 |
2 files changed, 79 insertions, 42 deletions
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index ae134bc..e830fbc 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd | |||
@@ -9,11 +9,14 @@ var queued_iceland = 0 | |||
9 | var skip_available = false | 9 | var skip_available = false |
10 | var puzzle_focused = false | 10 | var puzzle_focused = false |
11 | var solve_mode = false | 11 | var solve_mode = false |
12 | var not_behind_wall = false | ||
12 | var puzzle_to_skip = "" | 13 | var puzzle_to_skip = "" |
14 | var text_dirty = true | ||
13 | 15 | ||
14 | var orig_env | 16 | var orig_env |
15 | var orig_walk | 17 | var orig_walk |
16 | var orig_run | 18 | var orig_run |
19 | var wallcast | ||
17 | 20 | ||
18 | 21 | ||
19 | func _ready(): | 22 | func _ready(): |
@@ -21,6 +24,8 @@ func _ready(): | |||
21 | orig_walk = get_tree().get_root().get_node("Spatial/player").walk_speed | 24 | orig_walk = get_tree().get_root().get_node("Spatial/player").walk_speed |
22 | orig_run = get_tree().get_root().get_node("Spatial/player").run_speed | 25 | orig_run = get_tree().get_root().get_node("Spatial/player").run_speed |
23 | 26 | ||
27 | wallcast = get_tree().get_root().get_node("Spatial/player/pivot/camera/wallcast") | ||
28 | |||
24 | var label = Label.new() | 29 | var label = Label.new() |
25 | label.set_name("label") | 30 | label.set_name("label") |
26 | label.margin_right = 1920.0 - 20.0 | 31 | label.margin_right = 1920.0 - 20.0 |
@@ -37,6 +42,18 @@ func _ready(): | |||
37 | 42 | ||
38 | add_child(label) | 43 | add_child(label) |
39 | 44 | ||
45 | var slowness_timer = Timer.new() | ||
46 | slowness_timer.name = "SlownessTimer" | ||
47 | slowness_timer.wait_time = 1.0 | ||
48 | add_child(slowness_timer) | ||
49 | slowness_timer.connect("timeout", self, "_tick_slowness") | ||
50 | |||
51 | var iceland_timer = Timer.new() | ||
52 | iceland_timer.name = "IcelandTimer" | ||
53 | iceland_timer.wait_time = 1.0 | ||
54 | add_child(iceland_timer) | ||
55 | iceland_timer.connect("timeout", self, "_tick_iceland") | ||
56 | |||
40 | 57 | ||
41 | func activate(): | 58 | func activate(): |
42 | activated = true | 59 | activated = true |
@@ -53,10 +70,10 @@ func trigger_slowness_trap(): | |||
53 | player.walk_speed = orig_walk / 2.0 | 70 | player.walk_speed = orig_walk / 2.0 |
54 | player.run_speed = orig_run / 2.0 | 71 | player.run_speed = orig_run / 2.0 |
55 | 72 | ||
56 | slowness_remaining += 30 | 73 | $SlownessTimer.start() |
57 | 74 | ||
58 | if not effect_running: | 75 | slowness_remaining += 30 |
59 | _process_effects() | 76 | text_dirty = true |
60 | 77 | ||
61 | 78 | ||
62 | func trigger_iceland_trap(): | 79 | func trigger_iceland_trap(): |
@@ -69,10 +86,10 @@ func trigger_iceland_trap(): | |||
69 | load("res://environments/level_iceland.tres") | 86 | load("res://environments/level_iceland.tres") |
70 | ) | 87 | ) |
71 | 88 | ||
72 | iceland_remaining += 60 | 89 | $IcelandTimer.start() |
73 | 90 | ||
74 | if not effect_running: | 91 | iceland_remaining += 60 |
75 | _process_effects() | 92 | text_dirty = true |
76 | 93 | ||
77 | 94 | ||
78 | func trigger_atbash_trap(): | 95 | func trigger_atbash_trap(): |
@@ -82,8 +99,7 @@ func trigger_atbash_trap(): | |||
82 | var apclient = global.get_node("Archipelago") | 99 | var apclient = global.get_node("Archipelago") |
83 | apclient.evaluateSolvability() | 100 | apclient.evaluateSolvability() |
84 | 101 | ||
85 | if not effect_running: | 102 | text_dirty = true |
86 | _process_effects() | ||
87 | 103 | ||
88 | 104 | ||
89 | func deactivate_atbash_trap(): | 105 | func deactivate_atbash_trap(): |
@@ -93,6 +109,8 @@ func deactivate_atbash_trap(): | |||
93 | var apclient = global.get_node("Archipelago") | 109 | var apclient = global.get_node("Archipelago") |
94 | apclient.evaluateSolvability() | 110 | apclient.evaluateSolvability() |
95 | 111 | ||
112 | text_dirty = true | ||
113 | |||
96 | 114 | ||
97 | func show_puzzle_skip_message(node_path): | 115 | func show_puzzle_skip_message(node_path): |
98 | var panel_input = get_tree().get_root().get_node(node_path) | 116 | var panel_input = get_tree().get_root().get_node(node_path) |
@@ -106,12 +124,15 @@ func show_puzzle_skip_message(node_path): | |||
106 | return | 124 | return |
107 | 125 | ||
108 | puzzle_focused = true | 126 | puzzle_focused = true |
127 | wallcast.enabled = true | ||
128 | not_behind_wall = false | ||
109 | puzzle_to_skip = node_path | 129 | puzzle_to_skip = node_path |
110 | _evaluate_puzzle_skip() | 130 | _evaluate_puzzle_skip() |
111 | 131 | ||
112 | 132 | ||
113 | func hide_puzzle_skip_message(): | 133 | func hide_puzzle_skip_message(): |
114 | puzzle_focused = false | 134 | puzzle_focused = false |
135 | wallcast.enabled = false | ||
115 | _evaluate_puzzle_skip() | 136 | _evaluate_puzzle_skip() |
116 | 137 | ||
117 | 138 | ||
@@ -136,26 +157,49 @@ func skip_puzzle(): | |||
136 | func _evaluate_puzzle_skip(): | 157 | func _evaluate_puzzle_skip(): |
137 | if puzzle_focused and not solve_mode: | 158 | if puzzle_focused and not solve_mode: |
138 | skip_available = true | 159 | skip_available = true |
139 | |||
140 | if not effect_running: | ||
141 | _process_effects() | ||
142 | else: | 160 | else: |
143 | skip_available = false | 161 | skip_available = false |
162 | text_dirty = true | ||
163 | |||
144 | 164 | ||
165 | func _tick_slowness(): | ||
166 | slowness_remaining -= 1 | ||
167 | text_dirty = true | ||
168 | |||
169 | if slowness_remaining == 0: | ||
170 | var player = get_tree().get_root().get_node("Spatial/player") | ||
171 | player.walk_speed = orig_walk | ||
172 | player.run_speed = orig_run | ||
173 | |||
174 | $SlownessTimer.stop() | ||
175 | |||
176 | |||
177 | func _tick_iceland(): | ||
178 | iceland_remaining -= 1 | ||
179 | text_dirty = true | ||
180 | |||
181 | if iceland_remaining == 0: | ||
182 | get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment( | ||
183 | orig_env | ||
184 | ) | ||
145 | 185 | ||
146 | func _process_effects(): | 186 | $IcelandTimer.stop() |
147 | effect_running = true | 187 | |
188 | |||
189 | func _process(_delta): | ||
190 | if puzzle_focused: | ||
191 | if wallcast.is_colliding(): | ||
192 | var should_nbw = (get_tree().get_root().get_node("Spatial/player")._get_panel_from_ray(wallcast) != null) | ||
193 | if should_nbw != not_behind_wall: | ||
194 | not_behind_wall = true | ||
195 | text_dirty = true | ||
196 | |||
197 | if text_dirty: | ||
198 | text_dirty = false | ||
148 | 199 | ||
149 | while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated or skip_available: | ||
150 | var text = "" | 200 | var text = "" |
151 | if atbash_activated: | 201 | if atbash_activated: |
152 | text += "Atbash Trap lasts until you solve a puzzle" | 202 | text += "Atbash Trap lasts until you solve a puzzle" |
153 | if skip_available: | ||
154 | var apclient = global.get_node("Archipelago") | ||
155 | if apclient.getAvailablePuzzleSkips() > 0: | ||
156 | if not text.empty(): | ||
157 | text += "\n" | ||
158 | text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips() | ||
159 | if slowness_remaining > 0: | 203 | if slowness_remaining > 0: |
160 | if not text.empty(): | 204 | if not text.empty(): |
161 | text += "\n" | 205 | text += "\n" |
@@ -164,26 +208,10 @@ func _process_effects(): | |||
164 | if not text.empty(): | 208 | if not text.empty(): |
165 | text += "\n" | 209 | text += "\n" |
166 | text += "Iceland: %d seconds" % iceland_remaining | 210 | text += "Iceland: %d seconds" % iceland_remaining |
211 | if skip_available and not_behind_wall: | ||
212 | var apclient = global.get_node("Archipelago") | ||
213 | if apclient.getAvailablePuzzleSkips() > 0: | ||
214 | if not text.empty(): | ||
215 | text += "\n" | ||
216 | text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips() | ||
167 | self.get_node("label").text = text | 217 | self.get_node("label").text = text |
168 | |||
169 | yield(get_tree().create_timer(1.0), "timeout") | ||
170 | |||
171 | if !get_tree().paused: | ||
172 | if slowness_remaining > 0: | ||
173 | slowness_remaining -= 1 | ||
174 | |||
175 | if slowness_remaining == 0: | ||
176 | var player = get_tree().get_root().get_node("Spatial/player") | ||
177 | player.walk_speed = orig_walk | ||
178 | player.run_speed = orig_run | ||
179 | |||
180 | if iceland_remaining > 0: | ||
181 | iceland_remaining -= 1 | ||
182 | |||
183 | if iceland_remaining == 0: | ||
184 | get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment( | ||
185 | orig_env | ||
186 | ) | ||
187 | |||
188 | self.get_node("label").text = "" | ||
189 | effect_running = false | ||
diff --git a/Archipelago/load.gd b/Archipelago/load.gd index afe304b..7f86c91 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd | |||
@@ -25,6 +25,15 @@ func _load(): | |||
25 | var apclient = global.get_node("Archipelago") | 25 | var apclient = global.get_node("Archipelago") |
26 | var panels_parent = self.get_node("Panels") | 26 | var panels_parent = self.get_node("Panels") |
27 | 27 | ||
28 | # Add a wall-blocked raycast to the player. | ||
29 | var wallcast = RayCast.new() | ||
30 | wallcast.name = "wallcast" | ||
31 | wallcast.cast_to = Vector3(0, 0, -15) | ||
32 | wallcast.set_collision_mask_bit(1, true) | ||
33 | wallcast.set_collision_mask_bit(3, true) | ||
34 | wallcast.collide_with_areas = true | ||
35 | $player/pivot/camera.add_child(wallcast) | ||
36 | |||
28 | # Override the YOU panel with the AP slot name. | 37 | # Override the YOU panel with the AP slot name. |
29 | if self.get_node_or_null("Panels/Color Arrow Room/Panel_you") != null: | 38 | if self.get_node_or_null("Panels/Color Arrow Room/Panel_you") != null: |
30 | self.get_node("Panels/Color Arrow Room/Panel_you").answer = apclient.ap_user | 39 | self.get_node("Panels/Color Arrow Room/Panel_you").answer = apclient.ap_user |