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.
This commit is contained in:
SkyanUltra 2025-11-17 21:24:19 -05:00
parent bc3a1087a1
commit 07e68d7bf7

View file

@ -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,7 @@ 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):
if 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