extended enemy dashthrough improvement to aimed dash behaviour
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Test (push) Successful in 7m24s
Create tag and build when new code gets to main / Export (push) Successful in 9m32s

This commit is contained in:
2026-02-06 12:10:21 +01:00
parent e87a228dd2
commit 6d967bf2bf

View File

@@ -1782,20 +1782,32 @@ public partial class PlayerController : CharacterBody3D,
// feet of the capsule
var correction = DashSystem.CollisionNormal == Vector3.Down ? _playerHeight : DashSystem.DashCastRadius;
var correctedLocation = DashSystem.PlannedLocation + Vector3.Down * correction;
var travel = correctedLocation - GlobalPosition;
_dashDirection = travel.Normalized();
var shouldRebound = false;
if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable)
correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint);
{
var plannedDashLocation = targetable.GetTargetGlobalPosition() + Vector3.Down*_playerHeight/2;
travel = plannedDashLocation - GlobalPosition;
_dashDirection = travel.Normalized();
var postDashLocation = plannedDashLocation + _dashDirection;
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
shouldRebound = wallBehindResult.Count > 0;
correctedLocation = shouldRebound ? plannedDashLocation : postDashLocation;
}
// Start invincibility timer for the duration of the dash and a bit more afterwards
OnHitInvincibility();
_preDashVelocity = Velocity;
_dashDirection = (correctedLocation - GlobalPosition).Normalized();
SetupDashDamageDetector(correctedLocation);
var dashTween = CreatePositionTween(correctedLocation, AimedDashTime);
// dashTween.TweenMethod(Callable.From<float>(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime);
dashTween.Finished += AimedDashTweenEnded;
if (shouldRebound) dashTween.Finished += ManualKnockback;
_customMantle = DashSystem.ShouldMantle;
_customMantleCurve = DashSystem.MantleSystem.MantleCurve;
@@ -2112,7 +2124,7 @@ public partial class PlayerController : CharacterBody3D,
var travel = plannedDashLocation - GlobalPosition;
_dashDirection = travel.Normalized();
var postDashLocation = plannedDashLocation + 0.5f*travel;
var postDashLocation = plannedDashLocation + _dashDirection;
var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask);
var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery);
var shouldRebound = wallBehindResult.Count > 0;
@@ -2122,6 +2134,7 @@ public partial class PlayerController : CharacterBody3D,
if (isParry || shouldRebound) dashTween.Finished += OnDashParryEnded;
else dashTween.Finished += OnDashAttackEnded;
}
public void OnDashAttackStarted()
{
StartDashAction(isParry: false);
@@ -2156,6 +2169,11 @@ public partial class PlayerController : CharacterBody3D,
public void OnDashParryEnded()
{
StopDashAction();
ManualKnockback();
}
public void ManualKnockback()
{
Velocity = -_dashDirection*RKnockback.Modifier;
}