scoreboard players set global exitEnabled 0

#won game? all levels open, always
execute if score #challenge wonGame matches 1 run function bd:__open_all_levels_challenge

#progression (open end level when all 10 levels are cleared)
execute if block 2 16 2 redstone_block if block 3 16 2 redstone_block if block 4 16 2 redstone_block if block 5 16 2 redstone_block if block 6 16 2 redstone_block if block 7 16 2 redstone_block if block 8 16 2 redstone_block if block 9 16 2 redstone_block if block 10 16 2 redstone_block if block 11 16 2 redstone_block run setblock 2 16 4 redstone_block

#level entry points
scoreboard players set global setLevel 3001
execute unless block 2 16 2 redstone_block positioned 10 81 13 run function bd:levels/entities/level_entry_face3
scoreboard players set global setLevel 3002
execute unless block 3 16 2 redstone_block positioned 10 81 16 run function bd:levels/entities/level_entry_face3
scoreboard players set global setLevel 3003
execute unless block 4 16 2 redstone_block positioned 10 81 19 run function bd:levels/entities/level_entry_face3

scoreboard players set global setLevel 3004
execute unless block 5 16 2 redstone_block positioned 13 81 22 run function bd:levels/entities/level_entry_face1
scoreboard players set global setLevel 3005
execute unless block 6 16 2 redstone_block positioned 16 81 22 run function bd:levels/entities/level_entry_face1
scoreboard players set global setLevel 3006
execute unless block 7 16 2 redstone_block positioned 19 81 22 run function bd:levels/entities/level_entry_face1

scoreboard players set global setLevel 3007
execute unless block 8 16 2 redstone_block positioned 22 81 19 run function bd:levels/entities/level_entry_face7
scoreboard players set global setLevel 3008
execute unless block 9 16 2 redstone_block positioned 22 81 16 run function bd:levels/entities/level_entry_face7
scoreboard players set global setLevel 3009
execute unless block 10 16 2 redstone_block positioned 22 81 13 run function bd:levels/entities/level_entry_face7

scoreboard players set global setLevel 3010
execute unless block 11 16 2 redstone_block positioned 16 81 10 run function bd:levels/entities/level_entry_face5

#final challenge
scoreboard players set global setLevel 3999
execute if block 2 16 4 redstone_block positioned 29 84 29 run function bd:levels/entities/level_entry_face3