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"] [node name="Reset" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("41_ruloh") script = ExtResource("41_ruloh")
deep = true
default_state = NodePath("../Grounded") default_state = NodePath("../Grounded")
[node name="OnFall" type="Node" parent="StateChart/Root/Movement"] [node name="OnFall" type="Node" parent="StateChart/Root/Movement"]
@ -429,28 +428,6 @@ to = NodePath("../../Grounded")
event = &"grounded" event = &"grounded"
delay_in_seconds = "0.0" 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"] [node name="Jump" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("26_infe6") script = ExtResource("26_infe6")
initial_state = NodePath("SimpleJump") initial_state = NodePath("SimpleJump")
@ -494,6 +471,28 @@ to = NodePath("../../../Airborne/Falling")
event = &"jump_ended" event = &"jump_ended"
delay_in_seconds = "0.0" 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"] [node name="Grounded" type="Node" parent="StateChart/Root/Movement"]
script = ExtResource("27_34snm") script = ExtResource("27_34snm")

View File

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