# © Spark Universe, 2023
# authors: destruc7i0n
# description: main loop for the tutorial
# called by: 

execute as @a[tag=in_tutorial] at @s run function spark/tutorial/player_loop

# count number of instances
scoreboard players set .instances tut 0
execute as @e[tag=tutorial_instance] run scoreboard players add .instances tut 1
# reset when not at origin
execute if score .instances tut matches 0 positioned 15 16 256 unless entity @e[tag=tutorial_main,r=1] run tp @e[tag=tutorial_main] ~ ~ ~
scoreboard players reset .instances tut

# Spawn room
particle spark:tutorial_ambient_spark -9 3.4 263
particle spark:tutorial_ambient_grey -9 2.01 263

# spawn room music handling
execute as @e[tag=tutorial_main,tag=!started_tutorial] run function spark/tutorial/spawn_room_music

execute as @e[type=spark:tutorial_marker] at @s run particle spark:tutorial_ambient_grey ~~~