about summary refs log tree commit diff stats
path: root/Archipelago/effects.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Archipelago/effects.gd')
-rw-r--r--Archipelago/effects.gd66
1 files changed, 57 insertions, 9 deletions
diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index 1e2e311..341a783 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd
@@ -5,6 +5,7 @@ var effect_running = false
5var slowness_remaining = 0 5var slowness_remaining = 0
6var iceland_remaining = 0 6var iceland_remaining = 0
7var atbash_remaining = 0 7var atbash_remaining = 0
8var speed_boosts_remaining = 0
8var queued_iceland = 0 9var queued_iceland = 0
9var skip_available = false 10var skip_available = false
10var puzzle_focused = false 11var puzzle_focused = false
@@ -48,6 +49,12 @@ func _ready():
48 add_child(slowness_timer) 49 add_child(slowness_timer)
49 slowness_timer.connect("timeout", self, "_tick_slowness") 50 slowness_timer.connect("timeout", self, "_tick_slowness")
50 51
52 var speed_boost_timer = Timer.new()
53 speed_boost_timer.name = "SpeedBoostTimer"
54 speed_boost_timer.wait_time = 1.0
55 add_child(speed_boost_timer)
56 speed_boost_timer.connect("timeout", self, "_tick_speed_boost")
57
51 var iceland_timer = Timer.new() 58 var iceland_timer = Timer.new()
52 iceland_timer.name = "IcelandTimer" 59 iceland_timer.name = "IcelandTimer"
53 iceland_timer.wait_time = 1.0 60 iceland_timer.wait_time = 1.0
@@ -63,6 +70,12 @@ func activate():
63 70
64 queued_iceland = 0 71 queued_iceland = 0
65 72
73 var apclient = global.get_node("Archipelago")
74 if apclient._speed_boost_mode:
75 var player = get_tree().get_root().get_node("Spatial/player")
76 player.walk_speed = orig_walk / 2.0
77 player.run_speed = orig_run / 2.0
78
66 79
67func trigger_slowness_trap(length = 30): 80func trigger_slowness_trap(length = 30):
68 if slowness_remaining == 0: 81 if slowness_remaining == 0:
@@ -79,6 +92,21 @@ func trigger_slowness_trap(length = 30):
79 apclient.saveLocaldata() 92 apclient.saveLocaldata()
80 93
81 94
95func trigger_speed_boost(length = 20):
96 if speed_boosts_remaining == 0:
97 var player = get_tree().get_root().get_node("Spatial/player")
98 player.walk_speed = orig_walk
99 player.run_speed = orig_run
100
101 $SpeedBoostTimer.start()
102
103 speed_boosts_remaining += length
104 text_dirty = true
105
106 var apclient = global.get_node("Archipelago")
107 apclient.saveLocaldata()
108
109
82func trigger_iceland_trap(length = 60): 110func trigger_iceland_trap(length = 60):
83 if not activated: 111 if not activated:
84 queued_iceland += length 112 queued_iceland += length
@@ -99,7 +127,7 @@ func trigger_iceland_trap(length = 60):
99 127
100 128
101func trigger_atbash_trap(): 129func trigger_atbash_trap():
102 var newly_atbash = (atbash_remaining == 0) 130 var newly_atbash = atbash_remaining == 0
103 atbash_remaining += 1 131 atbash_remaining += 1
104 132
105 if newly_atbash: 133 if newly_atbash:
@@ -121,7 +149,7 @@ func deactivate_atbash_trap():
121 apclient.evaluateSolvability() 149 apclient.evaluateSolvability()
122 150
123 text_dirty = true 151 text_dirty = true
124 152
125 var apclient = global.get_node("Archipelago") 153 var apclient = global.get_node("Archipelago")
126 apclient.saveLocaldata() 154 apclient.saveLocaldata()
127 155
@@ -192,23 +220,37 @@ func _tick_slowness():
192 player.run_speed = orig_run 220 player.run_speed = orig_run
193 221
194 $SlownessTimer.stop() 222 $SlownessTimer.stop()
195 223
196 if slowness_remaining % 5 == 0: 224 if slowness_remaining % 5 == 0:
197 var apclient = global.get_node("Archipelago") 225 var apclient = global.get_node("Archipelago")
198 apclient.saveLocaldata() 226 apclient.saveLocaldata()
199 227
200 228
229func _tick_speed_boost():
230 speed_boosts_remaining -= 1
231 text_dirty = true
232
233 if speed_boosts_remaining == 0:
234 var player = get_tree().get_root().get_node("Spatial/player")
235 player.walk_speed = orig_walk / 2.0
236 player.run_speed = orig_run / 2.0
237
238 $SpeedBoostTimer.stop()
239
240 if speed_boosts_remaining % 5 == 0:
241 var apclient = global.get_node("Archipelago")
242 apclient.saveLocaldata()
243
244
201func _tick_iceland(): 245func _tick_iceland():
202 iceland_remaining -= 1 246 iceland_remaining -= 1
203 text_dirty = true 247 text_dirty = true
204 248
205 if iceland_remaining == 0: 249 if iceland_remaining == 0:
206 get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment( 250 get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment(orig_env)
207 orig_env
208 )
209 251
210 $IcelandTimer.stop() 252 $IcelandTimer.stop()
211 253
212 if iceland_remaining % 5 == 0: 254 if iceland_remaining % 5 == 0:
213 var apclient = global.get_node("Archipelago") 255 var apclient = global.get_node("Archipelago")
214 apclient.saveLocaldata() 256 apclient.saveLocaldata()
@@ -220,9 +262,11 @@ func _process(_delta):
220 if wallcast.is_colliding(): 262 if wallcast.is_colliding():
221 var player = get_tree().get_root().get_node("Spatial/player") 263 var player = get_tree().get_root().get_node("Spatial/player")
222 var puzzlecast = player.get_node("pivot/camera/RayCast_sight") 264 var puzzlecast = player.get_node("pivot/camera/RayCast_sight")
223 var distance = puzzlecast.get_collision_point().distance_to(wallcast.get_collision_point()) 265 var distance = puzzlecast.get_collision_point().distance_to(
266 wallcast.get_collision_point()
267 )
224 should_nbw = (distance < 0.05) 268 should_nbw = (distance < 0.05)
225 269
226 if should_nbw != not_behind_wall: 270 if should_nbw != not_behind_wall:
227 not_behind_wall = should_nbw 271 not_behind_wall = should_nbw
228 text_dirty = true 272 text_dirty = true
@@ -239,6 +283,10 @@ func _process(_delta):
239 if not text.empty(): 283 if not text.empty():
240 text += "\n" 284 text += "\n"
241 text += "Slowness: %d seconds" % slowness_remaining 285 text += "Slowness: %d seconds" % slowness_remaining
286 if speed_boosts_remaining > 0:
287 if not text.empty():
288 text += "\n"
289 text += "Speed Boost: %d seconds" % speed_boosts_remaining
242 if iceland_remaining > 0: 290 if iceland_remaining > 0:
243 if not text.empty(): 291 if not text.empty():
244 text += "\n" 292 text += "\n"