bgsmithjr wrote:minetest.env:add_node( pos, { name = 'beds:blue_top', param2=2} ) doesn't work is still faces to the x coordinate of position
paramtype = "light",
paramtype2 = "facedir",
minetest.register_node("3dforniture:toilet", {
description = 'Toilet',
tiles = {
"forniture_marble.png",
"forniture_marble.png",
"forniture_marble_s1.png",
"forniture_marble_s1.png",
"forniture_marble_s2.png",
"forniture_marble_s2.png",
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = 'facedir',
node_box = {
type = "fixed",
fixed = {
{-0.2,-0.5,-0.2, 0.2,-0.45,0.5},
{-0.1,-0.45,-0.1, 0.1,0,0.5},
{-0.3,-0.2,-0.3, 0.3,0,0.35},
{-0.25,0,-0.25, 0.25,0.05,0.25},
{-0.3,0,0.3, 0.3,0.4,0.5},
{-0.05,0.4,0.35, 0.05,0.45,0.45},
},
},
drop = "3dforniture:toilet",
groups = {cracky=2,}
})
minetest.register_node("3dforniture:toilet_open", {
description = 'Toilet',
tiles = {
"forniture_marble_top_toilet.png",
"forniture_marble.png",
"forniture_marble_sb1.png",
"forniture_marble_sb1.png",
"forniture_marble_sb2.png",
"forniture_marble_sb2.png",
},
drawtype = "nodebox",
sunlight_propagates = true,
paramtype = 'light',
paramtype2 = 'facedir',
node_box = {
type = "fixed",
fixed = {
{-0.2,-0.5,-0.2, 0.2,-0.45,0.5},
{-0.1,-0.45,-0.1, 0.1,-0.2,0.5},
{-0.1,-0.2,0.3, 0.1,0,0.5},
{-0.3,-0.2,0.1, 0.3,0,0.35},
{-0.3,-0.2,-0.3, -0.1,-0.15,0.1},
{-0.1,-0.2,-0.3, 0.1,-0.15,-0.1},
{0.1,-0.2,-0.3, 0.3,-0.15,0.1},
{-0.3,-0.15,-0.3, -0.2,0,0.1},
{-0.2,-0.15,-0.3, 0.2,0,-0.2},
{0.2,-0.15,-0.3, 0.3,0,0.1},
{-0.25,0,0.2, 0.25,0.5,0.25},
{-0.3,0,0.3, 0.3,0.4,0.5},
},
},
drop = "3dforniture:toilet",
groups = {cracky=2,}
})
-----------------------------------------------------------------
local on_toilet_puncher = function (pos, node, puncher)
if node.name == '3dforniture:toilet' then
minetest.env:add_node({x=1,y=2,z=3}, {name="3dforniture:toilet_open", param2=2 })
nodeupdate(pos)
elseif node.name == '3dforniture:toilet_open' then
minetest.env:add_node({x=1,y=2,z=3}, {name="3dforniture:toilet", param2=2 })
nodeupdate(pos)
end
end
minetest.register_on_punchnode(on_toilet_puncher)
neo wrote:" not ', same for light. : )
minetest.env: add_node ({x = 1, y = 2, z = 3}, {name = "3dforniture: toilet_open", param = 1, param2 = 2})
Nodes
------
Nodes are the bulk data of the world: cubes and other things that take the
space of a cube. Huge amounts of them are handled efficiently, but they
are quite static.
The definition of a node is stored and can be accessed by name in
minetest.registered_nodes[node.name]
See "Registered definitions of stuff".
Nodes are passed by value between Lua and the engine.
They are represented by a table:
{name="name", param1=num, param2=num}
param1 and param2 are 8 bit and 4 bit integers, respectively. The engine
uses them for certain automated functions. If you don't use these
functions, you can use them to store arbitrary values.
The functions of param1 and param2 are determined by certain fields in the
node definition:
param1 is reserved for the engine when paramtype != "none":
paramtype = "light"
^ The value stores light with and without sun in it's
upper and lower 4 bits.
param2 is reserved for the engine when any of these are used:
liquidtype == "flowing"
^ The level and some flags of the liquid is stored in param2
drawtype == "flowingliquid"
^ The drawn liquid level is read from param2
drawtype == "torchlike"
drawtype == "signlike"
paramtype2 == "wallmounted"
^ The rotation of the node is stored in param2. You can make this value
by using minetest.dir_to_wallmounted().
paramtype2 == "facedir"
^ The rotation of the node is stored in param2. Furnaces and chests are
rotated this way. Can be made by using minetest.dir_to_facedir().
Users browsing this forum: No registered users and 15 guests