19 lines
619 B
GDScript
19 lines
619 B
GDScript
extends Area3D
|
|
class_name Spawner
|
|
|
|
@onready var mp_spawner: MultiplayerSpawner = $MultiplayerSpawner
|
|
@export var disabled: bool = false
|
|
|
|
# This spawner will register itself with the GameManager when it enters the scene.
|
|
func _ready():
|
|
# super()
|
|
# We wait one frame to ensure singletons are ready.
|
|
await get_tree().process_frame
|
|
GameManager.register_spawner(self)
|
|
|
|
func can_spawn() -> bool:
|
|
return false if disabled else get_overlapping_bodies().is_empty()
|
|
|
|
# We can add properties to the spawner later, like which faction it belongs to,
|
|
# or a reference to the body it's orbiting for initial velocity calculation.
|