class_name Minigun extends "res://scenes/weapon/weapon.gd"

@onready var bullet = preload("res://scenes/bullet/bulletMinigun/bulletMinigun.tscn" )

func attack():
	if cooldownTimer.is_stopped():
		shoot.play()
		spawnBullet()
		cooldownTimer.start(cooldown)

func spawnBullet():
	var newBullet: Bullet = bullet.instantiate()
	newBullet.spawn(bulletPoint.global_position, get_parent().get_parent().rotation + getSpread(), damage, range, penetration)
	newBullet.fromTimeGhost = get_parent().get_parent().is_in_group("timeGhost")
	get_tree().get_first_node_in_group("bulletPool").add_child(newBullet)
