function main:characters/sniper/rc/id1/tick
function main:characters/sniper/q/id1/tick
function main:characters/sniper/weapon/id1/tick
function main:characters/sniper/shift/id1/tick

#effects
$function main:characters/effects {"character":$(character)}

#weapon
execute if score @s first_person matches 1 as @s[predicate=main:holding/firework_star] run function main:characters/sniper/weapon
execute as @s[predicate=main:holding/rod,predicate=!main:holding/firework_star] run function main:characters/sniper/weapon
execute as @s[predicate=main:holding/nothing] unless entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{character:sniper}}}}] run function main:characters/sniper/weapon
execute as @s[predicate=!main:holding/rod] unless entity @e[type=item,nbt={Item:{components:{"minecraft:custom_data":{character:sniper}}}}] run clear @s firework_star
execute if score @s first_person matches 1 run function main:characters/sniper/weapon

execute if entity @s[tag=sniper_rc_triggered] if score .reload sniper matches ..-5 if score .rc_animation sniper matches 0 run function main:mechanics/animation/stop {"frame":8388695}

execute unless entity @s[tag=sniper_rc_triggered] if score .reload sniper matches ..-5 if score .weapon_animation sniper matches ..0 if score .shift_animation sniper matches ..0 if score .rc_animation sniper matches ..0 if score .q_animation sniper matches ..0 run function main:mechanics/animation/stop {"frame":8388628}

execute if score .weapon_animation sniper matches 1.. run scoreboard players remove .weapon_animation sniper 1
execute if score .rc_animation sniper matches 1.. run scoreboard players remove .rc_animation sniper 1
execute if score .q_animation sniper matches 1.. run scoreboard players remove .q_animation sniper 1
execute if score .shift_animation sniper matches 1.. run scoreboard players remove .shift_animation sniper 1

function main:characters/sniper/indicator