{
    "format_version": "1.10.0",
    "minecraft:attachable": {
        "description": {
            "identifier": "oct_db:health_monitor.critical",
            "item": {
                "oct_db:health_monitor.healthy": "query.is_owner_identifier_any('minecraft:player')"
            },
            "materials": {
                "default": "oct_eg.health_menu",
                "shadow": "oct_eg.health_menu_shadow",
                "player_outline": "oct_eg.player_outline_glow"
            },
            "textures": {
                "default": "textures/octovon/db/entity/health_menu/atlas",
                "player_outline_0": "textures/octovon/db/entity/health_menu/outline_stage_0",
                "player_outline_1": "textures/octovon/db/entity/health_menu/outline_stage_1",
                "player_outline_2": "textures/octovon/db/entity/health_menu/outline_stage_2",
                "player_outline_3": "textures/octovon/db/entity/health_menu/outline_stage_3"
            },
            "geometry": {
                "mainhand": "geometry.oct_db.health_menu.mainhand",
                "offhand": "geometry.oct_db.health_menu.offhand",
                "player_outline": "geometry.oct_db.player_outline"
            },
            "animations": {
                "sliders": "animation.oct_db.health_menu.sliders",
                "mainhand_offsets": "animation.oct_db.health_menu.mainhand_offsets",
                "offhand_offsets": "animation.oct_db.health_menu.offhand_offsets"
            },
            "scripts": {
                "parent_setup": "t.is_sneaking = q.is_sneaking; t.sneaking_setting = v.sneaking_setting ?? 0.0; t.is_paperdoll = v.is_paperdoll; t.temp_slider = v.temp_slider ?? 0.5; t.thirst_slider = v.thirst_slider ?? 0.5; t.limb_Head_slider = v.limb_head_slider ?? 0.5; t.limb_Body_slider = v.limb_body_slider ?? 0.5; t.limb_LeftArm_slider = v.limb_leftarm_slider ?? 0.5; t.limb_RightArm_slider = v.limb_rightarm_slider ?? 0.5; t.limb_Legs_slider = v.limb_legs_slider ?? 0.5;",
                "initialize": [
                    "v.is_offhand = 0.0;",
                    // Temperature
                    "v.temp_slider_exact = 0.0;",
                    "v.temp_slider_smooth = 100.0;",
                    // Thirst
                    "v.thirst_slider_exact = 0.0;",
                    "v.thirst_slider_smooth = 100.0;",
                    // limb
                    "v.limb_head_slider_exact = 0.0;",
                    "v.limb_head_slider_smooth = 100.0;",
                    "v.limb_body_slider_exact = 0.0;",
                    "v.limb_body_slider_smooth = 100.0;",
                    "v.limb_leftarm_slider_exact = 0.0;",
                    "v.limb_leftarm_slider_smooth = 100.0;",
                    "v.limb_rightarm_slider_exact = 0.0;",
                    "v.limb_rightarm_slider_smooth = 100.0;",
                    "v.limb_legs_slider_exact = 0.0;",
                    "v.limb_legs_slider_smooth = 100.0;",
                    "v.thirst_debuff = 0.0;",
                    "v.limb_debuff = 0.0;",
                    "v.temperature_debuff = 0.0;",
                    "v.temp_debuff_cold = 0.0;",
                    "v.temp_debuff_frostbite = 0.0;",
                    "v.temp_debuff_hypothermia = 0.0;",
                    "v.temp_debuff_warm = 0.0;",
                    "v.temp_debuff_overheat = 0.0;",
                    "v.temp_debuff_heatstroke = 0.0;",
                    "v.max_distance_slider = 5;"
                ],
                "pre_animation": [
                    "v.is_mainhand = q.equipped_item_any_tag('slot.weapon.mainhand', 'oct_db:health_monitor');",
                    "v.is_offhand = !v.is_mainhand && q.equipped_item_any_tag('slot.weapon.offhand', 'oct_db:health_monitor');",
                    "v.should_show_offhand = t.sneaking_setting ? t.is_sneaking : 1.0;",
                    // Temperature
                    "v.temp_slider_exact = t.temp_slider ?? 0.0;",
                    "v.temp_slider_smooth = (math.abs(v.temp_slider_smooth - v.temp_slider_exact) > v.max_distance_slider) ? v.temp_slider_exact : (math.lerp(v.temp_slider_smooth ?? v.temp_slider_exact, v.temp_slider_exact, 0.05));",
                    "v.is_cold = v.temp_slider_smooth < 0.25;",
                    "v.is_hot = v.temp_slider_smooth > 0.875;",
                    // Thirst
                    "v.thirst_slider_exact = t.thirst_slider ?? 0.0;",
                    "v.thirst_slider_smooth = (math.abs(v.thirst_slider_smooth - v.thirst_slider_exact) > v.max_distance_slider) ? v.thirst_slider_exact : (math.lerp(v.thirst_slider_smooth ?? v.thirst_slider_exact, v.thirst_slider_exact, 0.05));",
                    // Limb
                    "v.limb_head_slider_exact = t.limb_Head_slider ?? 0.0;",
                    "v.limb_head_slider_smooth = (math.abs(v.limb_head_slider_smooth - v.limb_head_slider_exact) > v.max_distance_slider) ? v.limb_head_slider_exact : math.lerp(v.limb_head_slider_smooth ?? v.limb_head_slider_exact, v.limb_head_slider_exact, 0.1);",
                    "v.limb_body_slider_exact = t.limb_Body_slider ?? 0.0;",
                    "v.limb_body_slider_smooth = (math.abs(v.limb_body_slider_smooth - v.limb_body_slider_exact) > v.max_distance_slider) ? v.limb_body_slider_exact : math.lerp(v.limb_body_slider_smooth ?? v.limb_body_slider_exact, v.limb_body_slider_exact, 0.1);",
                    "v.limb_leftarm_slider_exact = t.limb_LeftArm_slider ?? 0.0;",
                    "v.limb_leftarm_slider_smooth = (math.abs(v.limb_leftarm_slider_smooth - v.limb_leftarm_slider_exact) > v.max_distance_slider) ? v.limb_leftarm_slider_exact : math.lerp(v.limb_leftarm_slider_smooth ?? v.limb_leftarm_slider_exact, v.limb_leftarm_slider_exact, 0.1);",
                    "v.limb_rightarm_slider_exact = t.limb_RightArm_slider ?? 0.0;",
                    "v.limb_rightarm_slider_smooth = (math.abs(v.limb_rightarm_slider_smooth - v.limb_rightarm_slider_exact) > v.max_distance_slider) ? v.limb_rightarm_slider_exact : math.lerp(v.limb_rightarm_slider_smooth ?? v.limb_rightarm_slider_exact, v.limb_rightarm_slider_exact, 0.1);",
                    "v.limb_legs_slider_exact = t.limb_Legs_slider ?? 0.0;",
                    "v.limb_legs_slider_smooth = (math.abs(v.limb_legs_slider_smooth - v.limb_legs_slider_exact) > v.max_distance_slider) ? v.limb_legs_slider_exact : math.lerp(v.limb_legs_slider_smooth ?? v.limb_legs_slider_exact, v.limb_legs_slider_exact, 0.1);",
                    // Debuff icons
                    "v.thirst_debuff = v.thirst_slider_smooth <= 0.0;",
                    "v.limb_debuff = (v.limb_head_slider_smooth <= 0.25) || (v.limb_body_slider_smooth <= 0.0) || (v.limb_leftarm_slider_smooth <= 0.0) || (v.limb_rightarm_slider_smooth <= 0.5) || (v.limb_legs_slider_smooth <= 0.5);",
                    "v.temperature_debuff = (v.temp_debuff_cold) || (v.temp_debuff_frostbite) || (v.temp_debuff_hypothermia) || (v.temp_debuff_warm) || (v.temp_debuff_overheat) || (v.temp_debuff_heatstroke);",
                    "v.temp_debuff_cold = v.temp_slider_smooth >= 0.125 && v.temp_slider_smooth <= 0.25;",
                    "v.temp_debuff_frostbite = v.temp_slider_smooth > 0.0 && v.temp_slider_smooth <= 0.125;",
                    "v.temp_debuff_hypothermia = v.temp_slider_smooth <= 0.0;",
                    "v.temp_debuff_warm = v.temp_slider_smooth >= 0.75 && v.temp_slider_smooth <= 0.875;",
                    "v.temp_debuff_overheat = v.temp_slider_smooth > 0.875 && v.temp_slider_smooth < 1.0;",
                    "v.temp_debuff_heatstroke = v.temp_slider_smooth >= 1.0;"
                ],
                "animate": [
                    "sliders",
                    {
                        "mainhand_offsets": "!v.is_offhand"
                    },
                    {
                        "offhand_offsets": "v.is_offhand"
                    }
                ]
            },
            "render_controllers": [
                {
                    "controller.render.oct_db.health_menu.mainhand": "!v.is_offhand && !q.is_in_ui && !t.is_paperdoll && context.is_first_person"
                },
                {
                    "controller.render.oct_db.health_menu.offhand": "v.is_offhand && !q.is_in_ui && !t.is_paperdoll && context.is_first_person && v.should_show_offhand"
                },
                {
                    "controller.render.oct_db.damaged_limb.head": "!c.is_first_person"
                },
                {
                    "controller.render.oct_db.damaged_limb.body": "!c.is_first_person"
                },
                {
                    "controller.render.oct_db.damaged_limb.leftArm": "!c.is_first_person"
                },
                {
                    "controller.render.oct_db.damaged_limb.rightArm": "!c.is_first_person"
                },
                {
                    "controller.render.oct_db.damaged_limb.legs": "!c.is_first_person"
                }
            ]
        }
    }
}