Page 1 of 1

Some checks needed...

PostPosted: Wed Feb 29, 2012 15:24
by wieszak
Some oddities (0.4.dev):
- underwater torches - i think maybe there should be glass+torch = some kind of lamp, which can be used underwater, but this is lets say just funny.
Image
- underwater samplings - i don't mind putting it underwater, but they grows there ;) and grows only as wood without leaves:
Image
- and something bizzare: two cactuses gone wild:
Image
such fanciness is probably too much.. i know this is ideal fuel for cooking but... maybe some volume check ? stop growing after reaching some predefined value ?

PostPosted: Wed Feb 29, 2012 15:35
by sfan5
wieszak wrote:Some oddities (0.4.dev):
- underwater torches - i think maybe there should be glass+torch = some kind of lamp, which can be used underwater, but this is lets say just funny.
Image
- underwater samplings - i don't mind putting it underwater, but they grows there ;) and grows only as wood without leaves:
Image
- and something bizzare: two cactuses gone wild:
Image
such fanciness is probably too much.. i know this is ideal fuel for cooking but... maybe some volume check ? stop growing after reaching some predefined value ?

Cactii doesn't grow normally

PostPosted: Wed Feb 29, 2012 18:08
by RAPHAEL
I've never seen such wild cacti lol

PostPosted: Wed Feb 29, 2012 18:47
by wokste
Maybe adding an option in lua to tell that a node cannot be placed in a liquid.

PostPosted: Wed Feb 29, 2012 21:20
by sdzen
he is using the nature mod i see

PostPosted: Wed Feb 29, 2012 21:49
by wieszak
Yes, i'm using nature mod.
I just patched it using some code from mineral detector:
cactus.lua:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- Cactus growing

minetest.register_abm({
    nodenames = { "default:cactus" },
    interval = 7200,
    chance = 25,

    action = function(pos, node, active_object_count, active_object_count_wider)
        -- Grow with a chance (choosing which side to grow)

        local search_distance = 10
        local cactus_found = 0

        for p_x=(pos.x-search_distance), (pos.x+search_distance) do
                for p_y=(pos.y-search_distance), (pos.y+search_distance) do
                        for p_z=(pos.z-search_distance), (pos.z+search_distance) do
                                local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})

                                if search_n.name == "default:cactus" then
                                        cactus_found = cactus_found + 1
                                end
                        end
                end
        end
        if cactus_found < 15 then
                for i = -1, 1 do
                for j = 0, 1 do
                for k = -1, 1 do
                    if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
                        if (math.random(1, 30) == 1) then
                                local new_pos = {
                                        x = pos.x + i,
                                        y = pos.y + j,
                                        z = pos.z + k
                                }
                                if (minetest.env:get_node(new_pos).name == "air") then
                                        minetest.env:add_node(new_pos, {name = "default:cactus"})
                                        print ('[nature] A cactus has grown at (' .. new_pos.x .. ',' .. new_pos.y .. ',' .. new_pos.z .. ')')
                                end
                        end
                    end
                end
                end
                end
        end
    end
})


BTW. is there already or is considered in mod API function like find_nodes_in_radius ? returning table of positions or at least count ?

PostPosted: Thu Mar 01, 2012 02:18
by Death Dealer
Ya had the same cactus infestationXD mountains of cacti. Don't try burning it, it crashed my game almost every time: /

PostPosted: Thu Mar 01, 2012 07:57
by Jordach
Death Dealer wrote:Ya had the same cactus infestationXD mountains of cacti. Don't try burning it, it crashed my game almost every time: /


world edit works for this kinna stuff.

PostPosted: Thu Mar 01, 2012 12:14
by sdzen
//replace default:cactus,air
:)

PostPosted: Thu Mar 01, 2012 12:27
by wieszak
Wow, thanks for the advice ;) Well for this game, since i prevented further growing with this patch i just chop down this... hmm... mutants.
Is this //replace working with unknonwn object also ? I'm assuming yes... I mean the problem is that it happens, not that i have such green mouintain in my game ;)