#transition
function main:settings/player_data/list
function main:settings/scoreboards/load
function main:settings/kill
function main:menu/gunner
kill @e[type=text_display]
schedule function main:hub/remove_hat 10t

#scores
scoreboard players set @s experience 0
scoreboard players set @s level 0
tag @a remove main_menu
tag @a remove game_started
tag @a add hub
tag @a remove choice
tag @a remove shop_choice
tag @a remove reward_choice
tag @a remove wave
tag @a remove upgrade_starting
tag @a remove level_starting
scoreboard players set .proj_speed_multiplier projectile 100
scoreboard players set .launcher hub 0
scoreboard players set @a gold 0
scoreboard players set .play music 0
scoreboard players set @a combo 0
scoreboard players set @a combo_timer 0
execute unless score .difficulty_level progression matches 1.. run scoreboard players set .difficulty_level progression 0
execute unless score .difficulty_level_max progression matches 1.. run scoreboard players set .difficulty_level_max progression 0

#hub objects
function main:hub/objects/dummy/menu
schedule function main:hub/objects/workshop/particles 10t
summon block_display 69 -57 9 {block_state:{Name:"minecraft:barrier"},Tags:["main_menu"]}

summon interaction 29 -57.5 9 {width:0.5f,height:0.25f,response:1b,Tags:["button","leave_title"],Passengers:[{id:"minecraft:text_display",teleport_duration:1,Rotation:[-90F,0F],alignment:"center",Tags:["button","text","leave_title"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[2f,2f,2f]},text:'{"color":"red","text":"> Exit <"}',background:2046820352}]}
summon interaction 62 -57 3 {width:0.5f,height:0.25f,response:1b,Tags:["button","workshop_title"],Passengers:[{id:"minecraft:text_display",see_through:0b,teleport_duration:1,Rotation:[0F,0F],alignment:"center",Tags:["button","text","workshop_title"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1.5f,1.5f,1.5f]},text:'{"color":"yellow","text":"Disassembly Station"}',background:2046820352}]}
summon interaction 64 -57 16 {width:0.5f,height:0.25f,response:1b,Tags:["button","classes_title"],Passengers:[{id:"minecraft:text_display",see_through:0b,teleport_duration:1,Rotation:[180F,0F],alignment:"center",Tags:["button","text","classes_title"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1.5f,1.5f,1.5f]},text:'{"color":"blue","text":"Memory Loader"}',background:2046820352}]}
summon interaction 37 -51 23.9 {width:0.5f,height:0.25f,response:1b,Tags:["button","testing_room"],Passengers:[{id:"minecraft:text_display",see_through:0b,teleport_duration:1,Rotation:[-180F,0F],alignment:"center",Tags:["button","text","testing_room"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-0.25f,0f],scale:[1.5f,1.5f,1.5f]},text:'{"color":"green","text":"Testing Room"}',background:2046820352}]}

# summon item_display 59 -58.5 4 {CustomNameVisible:0b,item:{id:potion,components:{item_model:"minecraft:npc/l30",potion_contents:{custom_color:16711680}}},CustomName:'{"color":"blue","text":"L-30"}',Rotation:[140F,0F],Tags:["npc","npc_hub"],Passengers:[{id:"minecraft:text_display",transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,1.8f,0f],scale:[1f,1f,1f]},text:'{"color":"blue","text":"L-30"}',alignment:"center"}]}
# execute as @e[type=item_display,tag=npc_hub] run function main:mechanics/animation/entity/start {"start":0,"frames":202}

summon villager 59 -59 4 {Silent:1b,NoAI:1b,Invulnerable:1b,Tags:["npc","npc_workshop"],Rotation:[0F,0F],attributes:[{id:max_health,base:10000},{id:"armor",base:1000}],ArmorItems:[{},{},{},{}],active_effects:[{id:"minecraft:invisibility",amplifier:1,duration:999999999,show_particles:0b}],Passengers:[{id:"minecraft:item_display",Rotation:[170F,0F],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,-1.5f,0f],scale:[1f,1f,1f]},item:{id:"minecraft:paper",count:1,components:{"minecraft:item_model":"minecraft:npc/l30"}},CustomName:'{"color":"blue","text":"L-30"}',CustomNameVisible:1b}]}
summon interaction 59 -59 4 {width:2,height:2,Tags:["npc_workshop","button"]}

# execute as @e[type=villager,tag=npc_workshop] run function main:mechanics/animation/entity/start {"start":0,"frames":202}

#buttons
fill 73 -58 5 73 -50 14 air
setblock 57 -39 -6 minecraft:waxed_copper_bulb[lit=false]
setblock 56 -39 -6 minecraft:waxed_exposed_copper_bulb[lit=false]
setblock 55 -39 -6 minecraft:waxed_weathered_copper_bulb[lit=false]
setblock 54 -39 -6 minecraft:waxed_oxidized_copper_bulb[lit=false]