2026-10-21 01:42:31 -05:00
|
|
|
class_name Spawner extends Area3D
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@export var faction: Globals.Faction = Globals.Faction.NEUTRAL
|
|
|
|
|
|
|
|
|
|
var is_available: bool = true
|
|
|
|
|
var delay_timer: Timer = null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-10-25 15:03:59 -05:00
|
|
|
_debug_setup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _debug_setup() -> void:
|
|
|
|
|
if not Globals.debugging:
|
|
|
|
|
visible = false
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
visible = true
|
|
|
|
|
var visual_node: MeshInstance3D = get_node("visual")
|
|
|
|
|
var visual_node2: MeshInstance3D = get_node("visual_direction")
|
|
|
|
|
visual_node.mesh.material.albedo_color = Globals.FactionColor[faction]
|
|
|
|
|
visual_node2.mesh.material.albedo_color = Globals.FactionColor[faction]
|
2026-10-21 01:42:31 -05:00
|
|
|
|
|
|
|
|
func _on_area_body_entered(_body: Jet) -> void:
|
|
|
|
|
if delay_timer:
|
|
|
|
|
delay_timer.stop()
|
|
|
|
|
|
|
|
|
|
delay_timer = null
|
|
|
|
|
|
|
|
|
|
func _on_area_body_exited(_body: Jet) -> void:
|
|
|
|
|
delay_timer = Timer.new()
|
|
|
|
|
delay_timer.one_shot = true
|
|
|
|
|
delay_timer.timeout.connect(can_spawn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func set_can_spawn(availablity: bool = true) -> void:
|
|
|
|
|
is_available = availablity
|
|
|
|
|
|
|
|
|
|
func can_spawn() -> void:
|
|
|
|
|
is_available = true
|
|
|
|
|
|
|
|
|
|
func cannot_spawn() -> void:
|
|
|
|
|
is_available = false
|
|
|
|
|
|
|
|
|
|
func align_to_position(jet: Jet) -> void:
|
|
|
|
|
jet.global_position = global_position
|
|
|
|
|
jet.rotation = rotation
|