kill @e[tag=level_entity]

#prevent redstone blocks getting stuck one layer under...
fill 0 78 0 31 78 31 white_terracotta

#load the structure into place before cloning it
execute positioned -33 3 15 run function bd:levels/structures/_index
setblock -33 3 16 redstone_block

scoreboard players operation global levelEcho = global currentLevel

scoreboard players set global levelLoading 1
scoreboard players set global victoryState 0
scoreboard players set global exitEnabled 0

scoreboard players set global availableResets -1

#clean up some text which can get stuck below the play area
#if a player selects "new game" and then disconnects before making a choice
execute if entity @e[type=armor_stand,tag=puzzle_set_select] unless entity @a[limit=1,x=21,y=58,z=10,dx=12,dy=12,dz=12] run kill @e[type=armor_stand,tag=puzzle_set_select]