fixed a few issues
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 30s
Create tag and build when new code gets to main / Export (push) Successful in 6m0s

This commit is contained in:
2026-05-06 16:25:56 +02:00
parent bcc748ca6b
commit 7ba4a3db3f
22 changed files with 133 additions and 660 deletions

View File

@@ -26,7 +26,6 @@ public partial class Enemy : CharacterBody3D,
ISpawnable,
IKnockbackable,
ITargetable,
IStunnable,
IForgeEntity
{
public override void _Notification(int what) => this.Notify(what);
@@ -166,7 +165,7 @@ public partial class Enemy : CharacterBody3D,
public void ProcessGameplay(double delta)
{
if (IsStunned || _hitAbilityHandle == null) return;
if (_hitAbilityHandle == null) return;
var bodies = DamageBox.GetOverlappingBodies();
foreach (var body in bodies)
@@ -186,16 +185,16 @@ public partial class Enemy : CharacterBody3D,
public void OnDamageReceived(EventData<DamageDone> data)
{
var source = data.Source as Node;
var sourceName = source?.Name ?? "unknown damage dealer";
GD.Print($"Ouch! Fuck you {sourceName}!");
if (data.Payload.OverkillDamage > 0) GD.Print($"Overkill! {data.Payload.OverkillDamage} damage");
// var source = data.Source as Node;
// var sourceName = source?.Name ?? "unknown damage dealer";
// GD.Print($"Ouch! Fuck you {sourceName}!");
// if (data.Payload.OverkillDamage > 0) GD.Print($"Overkill! {data.Payload.OverkillDamage} damage");
}
private void OnHealthChanged(EntityAttribute healthAttribute, int i)
{
if (healthAttribute.CurrentValue > healthAttribute.Min) return;
Events.Raise(new EventData
{
EventTags = Tag.RequestTag(TagsManager, "events.combat.death").GetSingleTagContainer()!
@@ -213,13 +212,11 @@ public partial class Enemy : CharacterBody3D,
// Remove weapon that might be planted there
foreach (var child in GetChildren())
{
if (child is WeaponSystem system)
{
CallDeferred(Node.MethodName.RemoveChild, system);
GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, system);
system.CallDeferred(Node3D.MethodName.SetGlobalPosition, GlobalPosition + Vector3.Up*EnemyHeight);
system.CallDeferred(WeaponSystem.MethodName.RethrowWeapon);
}
if (child is not WeaponSystem system) continue;
CallDeferred(Node.MethodName.RemoveChild, system);
GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, system);
system.CallDeferred(Node3D.MethodName.SetGlobalPosition, GlobalPosition + Vector3.Up*EnemyHeight);
system.CallDeferred(WeaponSystem.MethodName.RethrowWeapon);
}
foreach (var killable in DeathEffects.ToIKillables())
@@ -243,19 +240,4 @@ public partial class Enemy : CharacterBody3D,
{
return TargetComponent.GlobalPosition;
}
// Stun management
public bool IsStunned { get; set; }
[Export(PropertyHint.Range, "0.1, 2, 0.1, or_greater")]
public float StunDuration { get; set; } = 1f;
public void Stun()
{
IsStunned = true;
GetTree().CreateTimer(StunDuration).Timeout += Unstun;
}
public void Unstun()
{
IsStunned = false;
}
}