facedir during minetest.env:add_node

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

facedir during minetest.env:add_node

by bgsmithjr » Thu Mar 29, 2012 13:15

How do you use facedir when using minetest.env:add_node?
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Mar 29, 2012 14:27

minetest.env:add_node({x=1,y=2,z=3},{name="whatever",param2=2})
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Thu Mar 29, 2012 15:44

Thanks.
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Thu Mar 29, 2012 18:47

minetest.env:add_node( pos, { name = 'beds:blue_top', param2=2} ) doesn't work is still faces to the x coordinate of position
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Thu Mar 29, 2012 18:50

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

Try param1 or another value
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
tonyka
Member
 
Posts: 320
Joined: Sat Jun 16, 2012 04:08

by tonyka » Sat Jun 30, 2012 01:36

I've been trying ...
and it works, but I can not work with objects type nodebox ...
I guess Ahun not developed entirely these objects ...
know any way to do this?
thanks

sorry for my bad English ...
My mod: [MOD]3D Forniture 1.0
Download: 3DForniture_v_1.0.zip
Page development (European Castilian):
Moviliario 3D (proyecto 3D Forniture)
 

neo
Member
 
Posts: 56
Joined: Fri Jun 15, 2012 07:50

by neo » Sat Jun 30, 2012 13:03

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
paramtype = "light",
paramtype2 = "facedir",
 

User avatar
tonyka
Member
 
Posts: 320
Joined: Sat Jun 16, 2012 04:08

by tonyka » Sat Jun 30, 2012 13:25

so I have it but does not work ....
My code is as follows ...

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_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)
My mod: [MOD]3D Forniture 1.0
Download: 3DForniture_v_1.0.zip
Page development (European Castilian):
Moviliario 3D (proyecto 3D Forniture)
 

neo
Member
 
Posts: 56
Joined: Fri Jun 15, 2012 07:50

by neo » Sat Jun 30, 2012 14:29

" not ', same for light. : )
 

User avatar
tonyka
Member
 
Posts: 320
Joined: Sat Jun 16, 2012 04:08

by tonyka » Sat Jun 30, 2012 17:25

neo wrote:" not ', same for light. : )

sorry for keep asking, the closest thing I've done has been "basic" in my ZX Spectrum ...

then would it be?

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.env: add_node ({x = 1, y = 2, z = 3}, {name = "3dforniture: toilet_open", param = 1, param2 = 2})


this does not work, as I do? some example if possible?
thanks ...
My mod: [MOD]3D Forniture 1.0
Download: 3DForniture_v_1.0.zip
Page development (European Castilian):
Moviliario 3D (proyecto 3D Forniture)
 

neo
Member
 
Posts: 56
Joined: Fri Jun 15, 2012 07:50

by neo » Sun Jul 01, 2012 00:08

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().



Note the == it's important.

Everything is the /doc/lua_api.txt

Great document, tx to celeron55 who wrote this goldmine :)
 

User avatar
tonyka
Member
 
Posts: 320
Joined: Sat Jun 16, 2012 04:08

by tonyka » Sun Jul 01, 2012 00:18

thanks! I'll try :D
My mod: [MOD]3D Forniture 1.0
Download: 3DForniture_v_1.0.zip
Page development (European Castilian):
Moviliario 3D (proyecto 3D Forniture)
 

leetelate
Member
 
Posts: 205
Joined: Thu Aug 29, 2013 18:07

by leetelate » Fri Sep 13, 2013 23:52

thanks from me too now

the most very basic facedirs:
0 is moving x-1
1 is moving z+1
2 is moving x+1
3 is moving z-1

source: had to test it - the doc is minetest.facedir_from_dir - it returns facedir from a 3d dir
MT IS MC'S SMARTER BROTHER
minetest 0.4.8 compiled from latest git on linux mint 15 with qjoypad and wired 360 controller
freeminer, pilztest, buildcraft and next are the idea factories
my minetest page is http://1337318.zymichost.com if zymic isn't down - meh, it is free...
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 7 guests

cron