{
	"format_version": "1.16.0",
	"animation_controllers": {
		"controller.animation.automaton_song": {
			"states": {
				"default": {
					"on_entry": [
					    "/execute @e[family=automaton,tag=!sing,r=15,tag=!cd] ~~~ scoreboard players add @e[tag=sing,r=15,tag=!cd] sing_count 1",
					    "/execute @e[family=automaton,tag=!sing,r=15,tag=!cd] ~~~ tag @s add sing"
					    ],
					"transitions": [
						{"1": "q.mark_variant==0 && q.scoreboard('sing_count')<6"},
						{"sing":"q.scoreboard('sing_count')>=6"}
					]
				},
				"1": {
					"on_entry": [
					    "/execute @e[family=automaton,tag=!sing,r=15,tag=!cd] ~~~ scoreboard players add @e[tag=sing,r=15,tag=!cd] sing_count 1",
					    "/execute @e[family=automaton,tag=!sing,r=15,tag=!cd] ~~~ tag @s add sing"],
					"transitions": [{"default":"q.mark_variant==0 && q.scoreboard('sing_count')<6"},
						{"sing":"q.scoreboard('sing_count')>=6"}]
				},
				"sing": {
					"on_entry": [
					    "/scoreboard players set @e[r=20] sing_count 6",
					    "/playsound Automaton_song @a[r=15] ~~~",
					    "/tag @s add cd",
					    "/tag @s remove sing",
					    "variable.tick_delay=q.life_time;"
					    ],
					"transitions": [
						{"to_default": "(q.life_time-variable.tick_delay) >= 30"}
					]
				},
				"to_default": {
					"on_entry": [
					    "/scoreboard players reset @e[r=20] sing_count",
					    "/tag @s remove cd"
					    ],
					"transitions": [
						{"default": "q.mark_variant==0"}
					]
				}
			}
		}
	}
}