Reworked projectile deletion. Reworked railgun piercing

This commit is contained in:
2025-11-12 22:42:15 +03:00
parent 6d5bae3a64
commit aca8cb7b4f
3 changed files with 16 additions and 6 deletions
+5 -5
View File
@@ -10,7 +10,6 @@ const ENEMY_PROJECTILE_LAYER = 16
@export var damage : AbstractDamage
@export_range(0, 1000) var speed : int = 0
@export_range(0, 10) var piercing: int = 0
@onready var collision : CollisionShape2D = $CollisionShape2D
@@ -72,7 +71,8 @@ func _on_body_entered(body: Node2D) -> void:
var health_component : Health = body.find_child("Health")
if health_component and health_component.has_method("apply_damage"):
health_component.apply_damage(damage)
if piercing == 0:
queue_free()
else:
piercing -= 1
_process_hit_for_projectile()
func _process_hit_for_projectile() -> void:
queue_free()