scoreboard players add .distance raycast 1

$execute if score .distance raycast >= .temp_distance raycast run particle $(particle_1) $(radius)

$execute if score .distance raycast >= .temp_distance raycast run particle $(particle_2) $(radius)

$execute $(positioned) unless entity @s[tag=$(id)_$(character)_$(type)_raycast_hit] run function main:mechanics/raycast/raycast_hit {"id":$(id),"type":$(type),"character":$(character),"distance":$(distance),"folder_location":"$(folder_location)"}

$execute if score .pierce distance = .pierce_max distance positioned ^ ^ ^0.1 rotated ~ ~ unless block ~ ~ ~ #main:raycast_pass run return run function main:$(folder_location)/miss

$execute if score .distance raycast matches $(distance) run return run function main:$(folder_location)/miss

$execute if score .distance raycast matches ..$(distance) positioned ^ ^ ^0.1 rotated ~ ~ if block ~ ~ ~ #main:raycast_pass run function main:mechanics/raycast/raycast_particle {"id":$(id),"character":$(character),"distance":$(distance),"particle_1":"$(particle_1)","particle_2":"$(particle_2)","type":$(type),"positioned":"$(positioned)","radius":"$(radius)","folder_location":"$(folder_location)"}