'Leveled' nodebox type used anywhere?

Termos
Member
 
Posts: 227
Joined: Sun Dec 16, 2018 12:50

'Leveled' nodebox type used anywhere?

by Termos » Sun Feb 17, 2019 13:56

Does anyone know of any mod or subgame that uses node_box.type = 'leveled'?
I need to test my pathfinding algorithm with an actual implementation of this.
 

User avatar
TenPlus1
Member
 
Posts: 2625
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: 'Leveled' nodebox type used anywhere?

by TenPlus1 » Sun Feb 17, 2019 17:52

The "Snow Biomes" mod uses levelled nodes to have different height snowblocks on the ground which can pile up when the snow is falling or placed by player: viewtopic.php?t=2290
 

Termos
Member
 
Posts: 227
Joined: Sun Dec 16, 2018 12:50
 

Sokomine
Member
 
Posts: 3886
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: 'Leveled' nodebox type used anywhere?

by Sokomine » Sun Feb 17, 2019 18:58

I've also added leveled nodeboxes very recently for the hay generated in my cottages mod.

Leveled nodes seem to have a strange and intresting effect. When I was experimenting with them, I added a small function that let each punch to the node increase its level metadata by one. After some standing on the node and happily punching, I noticed that my character moved upwards.

This makes for an entertaining - but very slow - lift:
Code: Select all
minetest.register_node("leveled:lift", {
        drawtype = "nodebox",
        paramtype2 = "leveled",
        description = "lift",
        tiles = {"default_stone.png"},
        groups = {cracky=3,snappy=3,choppy=3,oddly_breakable_by_hand=3,flammable=3},
        is_ground_content = false,
        node_box = {
                type = "leveled", --"fixed",
                fixed = {
                                {-0.5,-0.5,-0.5, 0.5, 0.5, 0.5},
                        }
        },     
        after_place_node = function(pos, placer, itemstack, pointed_thing)
                local timer = minetest.get_node_timer(pos)
                if not timer:is_started() then
                        timer:start(1)
                end
        end,
        on_punch = function(pos, node, puncher, pointed_thing)
                local node = minetest.get_node(pos)
                minetest.swap_node(pos, {name=node.name, param2=(node.param2+1)})
        end,   
        on_timer = function(pos, elapsed)     
                local node = minetest.get_node(pos)
                if( node.param2 > 64 ) then
                        minetest.swap_node( pos, {name="default:glass"})
                        pos.y = pos.y + 1
                        minetest.set_node(pos, {name=node.name, param2=0})
                else
                        minetest.swap_node(pos, {name=node.name, param2=(node.param2+2)})
                end
                local timer = minetest.get_node_timer(pos)
                if not timer:is_started() then
                        timer:start(1)
                end
        end,
})
A list of my mods can be found here.
 

Termos
Member
 
Posts: 227
Joined: Sun Dec 16, 2018 12:50

Re: 'Leveled' nodebox type used anywhere?

by Termos » Sun Feb 17, 2019 22:01

This may be a more general issue, I noticed my mobs when walking on nodes adjacent to nodes with snow on top of them sometimes do small jumps for no reason, even though in MTG snow is fixed rather than leveled. Strange that this doesn't occur near slabs which are very similar nodedef.

Why swap nodes instead of calling add_node_level?
 

Sokomine
Member
 
Posts: 3886
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

Re: 'Leveled' nodebox type used anywhere?

by Sokomine » Sun Feb 17, 2019 23:18

Termos wrote:Why swap nodes instead of calling add_node_level?

I wasn't aware of that function.
A list of my mods can be found here.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 5 guests