fix: leaving wall stops wall hugging

This commit is contained in:
2025-06-10 16:53:09 +02:00
parent f00def5e6e
commit d53aca98a0
5 changed files with 22 additions and 1 deletions

2
.gitignore vendored
View File

@ -9,5 +9,7 @@
# Godot-specific ignores
.import/
/builds
# Imported translations (automatically generated from CSV files)
*.translation

View File

@ -58,7 +58,7 @@ custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="./Movement tests.exe"
export_path="builds/Movement tests.exe"
patches=PackedStringArray()
encryption_include_filters=""
encryption_exclude_filters=""

View File

@ -330,6 +330,12 @@ to = NodePath("../../JumpFromWall")
event = &"jump"
delay_in_seconds = "0.0"
[node name="OnLeaveWall" type="Node" parent="StateChart/Root/Movement/Airborne/WallHugging"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Falling")
event = &"start_falling"
delay_in_seconds = "0.0"
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
script = ExtResource("27_34snm")

View File

@ -181,6 +181,8 @@ public partial class PlayerController : CharacterBody3D
_grounded.StatePhysicsProcessing += HandleGrounded;
_airborne.StatePhysicsProcessing += HandleAirborne;
_wallHugging.StatePhysicsProcessing += HandleWallHugging;
_coyoteEnabled.StateEntered += StartCoyoteTime;
_coyoteTimer.Timeout += CoyoteExpired;
_jump.StateEntered += Jump;
@ -383,6 +385,12 @@ public partial class PlayerController : CharacterBody3D
_playerState.SendEvent("wall_hug");
}
public void HandleWallHugging(float delta)
{
if (!WallHugSystem.IsWallHugging())
_playerState.SendEvent("start_falling");
}
///////////////////////////
// Stateless logic ////////
///////////////////////////

View File

@ -23,6 +23,11 @@ config/icon="res://icon.svg"
GUIDE="*res://addons/guide/guide.gd"
[display]
window/size/viewport_width=1980
window/size/viewport_height=1080
[dotnet]
project/assembly_name="Movement tests"