fucked up

This commit is contained in:
2025-09-09 16:09:59 +02:00
parent 5087cb58bc
commit f4d5a02e42
2 changed files with 45 additions and 30 deletions

View File

@ -393,7 +393,6 @@ initial_state = NodePath("Grounded")
[node name="Reset" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("41_ruloh")
deep = true
default_state = NodePath("../Grounded")
[node name="OnFall" type="Node" parent="StateChart/Root/Movement"]
@ -429,28 +428,6 @@ to = NodePath("../../Grounded")
event = &"grounded"
delay_in_seconds = "0.0"
[node name="Dashing" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("26_infe6")
initial_state = NodePath("Dash")
[node name="OnDashEnded" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Airborne/Reset")
event = &"dash_finished"
delay_in_seconds = "0.0"
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Mantling")
event = &"mantle"
delay_in_seconds = "0.0"
[node name="Dash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="PoweredDash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("26_infe6")
initial_state = NodePath("SimpleJump")
@ -494,6 +471,28 @@ to = NodePath("../../../Airborne/Falling")
event = &"jump_ended"
delay_in_seconds = "0.0"
[node name="Dashing" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("26_infe6")
initial_state = NodePath("Dash")
[node name="OnDashEnded" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Airborne/Reset")
event = &"dash_finished"
delay_in_seconds = "0.0"
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("28_n7qhm")
to = NodePath("../../Mantling")
event = &"mantle"
delay_in_seconds = "0.0"
[node name="Dash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="PoweredDash" type="Node" parent="StateChart/Root/Movement/Dashing"]
script = ExtResource("27_34snm")
[node name="Grounded" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("27_34snm")

View File

@ -49,6 +49,8 @@ public partial class PlayerController : CharacterBody3D
private float _inputRotateY;
private float _inputRotateFloorplane;
private int _framesSinceJumpAtApex = 0;
// Timers
private Timer _timeScaleAimInAirTimer;
private Timer _simpleDashCooldownTimer;
@ -325,6 +327,7 @@ public partial class PlayerController : CharacterBody3D
_grounded.StateEntered += OnGrounded;
_grounded.StatePhysicsProcessing += HandleGrounded;
_airborne.StateEntered += OnAirborne;
_airborne.StatePhysicsProcessing += HandleAirborne;
_coyoteEnabled.StateEntered += StartCoyoteTime;
@ -365,6 +368,8 @@ public partial class PlayerController : CharacterBody3D
_onMegajumpFromWall.Taken += OnMegajumpFromWall;
}
private bool _canDashAirborne = true;
public void OnWallDetected()
{
FinishPoweredDash();
@ -373,9 +378,15 @@ public partial class PlayerController : CharacterBody3D
public void OnGrounded()
{
_isWallJumpAvailable = true;
_canDashAirborne = true;
if (_simpleDashCooldownTimer.IsStopped())
_simpleDashCooldownTimer.Start();
}
public void OnAirborne()
{
}
public void DashCooldownTimeout()
{
_canDash = true;
@ -409,8 +420,6 @@ public partial class PlayerController : CharacterBody3D
}
// Jump
private int _framesSinceJumpAtApex = 0;
public void OnInputJumpStarted()
{
if (CanMantle())
@ -664,6 +673,8 @@ public partial class PlayerController : CharacterBody3D
_playerState.SendEvent("empower_released");
}
private bool _dashAvailable = true;
public void OnInputDashPressed()
{
if (_empowerOn.Active && CanPerformEmpoweredAction())
@ -672,6 +683,14 @@ public partial class PlayerController : CharacterBody3D
_playerState.SendEvent("powered_dash");
return;
}
if (_airborne.Active)
{
if (!_canDashAirborne)
return;
_canDashAirborne = false;
}
_playerState.SendEvent("dash");
}
@ -771,8 +790,6 @@ public partial class PlayerController : CharacterBody3D
{
var effectiveJumpDirection = jumpDirection ?? Vector3.Up;
var jumpVector = (effectiveJumpDirection.Normalized() + Vector3.Up).Normalized();
if (jumpType == JumpTypes.DoubleJump)
_canDash = false;
bool doesCapsuleHaveCrouchingHeight = CapsuleCollider.IsCrouchingHeight();
bool isPlayerDead = HealthSystem.IsDead();
@ -943,7 +960,6 @@ public partial class PlayerController : CharacterBody3D
DashSystem.PrepareDash();
}
///////////////////////////
// Stateless logic ////////
///////////////////////////