##
## Outdoor Furniture
## Copyright 2020 Cimap https://cimapminecraft.com/
##
# This fun is executed by tag=tutorial when score tutorial is >= 0
execute @s[tag=!show_arrow] ~ ~ ~ setblock 1016 3 43 stone
execute @s[tag=show_arrow] ~ ~ ~ setblock 1016 3 43 redstone_block

tag @a[tag=!in_tutorial,r=8] add in_tutorial
tp @a[tag=in_tutorial,rm=15] 1018 5 41 180

## STATE 0
scoreboard players set @s[scores={tutorial=0}] tutorial 1

## STATE 1
scoreboard players add @s[scores={tutorial=1}] gtimer 1
execute @s[scores={tutorial=1}] ~ ~ ~ particle display:image.world 1018.5 7.3 35.16
execute @s[scores={gtimer=1}] ~ ~ ~ setblock ~ ~-2 ~7 air
execute @s[scores={gtimer=80}] ~ ~ ~ title @a[tag=in_tutorial] title §9Outdoor Furniture
execute @s[scores={gtimer=80}] ~ ~ ~ title @a[tag=in_tutorial] subtitle by §6Cimap
execute @s[scores={gtimer=80}] ~ ~ ~ execute @a[tag=in_tutorial] ~ ~ ~ playsound map_title @s
execute @s[scores={gtimer=220}] ~ ~ ~ tellraw @a[tag=in_tutorial] {"rawtext":[{"text":"§aWelcome! Outside you'll find modern villas, a park, a beach, and swimming pools."}]}
execute @s[scores={gtimer=220}] ~ ~ ~ playsound random.orb @a[tag=in_tutorial] ~ ~ ~ 5 1.5
execute @s[scores={gtimer=320}] ~ ~ ~ tellraw @a[tag=in_tutorial] {"rawtext":[{"text":"§aYou can keep decorating these spaces with furniture or build new ones!"}]}
execute @s[scores={gtimer=320}] ~ ~ ~ playsound random.orb @a[tag=in_tutorial] ~ ~ ~ 5 1.5
execute @s[scores={gtimer=480}] ~ ~ ~ tellraw @a[tag=in_tutorial] {"rawtext":[{"text":"§l§6Survival Friendly. §r§aThis world contains ~50 unique pieces of furniture that you can use in survival."}]}
execute @s[scores={gtimer=480}] ~ ~ ~ playsound random.orb @a[tag=in_tutorial] ~ ~ ~ 5 1.5
execute @s[scores={gtimer=580}] ~ ~ ~ tellraw @a[tag=in_tutorial] {"rawtext":[{"text":"§aEach one has a crafting recipe you can view in the crafting table."}]}
execute @s[scores={gtimer=580}] ~ ~ ~ playsound random.orb @a[tag=in_tutorial] ~ ~ ~ 5 1.5
execute @s[scores={gtimer=650}] ~ ~ ~ setblock ~ ~-2 ~7 birch_button 2
execute @s[scores={gtimer=680..}] ~ ~ ~ title @a[tag=in_tutorial] actionbar §aPress the Button
execute @s[scores={gtimer=680}] ~ ~ ~ playsound random.orb @a[tag=in_tutorial] ~ ~ ~ 5 1.5
execute @s[scores={gtimer=680}] ~ ~ ~ tag @s add show_arrow

## TRANSITION STATE 2
execute @s[scores={tutorial=2}] ~ ~ ~ summon tutorial:armchair 1018 5 39
execute @s[scores={tutorial=2}] ~ ~ ~ scoreboard players reset @s[tag=tutorial] gtimer
execute @s[scores={tutorial=2}] ~ ~ ~ title @a[tag=in_tutorial] title §6Quick Guide
execute @s[scores={tutorial=2}] ~ ~ ~ title @a[tag=in_tutorial] subtitle How to Use the Tools

execute @s[scores={tutorial=2}] ~ ~ ~ give @a[tag=in_tutorial] fur:changer
scoreboard players set @s[scores={tutorial=2}] tutorial 3
## STATE 3
execute @s[scores={tutorial=3}] ~ ~ ~ particle display:text.changer 1018.5 7.5 35.16
## TRANSITION STATE 4
scoreboard players set @s[scores={tutorial=4}] tutorial 5
## STATE 5
execute @s[scores={tutorial=5}] ~ ~ ~ particle display:text.sit 1018.5 7.5 35.16
## TRANSITION STATE 6
execute @s[scores={tutorial=6}] ~ ~ ~ give @a[tag=in_tutorial] fur:rotate
scoreboard players set @s[scores={tutorial=6}] tutorial 7
## STATE 7
execute @s[scores={tutorial=7}] ~ ~ ~ particle display:text.rotate 1018.5 7.5 35.16
## TRANSITION STATE 8
execute @s[scores={tutorial=8}] ~ ~ ~ give @a[tag=in_tutorial] fur:mover
scoreboard players set @s[scores={tutorial=8}] tutorial 9
## STATE 9
execute @s[scores={tutorial=9}] ~ ~ ~ particle display:text.mover 1018.5 7.5 35.16
## TRANSITION STATE 10
execute @s[scores={tutorial=10}] ~ ~ ~ give @a[tag=in_tutorial] fur:remover
scoreboard players set @s[scores={tutorial=10}] tutorial 11
## STATE 11
execute @s[scores={tutorial=11}] ~ ~ ~ particle display:text.remover 1018.5 7.5 35.16
tag @s[scores={tutorial=11},tag=!picked] add picked
execute @s[scores={tutorial=11}] ~ ~ ~ execute @e[type=tutorial:armchair,c=1,r=15] ~ ~ ~ tag @e[scores={tutorial=9}] remove picked
execute @s[scores={tutorial=11},tag=picked,tag=!once] ~ ~ ~ playsound random.levelup @a[tag=in_tutorial,r=10] ~ ~ ~ 5 1.8
execute @s[scores={tutorial=11},tag=picked,tag=!once] ~ ~ ~ title @a[tag=in_tutorial,r=10] subtitle That is all.
execute @s[scores={tutorial=11},tag=picked,tag=!once] ~ ~ ~ title @a[tag=in_tutorial,r=10] title §aNice!
tag @s[scores={tutorial=11},tag=picked,tag=!once] add once



## END STATE 12
tag @s[scores={tutorial=12}] remove picked
tag @s[scores={tutorial=12}] remove once
execute @s[scores={tutorial=12}] ~ ~ ~ tag @e[type=tutorial:armchair] add despawn
execute @s[scores={tutorial=12}] ~ ~ ~ tp @a[tag=in_tutorial] 1018 75 40 270 0
execute @s[scores={tutorial=12}] ~ ~ ~ gamemode 0 @a[tag=in_tutorial]
execute @s[scores={tutorial=12}] ~ ~ ~ effect @a[tag=in_tutorial] night_vision 0
execute @s[scores={tutorial=12}] ~ ~ ~ tag @a[tag=in_tutorial] remove in_tutorial
execute @s[scores={tutorial=12}] ~ ~ ~ time set day
scoreboard players reset @s[scores={tutorial=12}] tutorial
#ADD CHANGE TO GM 0

effect @a[tag=in_tutorial,r=15] night_vision 15 4 true