class_name PointSpray extends Spray
## Simple single-point spraygun

@export var spray_scale := 1.5
@export var damage := 0.3334

@onready var laser: LaserCast = %LaserCast
@onready var spray_sfx: SpraySFX = %SpraySFX


func _spray() -> void:
	if laser.is_colliding():
		spray_sfx.activate()

		var collider := laser.get_collider()
		if collider is GunkBody:
			var point := laser.get_collision_point()
			var point_scale := point.distance_to(global_position) * spray_scale
			(collider as GunkBody).paint_continuous(
				point, laser.get_collision_normal(), point_scale
			)
		if collider is GunkNode:
			(collider as GunkNode).hit(damage)
