From a681fed56d74dfdbcadea64d498a0b92b18e28c7 Mon Sep 17 00:00:00 2001 From: SkyanUltra Date: Sat, 22 Nov 2025 11:32:59 -0500 Subject: [PATCH] Fix sideways pipe hitbox collision (#730) * Fixed sideways pipe hitbox collision This fixes a bug where players would clip the top edge of a sideways pipe's hitbox and get counted as being on the floor despite being above the pipe, thus allowing them to get warped into the pipe from there. * Fix to prevent entering pipes from too low this implements a simple distance check from the player to the hitbox to ensure the player can only ever enter the pipe when they're close enough in proximity to the pipe, preventing them from entering from a tile too low. * co mnment :earnest: --- Scripts/Classes/Entities/PipeArea.gd | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Scripts/Classes/Entities/PipeArea.gd b/Scripts/Classes/Entities/PipeArea.gd index bcac720..cb475a7 100644 --- a/Scripts/Classes/Entities/PipeArea.gd +++ b/Scripts/Classes/Entities/PipeArea.gd @@ -43,10 +43,13 @@ func run_pipe_check() -> void: exit_pipe() func _physics_process(_delta: float) -> void: + # SkyanUltra: Adjusted logic to offset pipe hitbox rather than stretching it, + # as it allowed characters to clip the edge of the pipe and get counted as + # grounded, getting warped into pipes from above. if enter_direction >= 2: - $Hitbox.scale.y = 8 + $Hitbox.position.y = 14 else: - $Hitbox.scale.y = 1 + $Hitbox.position.y = 0 if Engine.is_editor_hint() == false: in_game() @@ -111,8 +114,9 @@ func in_game() -> void: func run_player_check(player: Player) -> void: # guzlad: Added support for characters with a hitbox height below 1.0 to enter pipes underwater - print(player.is_actually_on_floor()) - if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and (player.is_on_floor() or enter_direction == 1): + # SkyanUltra: Added distance check to prevent entering pipes from too low. + var distance = player.global_position.distance_to(hitbox.global_position) + if distance <= 6 and Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and (player.is_actually_on_floor() or enter_direction == 1): can_enter = false pipe_entered.emit() DiscoLevel.can_meter_tick = false