From ed3247cd00cde86026379aebba200fee673cdba0 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 20 Sep 2024 16:15:56 -0400 Subject: Added speed boost mode --- Archipelago/effects.gd | 66 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 57 insertions(+), 9 deletions(-) (limited to 'Archipelago/effects.gd') 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 var slowness_remaining = 0 var iceland_remaining = 0 var atbash_remaining = 0 +var speed_boosts_remaining = 0 var queued_iceland = 0 var skip_available = false var puzzle_focused = false @@ -48,6 +49,12 @@ func _ready(): add_child(slowness_timer) slowness_timer.connect("timeout", self, "_tick_slowness") + var speed_boost_timer = Timer.new() + speed_boost_timer.name = "SpeedBoostTimer" + speed_boost_timer.wait_time = 1.0 + add_child(speed_boost_timer) + speed_boost_timer.connect("timeout", self, "_tick_speed_boost") + var iceland_timer = Timer.new() iceland_timer.name = "IcelandTimer" iceland_timer.wait_time = 1.0 @@ -63,6 +70,12 @@ func activate(): queued_iceland = 0 + var apclient = global.get_node("Archipelago") + if apclient._speed_boost_mode: + var player = get_tree().get_root().get_node("Spatial/player") + player.walk_speed = orig_walk / 2.0 + player.run_speed = orig_run / 2.0 + func trigger_slowness_trap(length = 30): if slowness_remaining == 0: @@ -79,6 +92,21 @@ func trigger_slowness_trap(length = 30): apclient.saveLocaldata() +func trigger_speed_boost(length = 20): + if speed_boosts_remaining == 0: + var player = get_tree().get_root().get_node("Spatial/player") + player.walk_speed = orig_walk + player.run_speed = orig_run + + $SpeedBoostTimer.start() + + speed_boosts_remaining += length + text_dirty = true + + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() + + func trigger_iceland_trap(length = 60): if not activated: queued_iceland += length @@ -99,7 +127,7 @@ func trigger_iceland_trap(length = 60): func trigger_atbash_trap(): - var newly_atbash = (atbash_remaining == 0) + var newly_atbash = atbash_remaining == 0 atbash_remaining += 1 if newly_atbash: @@ -121,7 +149,7 @@ func deactivate_atbash_trap(): apclient.evaluateSolvability() text_dirty = true - + var apclient = global.get_node("Archipelago") apclient.saveLocaldata() @@ -192,23 +220,37 @@ func _tick_slowness(): player.run_speed = orig_run $SlownessTimer.stop() - + if slowness_remaining % 5 == 0: var apclient = global.get_node("Archipelago") apclient.saveLocaldata() +func _tick_speed_boost(): + speed_boosts_remaining -= 1 + text_dirty = true + + if speed_boosts_remaining == 0: + var player = get_tree().get_root().get_node("Spatial/player") + player.walk_speed = orig_walk / 2.0 + player.run_speed = orig_run / 2.0 + + $SpeedBoostTimer.stop() + + if speed_boosts_remaining % 5 == 0: + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() + + func _tick_iceland(): iceland_remaining -= 1 text_dirty = true if iceland_remaining == 0: - get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment( - orig_env - ) + get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment(orig_env) $IcelandTimer.stop() - + if iceland_remaining % 5 == 0: var apclient = global.get_node("Archipelago") apclient.saveLocaldata() @@ -220,9 +262,11 @@ func _process(_delta): if wallcast.is_colliding(): var player = get_tree().get_root().get_node("Spatial/player") var puzzlecast = player.get_node("pivot/camera/RayCast_sight") - var distance = puzzlecast.get_collision_point().distance_to(wallcast.get_collision_point()) + var distance = puzzlecast.get_collision_point().distance_to( + wallcast.get_collision_point() + ) should_nbw = (distance < 0.05) - + if should_nbw != not_behind_wall: not_behind_wall = should_nbw text_dirty = true @@ -239,6 +283,10 @@ func _process(_delta): if not text.empty(): text += "\n" text += "Slowness: %d seconds" % slowness_remaining + if speed_boosts_remaining > 0: + if not text.empty(): + text += "\n" + text += "Speed Boost: %d seconds" % speed_boosts_remaining if iceland_remaining > 0: if not text.empty(): text += "\n" -- cgit 1.4.1