function main:characters/engineer/q/id1/tick with storage player_data 1
function main:characters/engineer/rc/id1/tick
function main:characters/engineer/weapon/id1/tick
function main:characters/engineer/shift/id1/tick

execute as @s[scores={engineer=..-1}] run scoreboard players set @s engineer 0
execute as @s[scores={engineer=201..}] run scoreboard players set @s engineer 200

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

execute if score .weapon_animation engineer matches ..0 if score .shift_animation engineer matches ..0 if score .rc_animation engineer matches ..0 if score .q_animation engineer matches ..0 run function main:mechanics/animation/stop {"frame":8388627}

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

#hud
execute as @s[scores={engineer=100..},predicate=main:holding/rod] run function main:characters/engineer/indicator {"space":"-13"}
execute as @s[scores={engineer=10..99},predicate=main:holding/rod] run function main:characters/engineer/indicator {"space":"-9"}
execute as @s[scores={engineer=..9},predicate=main:holding/rod] run function main:characters/engineer/indicator {"space":"-5"}

# execute as @s[scores={q_duration_t=1..}] run item replace entity @s armor.head with leather_helmet[enchantments={levels:{"minecraft:binding_curse":1},show_in_tooltip:false},equippable={slot:"head",model:"minecraft:engineer_q",camera_overlay:"custom/overlay/engineer"}] 1

# execute as @s[scores={q_duration_t=..0}] run clear @s leather_helmet[enchantments={levels:{"minecraft:binding_curse":1},show_in_tooltip:false},equippable={slot:"head",model:"minecraft:engineer_q",camera_overlay:"custom/overlay/engineer"}]