How do you get the drawtype of a node?

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

How do you get the drawtype of a node?

by lkjoel » Thu Apr 12, 2012 21:19

I'm trying to figure out some code that finds the drawtype of a node. How would I go about doing this?
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Thu Apr 12, 2012 21:31

You cannot get the drawtype of a node itself (as far as I know). You can only get some other parameters, e.g. if it is flammable / walkable.
Redstone for minetest: Mesecons (mesecons.net)
 

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

by lkjoel » Thu Apr 12, 2012 21:34

ok, I'll have to edit the modding API then...
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.
 

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

by celeron55 » Thu Apr 12, 2012 22:08

Hell, people are always giving wrong answers on this forum...

Yes you can find the drawtype of a node; everything given to minetest.register_node is put into the minetest.registered_nodes table.

Thus: (not tested)
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
local function get_node_drawtype(nodename)
    if not minetest.registered_nodes[nodename] then
        return ""
    end
    return minetest.registered_nodes[nodename].drawtype
end
 

lkjoel
Member
 
Posts: 778
Joined: Wed Feb 29, 2012 19:27

by lkjoel » Thu Apr 12, 2012 23:03

thanks! It works!
My mods: The Nether | Doctor Who (WIP)

I have quit minetest ... again. I am heavily unimpressed by both the game and the community.
 

User avatar
Jeija
Member
 
Posts: 686
Joined: Fri Dec 23, 2011 21:46

by Jeija » Fri Apr 13, 2012 05:29

Sorry, I didn't know that. Could you add some information about this to the lua_api.txt (if there is none yet)? Like "you can acces the information in a node simply by writing node.*.
Once Iw tried to get e.g. the texture of a node, back then it didn't work at all.
Redstone for minetest: Mesecons (mesecons.net)
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 8 guests

cron