Can this do this?

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

Can this do this?

by Jordach » Sat Jun 02, 2012 17:41

What I am asking is: can a simple abm support using any node without having to do this:

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
nodenames = "default:dirt" "default:stone"
and so on?

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Sat Jun 02, 2012 19:04

perhaps if you tweaked builtins' register_node to add all the nodenames to a global array and use that?
Last edited by mauvebic on Sat Jun 02, 2012 19:04, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Sat Jun 02, 2012 19:10

like this (builtin/misc_register.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
ALLNODES = {}  -- new
function minetest.register_node(name, nodedef)
    nodedef.type = "node"
    minetest.register_item(name, nodedef)
    table.insert(ALLNODES, name)  -- new
end


then you have an array of all the nodenames to use with your abm
Last edited by mauvebic on Sat Jun 02, 2012 19:10, edited 1 time in total.
"Fuck the hat." - Paulie Gualtieri
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sat Jun 02, 2012 19:14

So how would this work for nodenames = all ?

EDIT: Something like this:

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
minetest.register_abm(
        {nodenames =
        interval = 1,
        chance = 1,
        action = function(pos)
                minetest.env:add_node(pos, {name="default:dirt_with_grass"})
        end,
})


I am lost.
Last edited by Jordach on Sat Jun 02, 2012 19:17, edited 1 time in total.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Jun 02, 2012 19:28

What are you going to do with such an ABM?

Do you realize having a chance higher than, say, 1/1000 (to only randomly affect one out of a thousand nodes) will completely screw the functioning of the server by overloading it insanely?
 

User avatar
Jordach
Member
 
Posts: 4412
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach

by Jordach » Sat Jun 02, 2012 19:55

celeron55 wrote:What are you going to do with such an ABM?

Do you realize having a chance higher than, say, 1/1000 (to only randomly affect one out of a thousand nodes) will completely screw the functioning of the server by overloading it insanely?

It's not for that use, just as a complete test, that code is a placeholder for the time being.

EDIT: More thought - this also means, we would have to go through every node in madblocks, allowing it to either have stuff on it or not, with something like this, it should just look at the drawtype and go, yes you're a solid block, put snow on you.
Last edited by Jordach on Sat Jun 02, 2012 19:58, edited 1 time in total.

( ͡° ͜ʖ ͡°) ( ͡o ͜ʖ ͡o) [$ ( ͡° ͜ʖ ͡°) $] ( ͡$ ͜ʖ ͡$) ヽ༼ຈل͜ຈ༽ノ



My image and media server is back online and is functioning as normal.
 

User avatar
mauvebic
Member
 
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Sun Jun 03, 2012 13:24

well heres my winter abm:

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
            if CURRENT_SEASON == 1 then
                if node.name == 'madblocks:grass_autumn' or node.name == 'default:dirt_with_grass' or node.name == 'madblocks:grass_spring' then
                    minetest.env:add_node(pos,{type="node",name='madblocks:grass_winter'})
                elseif node.name == 'madblocks:leaves_autumn' or node.name == 'default:leaves' or node.name == 'madblocks:leaves_spring' then
                    minetest.env:add_node(pos,{type="node",name='madblocks:leaves_winter'})

                elseif node.name == 'default:desert_sand' then
                    above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
                    if above ~= nil and above.name == 'air' then
                        minetest.env:add_node(pos,{type="node",name='madblocks:desertsand_winter'})
                    end
                elseif node.name == 'default:sand' then
                    above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
                    if above ~= nil and above.name == 'air' then
                        minetest.env:add_node(pos,{type="node",name='madblocks:sand_winter'})
                    end
                elseif node.name == 'default:cactus' then
                    above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
                    if above ~= nil and above.name == 'air' then
                        minetest.env:add_node(pos,{type="node",name='madblocks:cactus_winter'})
                    end
                elseif node.name == 'default:water_source' then
                    above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
                    if above ~= nil and above.name == 'air' then
                        minetest.env:add_node(pos,{type="node",name='madblocks:ice_source'})
                    end
                elseif node.name == 'default:water_flowing' then
                    above = minetest.env:get_node_or_nil({x=pos.x,y=pos.y+1,z=pos.z})
                    if above ~= nil and above.name == 'air' then
                        minetest.env:add_node(pos,{type="node",name='madblocks:ice_flowing'})
                    end
                end


from what i understand, you want to use a < snow > node and place it ontop of anything thats solid and has air on top?

I think celerons' right having an ABM that works on such a massive scale would slow the game down. Hell i had to get rid of electricity in madblocks to make up the performance gobbled up by weather (and it still lags abit at the solstices)

heads up - If youre thinking of adding lua-entity falling snowflakes, dont test it out on a world you intend to keep, i ruined my last city that way lol

Hey celeron, is there a way we could add/change a texture to 'air' nodes to simlulate rain/snow? would be hella more easy than generating falling nodes or lua entities hehe. If we could change the skybox and cloud colors we could even simulate storms :-)
"Fuck the hat." - Paulie Gualtieri
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 19 guests

cron