Page 1 of 1

How to make a transparent block like leaves with images on 2 sides?

PostPosted: Sat Sep 14, 2013 13:11
by Neuromancer
I'm trying to make a block that looks like leaves(you can see through empty spaces) but only has images on 2 sides of the block.

The problem with my first attempt below is that it allows you to see through the ground when placing the node.
minetest.register_node("bushes:BushQuarterBranches", {
description = "BushQuarterBranches",
tiles = {
"blank.png",
"blank.png",
"BlockBranch1Lsm.png",
"BlockBranch1Rsm.png",
"blank.png",
"blank.png",},
inventory_image = "BlockBranch1Lsm.png",
is_ground_content = true,
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3},
sounds = default.node_sound_stone_defaults(),
})


The problem with this block is that all the images are invisible, (good news is you can't see through the ground)
minetest.register_node("bushes:BushQuarterBranches2", {
description = "BushQuarterBranches2",
drawtype = "allfaces_optional",
tiles = {
"blank.png",
"blank.png",
"BlockBranch1Lsm.png",
"BlockBranch1Rsm.png",
"blank.png",
"blank.png",},
paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1},
sounds = default.node_sound_leaves_defaults(),
})

What can I do so I can see my images on 2 sides without seeing through the ground?

Here's the whole very-simple mod if it helps (just registers 3 nodes and some textures)
https://www.dropbox.com/s/f0lmbaz4njscajf/bushes.zip

PostPosted: Sat Sep 14, 2013 15:33
by ak399g
drawtype = glasslike?

PostPosted: Sat Sep 14, 2013 16:03
by Mossmanikin
How about 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_node("bushes:BushQuarterBranches2", {
    description = "BushQuarterBranches2",
    drawtype = "nodebox",
    tiles = {
        "blank.png",
        "blank.png",
        "BlockBranch1Lsm.png",
        "BlockBranch1Rsm.png",
        "blank.png",
        "blank.png"
    },
    node_box = {
        type = "fixed",
        fixed = {
            {-1/2, -1/2, -1/2, -1/2, 1/2, 1/2},
            {1/2, -1/2, -1/2, 1/2, 1/2, 1/2}
        },
    },
    selection_box = {
        type = "fixed",
        fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
    },
    inventory_image = "BlockBranch1Rsm.png",
    paramtype = "light",
    groups = {tree=1, snappy=3, flammable=2, leaves=1},
    sounds = default.node_sound_leaves_defaults(),
})

The panes are two-sided, but maybe it's even cooler like that.

EDIT: gramma

PostPosted: Sat Sep 14, 2013 16:07
by Neuromancer
ak399g wrote:drawtype = glasslike?

I gave it a try. All sides still invisible. It gave me an idea to use signlike and just have 1 image per node, but the image shows up only on top of the block when I do this

minetest.register_node("bushes:BushQuarterBranches3", {
description = "BushQuarterBranches3",
drawtype = "signlike",
tile_images = {
"BlockBranch1Rsm.png" },
inventory_image = "BlockBranch1Lsm.png",
paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1},
sounds = default.node_sound_leaves_defaults(),
})

And all sides invisible when I do this:
minetest.register_node("bushes:BushQuarterBranches2", {
description = "BushQuarterBranches2",
drawtype = "signlike",
tile_images = {
"blank.png",
"BlockBranch1Rsm.png",
"BlockBranch1Lsm.png",
"BlockBranch1Rsm.png",
"BlockBranch1Lsm.png",
"BlockBranch1Rsm.png",},
inventory_image = "BlockBranch1Lsm.png",
paramtype = "light",
groups = {snappy=3, flammable=2, leaves=1},
sounds = default.node_sound_leaves_defaults(),
})

PostPosted: Sat Sep 14, 2013 16:22
by Neuromancer
Mossmanikin wrote:How about 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_node("bushes:BushQuarterBranches2", {
    description = "BushQuarterBranches2",
    drawtype = "nodebox",
    tiles = {
        "blank.png",
        "blank.png",
        "BlockBranch1Lsm.png",
        "BlockBranch1Rsm.png",
        "blank.png",
        "blank.png"
    },
    node_box = {
        type = "fixed",
        fixed = {
            {-1/2, -1/2, -1/2, -1/2, 1/2, 1/2},
            {1/2, -1/2, -1/2, 1/2, 1/2, 1/2}
        },
    },
    selection_box = {
        type = "fixed",
        fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
    },
    inventory_image = "BlockBranch1Rsm.png",
    paramtype = "light",
    groups = {tree=1, snappy=3, flammable=2, leaves=1},
    sounds = default.node_sound_leaves_defaults(),
})

The panes are two-sided, but maybe it's even cooler like that.

EDIT: gramma


That's better, but don't nodeboxes hurt performance? I'm hoping I can get signlike to work, then place 4 blocks so the branches radiate outward in 4 directions, If I could just get it to stop displaying the image on the top of the block and instead do it on the side.

PostPosted: Sat Sep 14, 2013 16:25
by Mossmanikin
Neuromancer wrote:That's better, but don't nodeboxes hurt performance?


Complex nodeboxes hurt performance. I'm not sure about something as simple as this.

PostPosted: Sat Sep 14, 2013 17:28
by Neuromancer
Mossmanikin wrote:
Neuromancer wrote:That's better, but don't nodeboxes hurt performance?


Complex nodeboxes hurt performance. I'm not sure about something as simple as this.

Is there any way to get them at a right angle to each other instead of parallel?

PostPosted: Sat Sep 14, 2013 17:42
by Mossmanikin
Neuromancer wrote:Is there any way to get them at a right angle to each other instead of parallel?


If you mean a "+" shape (seen from above):

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
    node_box = {
        type = "fixed",
        fixed = {
--       {left,bottom,front,right,top,back}
            {0, -1/2, -1/2, 0, 1/2, 1/2},
            {-1/2, -1/2, 0, 1/2, 1/2, 0}
        },
    },

PostPosted: Thu Jan 23, 2014 21:44
by wtfsamcrap
use tiles GIMP is my friend :D

PostPosted: Fri Mar 14, 2014 08:48
by artur99
look, for example in defautl mod, for glass, it is used:
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("default:glass", {
    description = "Glass",
    drawtype = "glasslike",
    tiles = {"default_glass.png"},
    inventory_image = minetest.inventorycube("default_glass.png"),
    paramtype = "light",
    sunlight_propagates = true,
    groups = {cracky=3,oddly_breakable_by_hand=3},
    sounds = default.node_sound_glass_defaults(),
})


You should have those 2 tiles and 1 png transparent image.
and replace 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
tiles = {"default_glass.png"},

With the tiles name(those 2 with the png image, and 4 with the transparent image)