local S = core.get_translator(core.get_current_modname());
local dp = natural_habitat.dupes;

if not dp.kniphofia then
    dp.kniphofia = "natural_habitat:kniphofia";
    
    core.register_node(dp.kniphofia, {
        description = S("Kniphofia"),
        drawtype = "mesh",
        mesh = "nbt_flower_kniphofia.obj",
        tiles = { "nbt_flower_kniphofia.png", },
        use_texture_alpha = "clip",
        paramtype = "light",
        paramtype2 = "facedir",
        selection_box = {type = "fixed", fixed = {{-0.3, -0.5, -0.3, 0.3, 0.6, 0.3}}},
        groups = m7a.impact(
            { snappy=3, flower=1, flora=1, attached_node=1 },
            {
                ["mineclonia"] = {
                    attached_node=1, deco_block=1, dig_by_piston=1, dig_immediate=3,
                    dig_by_water=1, destroy_by_lava_flow=1, enderman_takable=1,
                    plant=1, flower=1, place_flowerlike=1, non_mycelium_plant=1,
                    flammable=2, fire_encouragement=60, fire_flammability=100,
                    compostability=65, unsticky=1,
                },
            }
        ),
        place_on = {
            dp.soil, dp.soil_with_grass, "default:dirt_with_dry_grass",
            "default:dry_dirt_with_dry_grass",
        },
        walkable = false,
        sounds = natural_habitat.sound_leaves(),
        sunlight_propagates = true,
        on_place = function(itemstack, placer, pointed_thing)
            return m7a.place_item(itemstack, placer, pointed_thing).itemstack;
        end,
        rotation = "random",
    });
    
    core.register_decoration({
        deco_type = "simple",
        decoration = dp.kniphofia,
        place_on = {
            dp.soil, dp.soil_with_grass, "default:dirt_with_dry_grass",
            "default:dry_dirt_with_dry_grass",
        },
        fill_ratio = 0.001,
        biomes = { dp.biomes.savanna },
        spawn_by = "air",
        num_spawn_by = 1,
        y_min = 5,
        y_max = 31000,
    });
end;