Glowing Trees


Adds a glowing aura to the trees, and bioluminescence for foliage and decoratives.

Tweaks
a day ago
1.1 - 2.0
2.68K
Environment

b Hand or agricultural tower planted trees don't glow.

a month ago

Hi,

I really love this mod especially with some of the dark night mods.

I checked even fully grown trees, form SA tree-seed, planted by hand or agricultural tower, wont have that nice glow the map gen trees have.

29 days ago

Great suggestion, I totally overlooked seed-grown trees when I updated it for 2.0/space age. I've included them in today's update.

29 days ago
(updated 29 days ago)

Hey,
I checked it and have a fix proposal, the tree-s growing from the seeds, are not data.raw.tree, but data.raw.plant["tree-plant"], if I iterate through those and apply your changes even hovering the mouse on planted tree will show, that it is modified by the glowing tree's mod.

This also works on seeds generated by other mods.

for name, plant in pairs(data.raw.plant) do
    if plant.variations then
        for _, variation in pairs(plant.variations) do
            local light = util.table.deepcopy(variation.leaves)
            local sprite = util.table.deepcopy(variation.leaves)

            local scale_modifier = 5
            local color = plant.colors[math.random(1, #plant.colors)]
            color = divide_color(color, 10)
            set_animation_scale_recursive(light, scale_modifier)
            set_animation_scale_recursive(sprite, scale_modifier)
            draw_as_light_recursive(light)
            draw_as_light_recursive(sprite)
            set_tint_recursive(light, color)
            set_tint_recursive(sprite, color)

            if glow_leaves_chance >= math.random() then
                if variation.leaves then
                    draw_as_glow_recursive(variation.leaves)
                end
            end

            local glow_overlay_layers = {
                layers = {}
            }
            if variation.overlay then
                local animation = util.table.deepcopy(variation.overlay)
                table.insert(glow_overlay_layers.layers, animation)
            end
            if glow_aura_light_chance >= math.random() then
                table.insert(glow_overlay_layers.layers, light)
            end
            if glow_aura_haze_chance >= math.random() then
                table.insert(glow_overlay_layers.layers, sprite)
            end
            if glow_overlay_layers.layers[1] then
                variation.overlay = glow_overlay_layers
            end
        end
    end
end

New response