extends Node
class_name BulletSpawnerController
# This script shoud be able to find the player 

var players: Dictionary = {}

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	pass

func _get_spawner() -> MultiplayerSpawner:
	return $MultiplayerSpawner
	
func _get_root() -> Node3D:
	return $Bullets

# -- TODO: Better bullet naming handler
var bullet_amount: int = -2147483647
func spawn_bullet(starting_point: Node3D, speed: int, damage: int):
	var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
	node.position = starting_point.global_position
	node.transform.basis = starting_point.global_transform.basis
	node.name = str(bullet_amount)
	node.speed = speed
	node.damage = damage
	bullet_amount += 1
	_get_root().add_child(node)
