extends Node

func _ready():
	for r in get_tree().get_nodes_in_group('regions'):
		r.get_node('main')._rot_speed = r._rot_speed_origin
		r.get_node('main/center').material_override = SpatialMaterial.new()
		r.get_node('main/center').material_override.albedo_color = Color.from_hsv((randi() % 12) / 12.0, 1, 1)

	$Region._rot_speed_origin = rand_range(0.002, 0.005)
	$Region.ratio = 3
	$Region/main.audible_range_max = 30
	$Region._spawn(18, [-2, 2])
	for c in $Region/main.get_children():
		if c.is_in_group('sounders'):
			c.set_freq(rand_range(20, 200))

	$Region3._rot_speed_origin = rand_range(-0.01, -0.1)
	$Region3._spawn(18, [-2, 2])
	for c in $Region3/main.get_children():
		if c.is_in_group('sounders'):
			c.set_freq(rand_range(200, 2000))

	$Region2._rot_speed_origin = rand_range(0.01, 0.1)
	$Region2._spawn(150, [-20, 20])
	for c in $Region2/main.get_children():
		if c.is_in_group('sounders'):
			c.set_freq(rand_range(2000, 20000))
	$Region2.gain1 = 5
	$Region2.gain2 = 0.01
	$Region2.ratio = 3
#	$Region2/main.set_freq(rand_range(20, 80))
