knockback forge implemented

This commit is contained in:
2026-05-04 16:22:30 +02:00
parent b2b7baffe8
commit a139990390
21 changed files with 194 additions and 70 deletions

View File

@@ -26,6 +26,7 @@ using Movementtests.interfaces;
using Movementtests.systems;
using Movementtests.player_controller.Scripts;
using Movementtests.managers;
using Movementtests.scenes.components.knockback;
using Movementtests.tools;
using Movementtests.tools.calculators;
using RustyOptions;
@@ -150,7 +151,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
public float AimAssistReductionStartDistance { get; set; } = 10f;
[ExportGroup("Damage")] [Export] public RDamage RDamage { get; set; } = null!;
[Export] public RKnockback? RKnockback { get; set; } = null!;
[Export] public RKnockback? RKnockback { get; set; }
[ExportGroup("Targeting")]
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
@@ -2555,7 +2556,7 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
public void ManualKnockback()
{
Velocity = -_dashDirection*RKnockback.Modifier;
Velocity = -_dashDirection*RKnockback!.Modifier;
}
public static Vector3 ComputePositionAfterTargetedDash(Vector3 targetLocation, Vector3 targetHitLocation)
@@ -2625,14 +2626,13 @@ public partial class PlayerController : CharacterBody3D, IForgeEntity, ICueHandl
if (_hitAbilityHandle is null) return;
if (!_hitAbilityHandle.CanActivate(out _)) return;
foreach (var entity in _hitEnemies)
{
// TODO: WTF why doesn't health move
// GD.Print(entity.Attributes["EnemyAttributeSet.Health"].CurrentValue);
_hitAbilityHandle.Activate(out _, entity);
_hitAbilityHandle.Activate(out var flags, entity);
}
_hitEnemies.Clear();
_hitAbilityHandle.Cancel();
HeadSystem.OnHitTarget();
_audioStream.SwitchToClipByName("hits");