tag @a remove inControl
tag @s add inControl

tp @s ~ ~ ~ 180 46

#i like to be bold
kill @e[type=!player,tag=!nokill]

scoreboard players operation global char_set_x = global start_x
scoreboard players operation global char_set_y = global start_y
scoreboard players operation global char_set_z = global start_z
scoreboard players operation global char_set_face = global start_f
scoreboard players operation @s faceDirection = global start_f

scoreboard players set global wonGame 0
scoreboard players set #fingermaps wonGame 0
scoreboard players set #fingermaps gameTime 0
scoreboard players set #fingermaps gameMoves 0
scoreboard players set global exitEnabled 0

scoreboard players set global currentLevel 1
scoreboard players set global puzzleSet 1
scoreboard players set global levelExitValue 1
function bd:levels/_reload_level

#reset save data, unless continuing from previous save
execute unless score global math matches -12345 run clone 17 4 1 30 4 14 1 4 1

#puzzle-set save data exists
setblock 13 4 2 redstone_block

#any save data exists
setblock 2 4 18 redstone_block

execute as @a at @s run playsound minecraft:block.beacon.activate master @s ~ ~100000 ~ 1000000 1.7
tellraw @a[tag=!inControl] ["",{"selector":"@s","color":"#FFAA00"},{"text":" has started a new game!"}]
tellraw @s ["",{"text":"Started a new game!","color":"#FFAA00"}]
tellraw @a ["",{"text":"Puzzle set: ","color":"white"},{"text":"Fingermaps Map Jam 2021","color":"#FFFF05"}]

execute if score global math matches -12345 run tellraw @s ["",{"text":" > Continuing from previous save data.","color":"#33AA33","italic":"true"}]
execute if score global math matches -99999 run tellraw @s ["",{"text":" > Previous save data was erased.","color":"#AA3333","italic":"true"}]

tp @a[tag=!inControl,x=21,y=58,z=10,dx=12,dy=12,dz=12] 37 82 29 90 10