
# -> Create a marker on the legs
summon marker ~ ~0.7 ~ {Tags:["OverlyRealistic.Player.BodyMarker","OverlyRealistic.Player.BodyPartLegs"]}

# -> Create a marker on the torso
summon marker ~ ~1.6 ~ {Tags:["OverlyRealistic.Player.BodyMarker","OverlyRealistic.Player.BodyPartTorso"]}

# -> Reset vars
scoreboard players set @s OverlyRealistic.Player.LocalRayRange 0
scoreboard players set @s OverlyRealistic.Player.LocalRayRangeMax 50
execute store result score @s OverlyRealistic.Player.LocalRayRangeMax \
    on attacker \
    if entity @s[type=player] run \
        attribute @s entity_interaction_range get 5

# -> Perform raycast
execute on attacker \
    at @s \
    anchored eyes \
    positioned ^ ^ ^ \
    anchored feet \
    as @p[tag=OverlyRealistic.Player.TempPlayerHurt,distance=..64] run \
        function overly_realistic:players/body_damage/attacker_operations/attack_raycast_travel

# -> Remove nearby body markers
kill @e[type=marker,tag=OverlyRealistic.Player.BodyMarker,distance=..4]

# -> Untag player
tag @s remove OverlyRealistic.Player.TempPlayerHurt
