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.
This commit is contained in:
SkyanUltra 2025-11-18 04:52:53 -05:00
parent 07e68d7bf7
commit 9fd858811f

View file

@ -114,7 +114,8 @@ func in_game() -> void:
func run_player_check(player: Player) -> void: func run_player_check(player: Player) -> void:
# guzlad: Added support for characters with a hitbox height below 1.0 to enter pipes underwater # guzlad: Added support for characters with a hitbox height below 1.0 to enter pipes underwater
if Global.player_action_pressed(get_input_direction(enter_direction), player.player_id) and (player.is_actually_on_floor() or enter_direction == 1): 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 can_enter = false
pipe_entered.emit() pipe_entered.emit()
DiscoLevel.can_meter_tick = false DiscoLevel.can_meter_tick = false