execute positioned ~ ~-1 ~ run tag @e[limit=1,sort=nearest,tag=level_exit,type=armor_stand] add check_it

#must have arm attached
#must be facing the same direction as the ghost
execute unless entity @s[tag=arm_disconnected] if score @s faceDirection = @e[limit=1,tag=check_it] faceDirection run tag @s add go

#PROGRESSION (PUZZLE COMPLETE)
execute if entity @s[tag=go] run function bd:levels/mark_level_completion

execute if entity @s[tag=go] run scoreboard players operation global currentLevel = @e[limit=1,tag=check_it] setLevel
execute if entity @s[tag=go] run scoreboard players operation global char_set_x = @s char_x
execute if entity @s[tag=go] run scoreboard players operation global char_set_y = @s char_y
execute if entity @s[tag=go] run scoreboard players operation global char_set_z = @s char_z
execute if entity @s[tag=go] run scoreboard players operation global char_set_face = @s faceDirection
execute if entity @s[tag=go] run scoreboard players set global moveCooldown 40
execute if entity @s[tag=go] run playsound minecraft:block.beacon.activate master @a ~ 1000000 ~ 1000000 1.5

tag @e[tag=check_it] remove check_it
tag @s remove go