{
  "format_version": "1.10.0",
  "animation_controllers": {

    "controller.animation.spark_dragon.beacon": {
      "initial_state": "inactive",
      "states": {
        "inactive": {
          "transitions": [
            { "active": "query.property('silverlabs:beacon_active')" }
          ]
        },
        "active": {
          "particle_effects": [
            { "effect": "beacon_beam" }
          ],
          "transitions": [
            { "inactive": "!query.property('silverlabs:beacon_active')" }
          ]
        }
      }
    },

    "controller.animation.spark_dragon": {
      "initial_state": "idle",
      "states": {
        "idle": {
          "animations": ["idle"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "flying": "!query.is_on_ground && query.property('silverlabs:growth_stage') == 2" },
            { "walking": "query.modified_move_speed > 0.1" },
            { "sleeping": "query.is_sitting && (query.time_of_day > 0.5)" },
            { "sitting": "query.is_sitting" },
            { "grooming": "query.is_on_ground && query.modified_move_speed <= 0.05 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 1" },
            { "sniffing": "query.is_on_ground && query.modified_move_speed <= 0.15 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 2" },
            { "happy_bounce": "query.is_on_ground && query.modified_move_speed <= 0.05 && query.property('silverlabs:mood') == 2 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 3" },
            { "stretching": "query.is_on_ground && query.modified_move_speed <= 0.05 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 4" }
          ]
        },
        "walking": {
          "animations": ["walk"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "flying": "!query.is_on_ground && query.property('silverlabs:growth_stage') == 2" },
            { "sniffing": "query.is_on_ground && query.modified_move_speed <= 0.15 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 2" },
            { "idle": "query.modified_move_speed <= 0.1" },
            { "sitting": "query.is_sitting" }
          ]
        },
        "sitting": {
          "animations": ["sit"],
          "transitions": [
            { "idle": "!query.is_sitting" },
            { "sleeping": "query.is_sitting && (query.time_of_day > 0.5)" }
          ]
        },
        "sleeping": {
          "animations": ["sleep"],
          "transitions": [
            { "idle": "!query.is_sitting" },
            { "sitting": "query.is_sitting && (query.time_of_day <= 0.5)" }
          ]
        },
        "flying": {
          "animations": ["fly"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "idle": "query.is_on_ground && query.modified_move_speed <= 0.1" },
            { "walking": "query.is_on_ground && query.modified_move_speed > 0.1" }
          ]
        },
        "grooming": {
          "animations": ["groom"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "idle": "query.modified_move_speed > 0.05 || query.is_sitting || math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) != 1" }
          ]
        },
        "sniffing": {
          "animations": ["sniff"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "idle": "query.modified_move_speed > 0.15 || query.is_sitting || math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) != 2" },
            { "walking": "query.modified_move_speed > 0.1 && math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) == 2" }
          ]
        },
        "happy_bounce": {
          "animations": ["happy_bounce"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "idle": "query.modified_move_speed > 0.05 || query.is_sitting || query.property('silverlabs:mood') != 2 || math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) != 3" }
          ]
        },
        "stretching": {
          "animations": ["stretch"],
          "transitions": [
            { "fire_breathing": "query.property('silverlabs:firing')" },
            { "idle": "query.modified_move_speed > 0.05 || query.is_sitting || math.mod(math.floor((query.life_time + math.mod(math.abs(math.floor(query.position(0) + query.position(2))), 5) * 36.0) / 36.0), 5) != 4" }
          ]
        },
        "fire_breathing": {
          "animations": ["fire_breath"],
          "transitions": [
            { "flying": "!query.property('silverlabs:firing') && !query.is_on_ground && query.property('silverlabs:growth_stage') == 2" },
            { "idle": "!query.property('silverlabs:firing') && query.is_on_ground" },
            { "walking": "!query.property('silverlabs:firing') && query.modified_move_speed > 0.1" }
          ]
        }
      }
    },

    "controller.animation.spark_dragon.mood": {
      "initial_state": "content",
      "states": {
        "happy": {
          "particle_effects": [
            { "effect": "mood_happy" }
          ],
          "transitions": [
            { "content": "query.property('silverlabs:mood') == 1" },
            { "needy": "query.property('silverlabs:mood') == 0" }
          ]
        },
        "content": {
          "transitions": [
            { "happy": "query.property('silverlabs:mood') == 2" },
            { "needy": "query.property('silverlabs:mood') == 0" }
          ]
        },
        "needy": {
          "particle_effects": [
            { "effect": "mood_needy" }
          ],
          "transitions": [
            { "happy": "query.property('silverlabs:mood') == 2" },
            { "content": "query.property('silverlabs:mood') == 1" }
          ]
        }
      }
    }

  }
}
