summon armor_stand ~ ~-.5 ~ {Tags:["setme","level_entity","mark_level_exit"],DisabledSlots:4144959,NoGravity:1b,Silent:1b,Invulnerable:1b,Invisible:1b,Glowing:0b}

scoreboard players set @e[limit=1,tag=setme,type=armor_stand,sort=nearest] faceDirection 1
execute if block ~ ~ ~ command_block[facing=west] run scoreboard players set @e[limit=1,tag=setme,type=armor_stand,sort=nearest] faceDirection 3
execute if block ~ ~ ~ command_block[facing=north] run scoreboard players set @e[limit=1,tag=setme,type=armor_stand,sort=nearest] faceDirection 5
execute if block ~ ~ ~ command_block[facing=east] run scoreboard players set @e[limit=1,tag=setme,type=armor_stand,sort=nearest] faceDirection 7

#just assume we go back to hub for this one
scoreboard players operation @e[limit=1,tag=setme,type=armor_stand,sort=nearest] setLevel = global levelExitValue

tag @e[limit=1,tag=setme,type=armor_stand,sort=nearest] remove setme

execute if block ~ ~ ~ command_block run setblock ~ ~ ~ air