extends GPUParticles3D

func _ready() -> void:
	amount = 500
	lifetime = 10.0
	one_shot = false
	explosiveness = 0.0
	randomness = 1.0
	visibility_aabb = AABB(Vector3(-50, -30, -50), Vector3(100, 60, 100))

	var process_mat := ParticleProcessMaterial.new()
	process_mat.emission_shape = ParticleProcessMaterial.EMISSION_SHAPE_BOX
	process_mat.emission_box_extents = Vector3(50.0, 30.0, 50.0)

	process_mat.direction = Vector3(0.0, 0.0, 0.0)
	process_mat.spread = 180.0
	process_mat.initial_velocity_min = 0.0
	process_mat.initial_velocity_max = 0.1

	process_mat.linear_accel_min = -0.05
	process_mat.linear_accel_max = 0.05
	process_mat.radial_accel_min = -0.02
	process_mat.radial_accel_max = 0.02

	process_mat.damping_min = 0.5
	process_mat.damping_max = 1.0

	process_mat.scale_min = 0.02
	process_mat.scale_max = 0.08

	process_mat.color = Color(0.85, 0.92, 1.0, 0.8)

	var grad := Gradient.new()
	grad.set_color(0, Color(0.85, 0.92, 1.0, 0.0))
	grad.set_color(1, Color(0.85, 0.92, 1.0, 0.0))
	grad.add_point(0.1, Color(0.85, 0.92, 1.0, 0.8))
	grad.add_point(0.9, Color(0.85, 0.92, 1.0, 0.8))
	var grad_tex := GradientTexture1D.new()
	grad_tex.gradient = grad
	process_mat.color_ramp = grad_tex

	process_material = process_mat

	var quad := QuadMesh.new()
	quad.size = Vector2(0.05, 0.05)

	var mat := StandardMaterial3D.new()
	mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
	mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
	mat.billboard_mode = BaseMaterial3D.BILLBOARD_ENABLED
	mat.emission_enabled = true
	mat.emission = Color(0.8, 0.9, 1.0)
	mat.emission_energy_multiplier = 1.5
	mat.albedo_color = Color(0.85, 0.92, 1.0, 0.8)

	quad.surface_set_material(0, mat)
	draw_pass_1 = quad
