Bullet data overhaul

This commit is contained in:
Marco 2025-02-11 19:00:01 +01:00
commit 76221ca7a6
9 changed files with 57 additions and 26 deletions

View file

@ -426,7 +426,7 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
}
}
public void Hit(float damage)
public void Hit(float damage, DamageType type = DamageType.Neutral)
{
if (!_canMove) return;
GD.Print($"Player damaged for {damage}");
@ -446,10 +446,9 @@ public partial class PlayerMovement : CharacterBody2D, IDestructible
private void _on_damage_hit_box_area_entered(Area2D area)
{
if (!_canMove) return;
if (area is Bullet bullet)
if (area is Bullet bullet && bullet.BulletOwner != BulletOwner.Player)
{
GD.Print("Received damage manually");
this.Hit(bullet.Damage);
this.Hit(bullet.Damage, bullet.DamageType);
bullet.QueueFree();
}
}