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

-- WATER
if (not dp.water_source) or (not dp.water_flowing) then

    -- WATER SOURCE
    dp.water_source = m7a.register_node("natural_habitat:water_source", {
        description = S("Water Source"),
        drawtype = "liquid",
        waving = 3,
        tiles = {
            {
                name = "nbt_water_source_animation.png",
                backface_culling = false,
                animation = {
                    type = "vertical_frames",
                    aspect_w = 16,
                    aspect_h = 16,
                    length = 2.0,
                },
            },
            {
                name = "nbt_water_source_animation.png",
                backface_culling = true,
                animation = {
                    type = "vertical_frames",
                    aspect_w = 16,
                    aspect_h = 16,
                    length = 2.0,
                },
            },
        },
        use_texture_alpha = "blend",
        paramtype = "light",
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "source",
        liquid_alternative_flowing = "natural_habitat:water_flowing",
        liquid_alternative_source = "natural_habitat:water_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
        groups = {water = 3, liquid = 3, cools_lava = 1},
        sounds = {},
    })

    core.register_alias("mapgen_water_source", dp.water_source);
    core.register_alias("water_source", dp.water_source);

    -- WATER FLOWING
    dp.water_flowing = m7a.register_node("natural_habitat:water_flowing", {
        description = S("Flowing Water"),
        drawtype = "flowingliquid",
        waving = 3,
        tiles = {"nbt_water.png"},
        special_tiles = {
            {
                name = "nbt_water_source_animation.png",
                backface_culling = false,
                animation = {
                    type = "vertical_frames",
                    aspect_w = 16,
                    aspect_h = 16,
                    length = 0.5,
                },
            },
            {
                name = "nbt_water_source_animation.png",
                backface_culling = true,
                animation = {
                    type = "vertical_frames",
                    aspect_w = 16,
                    aspect_h = 16,
                    length = 0.5,
                },
            },
        },
        use_texture_alpha = "blend",
        paramtype = "light",
        paramtype2 = "flowingliquid",
        walkable = false,
        pointable = false,
        diggable = false,
        buildable_to = true,
        is_ground_content = false,
        drop = "",
        drowning = 1,
        liquidtype = "flowing",
        liquid_alternative_flowing = "natural_habitat:water_flowing",
        liquid_alternative_source = "natural_habitat:water_source",
        liquid_viscosity = 1,
        post_effect_color = {a = 103, r = 30, g = 60, b = 90},
        groups = {water = 3, liquid = 3, not_in_creative_inventory = 1,
            cools_lava = 1},
        sounds = {},
    })
    
    core.register_alias("mapgen_water_flowing", dp.water_flowing);
    core.register_alias("water_flowing", dp.water_flowing);
end;