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/client.gd | 15 +++++++++++- Archipelago/effects.gd | 66 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 71 insertions(+), 10 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 3973f0e..6621194 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -104,6 +104,7 @@ var _pilgrimage_allows_roof_access = false var _pilgrimage_allows_paintings = false var _sunwarp_shuffle = false var _sunwarp_mapping = [] +var _speed_boost_mode = false var _slot_seed = 0 var _map_loaded = false @@ -117,6 +118,7 @@ var _puzzle_skips = 0 var _cached_slowness = 0 var _cached_iceland = 0 var _cached_atbash = 0 +var _cached_speed_boosts = 0 var _geronimo_skip = false var _checked_paintings = [] @@ -330,6 +332,10 @@ func _on_data(): _sunwarp_shuffle = false if _slot_data.has("sunwarp_permutation"): _sunwarp_mapping = _slot_data["sunwarp_permutation"] + if _slot_data.has("speed_boost_mode"): + _speed_boost_mode = _slot_data["speed_boost_mode"] + else: + _speed_boost_mode = false if ( _location_classification_bit != kCLASSIFICATION_LOCAL_INSANITY @@ -348,6 +354,7 @@ func _on_data(): _cached_slowness = 0 _cached_iceland = 0 _cached_atbash = 0 + _cached_speed_boosts = 0 _geronimo_skip = false _localdata_file = "user://archipelago_data/%s_%d" % [_seed, _slot] @@ -379,6 +386,9 @@ func _on_data(): if localdata.size() > 5: _geronimo_skip = localdata[5] + if localdata.size() > 6: + _cached_speed_boosts = localdata[6] + requestSync() sendMessage( @@ -568,7 +578,8 @@ func saveLocaldata(): effects_node.slowness_remaining, effects_node.iceland_remaining, effects_node.atbash_remaining, - _geronimo_skip + _geronimo_skip, + effects_node.speed_boosts_remaining, ] file.store_var(data, true) file.close() @@ -800,6 +811,8 @@ func processItem(item, index, from, flags): effects_node.trigger_iceland_trap() if item_name == "Atbash Trap": effects_node.trigger_atbash_trap() + if item_name == "Speed Boost": + effects_node.trigger_speed_boost() if item_name == "Puzzle Skip": _puzzle_skips += 1 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