some few fixes that don't fix anything

This commit is contained in:
2026-04-13 16:34:23 +02:00
parent 1d856fd937
commit 4d10f4e9d7
11 changed files with 58 additions and 32 deletions

View File

@@ -16,7 +16,7 @@ public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior
return;
}
if (explosion.Instantiate() is not Explosion explosion1)
if (explosion.Instantiate() is not Explosion explo)
{
GD.Print("Cannot instantiate");
context.InstanceHandle.End();
@@ -31,10 +31,10 @@ public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior
GD.Print("EXPLOSION");
explosion1.Radius = 6f;
explo.Radius = 6f;
owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explosion1);
explosion1.CallDeferred(Node3D.MethodName.SetGlobalPosition, owner.GlobalPosition);
owner.GetTree().GetRoot().CallDeferred(Node.MethodName.AddChild, explo);
explo.CallDeferred(Node3D.MethodName.SetGlobalPosition, owner.GlobalPosition);
context.AbilityHandle.CommitAbility();
context.InstanceHandle.End();
@@ -45,15 +45,12 @@ public class ExplodingSwordBehavior(PackedScene explosion) : IAbilityBehavior
}
}
[Tool]
[GlobalClass]
public partial class ForgeExplodingSwordBehavior : ForgeAbilityBehavior
{
[Export] public PackedScene? Explosion { get; set; }
[Export] public PackedScene Explosion { get; set; }
public override IAbilityBehavior GetBehavior()
{
if (Explosion == null)
throw new System.ArgumentException("Explosion is null");
return new ExplodingSwordBehavior(Explosion);
}
}