# execute at @s positioned ^ ^ ^-1 run tp @a[tag=gunner] ^ ^ ^1
# execute as @a[tag=gunner] at @s run function main:characters/gunner/q/id1/calc


execute if entity @s[scores={gunner=..0}] as @a[tag=gunner,tag=gunner_q] at @s run function main:mechanics/knockback_xyz with storage gunner coordinates.pulse
execute as @a[tag=gunner,tag=gunner_q] run tag @s remove gunner_q

# execute if entity @s[scores={gunner=..0}] as @a[tag=gunner] at @s run function main:mechanics/knockback_stop
execute if entity @s[scores={gunner=..0}] as @a[tag=gunner] at @s run function main:mechanics/knockback_xyz with storage gunner coordinates

execute at @s positioned ~-2 ~-2 ~-2 if entity @a[tag=gunner,dx=3,dy=3,dz=3] run kill @s

#vfx
execute unless entity @e[type=marker,tag=gunner_q] as @a[tag=gunner] at @s run summon marker ~ ~1 ~ {Tags:["gunner_q"]}
execute at @a[tag=gunner] as @e[type=marker,tag=gunner_q] run teleport @s ~ ~1 ~ facing entity @n[type=block_display,tag=id1_gunner_q_projectile]

execute if entity @s[scores={gunner=..0}] as @e[type=marker,tag=gunner_q] run function main:mechanics/raycast/raycast {"radius":"~ ~-0.15 ~ 0 0 0 5 0 force","id":gunner_q,"particle_1":"dust{color:[0.9,0.9,0.9],scale:0.5}","particle_2":"dust{color:[0.9,0.9,0.9],scale:0.5}","distance":100,"type":particle,"positioned":"as @e[type=block_display,tag=id1_gunner_q_projectile,dx=0] positioned ~-0.125 ~-0.125 ~-0.125 if entity @s[dx=0] positioned ~-0.75 ~-0.75 ~-0.75 if entity @s[dx=0] positioned ~0.875 ~0.875 ~0.875","character":gunner,"x":"~","y":"~","offset":"","offset_2":"","pierce":1}

#reset score
scoreboard players set @s projectile 100
scoreboard players set @a[tag=gunner] q_duration_t 5
execute as @s[scores={gunner=..0}] run scoreboard players set @s gunner 3