From f696286fdab96ccfc2bb4bddd8cc0ceda87309db Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 23 Jan 2024 15:16:37 -0500 Subject: Effects text is more prompt now Slowness and Iceland aren't forced to tick at the same time anymore. Puzzle skip popups show up instantly and disappear instantly. Puzzle skip popups do not show up for puzzles hidden behind walls (although you can still press p to skip). --- Archipelago/effects.gd | 112 ++++++++++++++++++++++++++++++------------------- 1 file changed, 70 insertions(+), 42 deletions(-) (limited to 'Archipelago/effects.gd') 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 var skip_available = false var puzzle_focused = false var solve_mode = false +var not_behind_wall = false var puzzle_to_skip = "" +var text_dirty = true var orig_env var orig_walk var orig_run +var wallcast func _ready(): @@ -21,6 +24,8 @@ func _ready(): orig_walk = get_tree().get_root().get_node("Spatial/player").walk_speed orig_run = get_tree().get_root().get_node("Spatial/player").run_speed + wallcast = get_tree().get_root().get_node("Spatial/player/pivot/camera/wallcast") + var label = Label.new() label.set_name("label") label.margin_right = 1920.0 - 20.0 @@ -37,6 +42,18 @@ func _ready(): add_child(label) + var slowness_timer = Timer.new() + slowness_timer.name = "SlownessTimer" + slowness_timer.wait_time = 1.0 + add_child(slowness_timer) + slowness_timer.connect("timeout", self, "_tick_slowness") + + var iceland_timer = Timer.new() + iceland_timer.name = "IcelandTimer" + iceland_timer.wait_time = 1.0 + add_child(iceland_timer) + iceland_timer.connect("timeout", self, "_tick_iceland") + func activate(): activated = true @@ -53,10 +70,10 @@ func trigger_slowness_trap(): player.walk_speed = orig_walk / 2.0 player.run_speed = orig_run / 2.0 - slowness_remaining += 30 + $SlownessTimer.start() - if not effect_running: - _process_effects() + slowness_remaining += 30 + text_dirty = true func trigger_iceland_trap(): @@ -69,10 +86,10 @@ func trigger_iceland_trap(): load("res://environments/level_iceland.tres") ) - iceland_remaining += 60 + $IcelandTimer.start() - if not effect_running: - _process_effects() + iceland_remaining += 60 + text_dirty = true func trigger_atbash_trap(): @@ -82,8 +99,7 @@ func trigger_atbash_trap(): var apclient = global.get_node("Archipelago") apclient.evaluateSolvability() - if not effect_running: - _process_effects() + text_dirty = true func deactivate_atbash_trap(): @@ -93,6 +109,8 @@ func deactivate_atbash_trap(): var apclient = global.get_node("Archipelago") apclient.evaluateSolvability() + text_dirty = true + func show_puzzle_skip_message(node_path): var panel_input = get_tree().get_root().get_node(node_path) @@ -106,12 +124,15 @@ func show_puzzle_skip_message(node_path): return puzzle_focused = true + wallcast.enabled = true + not_behind_wall = false puzzle_to_skip = node_path _evaluate_puzzle_skip() func hide_puzzle_skip_message(): puzzle_focused = false + wallcast.enabled = false _evaluate_puzzle_skip() @@ -136,26 +157,49 @@ func skip_puzzle(): func _evaluate_puzzle_skip(): if puzzle_focused and not solve_mode: skip_available = true - - if not effect_running: - _process_effects() else: skip_available = false + text_dirty = true + +func _tick_slowness(): + slowness_remaining -= 1 + text_dirty = true + + if slowness_remaining == 0: + var player = get_tree().get_root().get_node("Spatial/player") + player.walk_speed = orig_walk + player.run_speed = orig_run + + $SlownessTimer.stop() + + +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 + ) -func _process_effects(): - effect_running = true + $IcelandTimer.stop() + + +func _process(_delta): + if puzzle_focused: + if wallcast.is_colliding(): + var should_nbw = (get_tree().get_root().get_node("Spatial/player")._get_panel_from_ray(wallcast) != null) + if should_nbw != not_behind_wall: + not_behind_wall = true + text_dirty = true + + if text_dirty: + text_dirty = false - while slowness_remaining > 0 or iceland_remaining > 0 or atbash_activated or skip_available: var text = "" if atbash_activated: text += "Atbash Trap lasts until you solve a puzzle" - if skip_available: - var apclient = global.get_node("Archipelago") - if apclient.getAvailablePuzzleSkips() > 0: - if not text.empty(): - text += "\n" - text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips() if slowness_remaining > 0: if not text.empty(): text += "\n" @@ -164,26 +208,10 @@ func _process_effects(): if not text.empty(): text += "\n" text += "Iceland: %d seconds" % iceland_remaining + if skip_available and not_behind_wall: + var apclient = global.get_node("Archipelago") + if apclient.getAvailablePuzzleSkips() > 0: + if not text.empty(): + text += "\n" + text += "Press P to skip puzzle (%d available)" % apclient.getAvailablePuzzleSkips() self.get_node("label").text = text - - yield(get_tree().create_timer(1.0), "timeout") - - if !get_tree().paused: - if slowness_remaining > 0: - slowness_remaining -= 1 - - if slowness_remaining == 0: - var player = get_tree().get_root().get_node("Spatial/player") - player.walk_speed = orig_walk - player.run_speed = orig_run - - if iceland_remaining > 0: - iceland_remaining -= 1 - - if iceland_remaining == 0: - get_tree().get_root().get_node("Spatial/player/pivot/camera").set_environment( - orig_env - ) - - self.get_node("label").text = "" - effect_running = false -- cgit 1.4.1 From f1fdf947e95761136b8abafe630fb1ba61ae3129 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 4 Feb 2024 13:15:35 -0500 Subject: More accurate wall snipe detection --- Archipelago/effects.gd | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'Archipelago/effects.gd') diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index e830fbc..7d9df35 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -113,6 +113,9 @@ func deactivate_atbash_trap(): func show_puzzle_skip_message(node_path): + if puzzle_focused and node_path != puzzle_to_skip: + hide_puzzle_skip_message() + var panel_input = get_tree().get_root().get_node(node_path) if not panel_input.visible: return @@ -126,6 +129,7 @@ func show_puzzle_skip_message(node_path): puzzle_focused = true wallcast.enabled = true not_behind_wall = false + text_dirty = true puzzle_to_skip = node_path _evaluate_puzzle_skip() @@ -133,6 +137,8 @@ func show_puzzle_skip_message(node_path): func hide_puzzle_skip_message(): puzzle_focused = false wallcast.enabled = false + not_behind_wall = false + text_dirty = true _evaluate_puzzle_skip() @@ -188,11 +194,16 @@ func _tick_iceland(): func _process(_delta): if puzzle_focused: + var should_nbw = false if wallcast.is_colliding(): - var should_nbw = (get_tree().get_root().get_node("Spatial/player")._get_panel_from_ray(wallcast) != null) - if should_nbw != not_behind_wall: - not_behind_wall = true - text_dirty = true + 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()) + should_nbw = (distance < 0.05) + + if should_nbw != not_behind_wall: + not_behind_wall = should_nbw + text_dirty = true if text_dirty: text_dirty = false -- cgit 1.4.1 From 8175ffdc895392764613a8bb6c738c49926d5773 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 4 Feb 2024 13:22:18 -0500 Subject: Atbash Trap now stacks --- Archipelago/effects.gd | 22 +++++++++++++--------- Archipelago/panel.gd | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'Archipelago/effects.gd') diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index 7d9df35..e6d2dcd 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -4,7 +4,7 @@ var activated = false var effect_running = false var slowness_remaining = 0 var iceland_remaining = 0 -var atbash_activated = false +var atbash_remaining = 0 var queued_iceland = 0 var skip_available = false var puzzle_focused = false @@ -93,21 +93,23 @@ func trigger_iceland_trap(): func trigger_atbash_trap(): - if not atbash_activated: - atbash_activated = true + var newly_atbash = (atbash_remaining == 0) + atbash_remaining += 1 + if newly_atbash: var apclient = global.get_node("Archipelago") apclient.evaluateSolvability() - text_dirty = true + text_dirty = true func deactivate_atbash_trap(): - if atbash_activated: - atbash_activated = false + if atbash_remaining > 0: + atbash_remaining -= 1 - var apclient = global.get_node("Archipelago") - apclient.evaluateSolvability() + if atbash_remaining == 0: + var apclient = global.get_node("Archipelago") + apclient.evaluateSolvability() text_dirty = true @@ -209,8 +211,10 @@ func _process(_delta): text_dirty = false var text = "" - if atbash_activated: + if atbash_remaining == 1: text += "Atbash Trap lasts until you solve a puzzle" + if atbash_remaining > 1: + text += ("Atbash Trap lasts until you solve %d puzzles" % atbash_remaining) if slowness_remaining > 0: if not text.empty(): text += "\n" diff --git a/Archipelago/panel.gd b/Archipelago/panel.gd index da5b572..aec18e8 100644 --- a/Archipelago/panel.gd +++ b/Archipelago/panel.gd @@ -46,7 +46,7 @@ func evaluate_solvability(): solvable = false if solvable: - if effects.atbash_activated: + if effects.atbash_remaining > 0: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = atbash_text else: self.get_parent().get_node("Viewport/GUI/Panel/Label").text = orig_text -- cgit 1.4.1 From 72bb06c42fcab5c215ff034e8445c33057e0c23d Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 4 Feb 2024 13:49:06 -0500 Subject: Persist traps between connections --- Archipelago/client.gd | 28 +++++++++++++++++++++++++++- Archipelago/effects.gd | 34 +++++++++++++++++++++++++++------- Archipelago/load.gd | 9 +++++++++ 3 files changed, 63 insertions(+), 8 deletions(-) (limited to 'Archipelago/effects.gd') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index 788f6ca..3a2a783 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -112,6 +112,9 @@ var _progressive_progress = {} var _has_colors = ["white"] var _received_indexes = [] var _puzzle_skips = 0 +var _cached_slowness = 0 +var _cached_iceland = 0 +var _cached_atbash = 0 signal could_not_connect signal connect_status @@ -297,6 +300,21 @@ func _on_data(): if localdata.size() > 1: _puzzle_skips = localdata[1] + + if localdata.size() > 2: + _cached_slowness = localdata[2] + else: + _cached_slowness = 0 + + if localdata.size() > 3: + _cached_iceland = localdata[3] + else: + _cached_iceland = 0 + + if localdata.size() > 4: + _cached_atbash = localdata[4] + else: + _cached_atbash = 0 requestSync() @@ -450,7 +468,15 @@ func saveLocaldata(): var file = File.new() file.open(_localdata_file, File.WRITE) - var data = [_last_new_item, _puzzle_skips] + var effects_node = get_tree().get_root().get_node("Spatial/AP_Effects") + + var data = [ + _last_new_item, + _puzzle_skips, + effects_node.slowness_remaining, + effects_node.iceland_remaining, + effects_node.atbash_remaining + ] file.store_var(data, true) file.close() diff --git a/Archipelago/effects.gd b/Archipelago/effects.gd index e6d2dcd..1e2e311 100644 --- a/Archipelago/effects.gd +++ b/Archipelago/effects.gd @@ -58,13 +58,13 @@ func _ready(): func activate(): activated = true - for _i in range(0, queued_iceland): - trigger_iceland_trap() + if queued_iceland > 0: + trigger_iceland_trap(queued_iceland) queued_iceland = 0 -func trigger_slowness_trap(): +func trigger_slowness_trap(length = 30): if slowness_remaining == 0: var player = get_tree().get_root().get_node("Spatial/player") player.walk_speed = orig_walk / 2.0 @@ -72,13 +72,16 @@ func trigger_slowness_trap(): $SlownessTimer.start() - slowness_remaining += 30 + slowness_remaining += length text_dirty = true + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() -func trigger_iceland_trap(): + +func trigger_iceland_trap(length = 60): if not activated: - queued_iceland += 1 + queued_iceland += length return if iceland_remaining == 0: @@ -88,9 +91,12 @@ func trigger_iceland_trap(): $IcelandTimer.start() - iceland_remaining += 60 + iceland_remaining += length text_dirty = true + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() + func trigger_atbash_trap(): var newly_atbash = (atbash_remaining == 0) @@ -102,6 +108,9 @@ func trigger_atbash_trap(): text_dirty = true + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() + func deactivate_atbash_trap(): if atbash_remaining > 0: @@ -112,6 +121,9 @@ func deactivate_atbash_trap(): apclient.evaluateSolvability() text_dirty = true + + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() func show_puzzle_skip_message(node_path): @@ -180,6 +192,10 @@ 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_iceland(): @@ -192,6 +208,10 @@ func _tick_iceland(): ) $IcelandTimer.stop() + + if iceland_remaining % 5 == 0: + var apclient = global.get_node("Archipelago") + apclient.saveLocaldata() func _process(_delta): diff --git a/Archipelago/load.gd b/Archipelago/load.gd index 7f86c91..a277817 100644 --- a/Archipelago/load.gd +++ b/Archipelago/load.gd @@ -565,6 +565,15 @@ func _load(): global._print("Hooked Load End") ._load() + # Activate any cached traps. + if apclient._cached_slowness > 0: + effects.trigger_slowness_trap(apclient._cached_slowness) + if apclient._cached_iceland > 0: + effects.trigger_iceland_trap(apclient._cached_iceland) + if apclient._cached_atbash > 0: + for _i in range(0, apclient._cached_atbash): + effects.trigger_atbash_trap() + # Process any items received while the map was loading, and send the checks # from the save load. apclient.mapFinishedLoading() -- cgit 1.4.1