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') 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