
# -> Debug particles
#particle small_flame ~ ~ ~ 0 0 0 0.001 1 force @a

# -> If current position is within the hurt player's hitbox, if there is a body marker near, then confirm the hit
execute positioned ~-0.5 ~-0.5 ~-0.5 \
    if entity @p[tag=OverlyRealistic.Player.TempPlayerHurt,dx=0,dy=0,dz=0] \
    as @n[type=marker,tag=OverlyRealistic.Player.BodyMarker,distance=..1.25] run \
        return run \
            function overly_realistic:players/body_damage/attacker_operations/attack_raycast_confirm

# -> Add to range
scoreboard players add @s OverlyRealistic.Player.LocalRayRange 1

# -> If the range was exhausted then operate as the nearest body marker
execute if score @s OverlyRealistic.Player.LocalRayRange >= @s OverlyRealistic.Player.LocalRayRangeMax run \
    return run \
        execute as @n[type=marker,tag=OverlyRealistic.Player.BodyMarker] run \
            function overly_realistic:players/body_damage/attacker_operations/attack_raycast_confirm

# -> Recursive loop
execute positioned ^ ^ ^0.1 run \
    function overly_realistic:players/body_damage/attacker_operations/attack_raycast_travel