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

Post Reply
User avatar
Neuromancer
Member
Posts: 958
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

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

by Neuromancer » Post

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
Last edited by Neuromancer on Sat Sep 14, 2013 13:22, edited 1 time in total.

User avatar
ak399g
Member
Posts: 160
Joined: Tue Jul 30, 2013 02:36
In-game: SAFR
Contact:

by ak399g » Post

drawtype = glasslike?
aka SAFR

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

How about something like this

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
Last edited by Mossmanikin on Sat Sep 14, 2013 16:07, edited 1 time in total.

Noob 4 life!
My stuff

User avatar
Neuromancer
Member
Posts: 958
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

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(),
})
Last edited by Neuromancer on Sat Sep 14, 2013 16:08, edited 1 time in total.

User avatar
Neuromancer
Member
Posts: 958
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

Mossmanikin wrote:How about something like this

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.

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

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.

Noob 4 life!
My stuff

User avatar
Neuromancer
Member
Posts: 958
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

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?

User avatar
Mossmanikin
Member
Posts: 599
Joined: Sun May 19, 2013 16:26
Location: where we don't speak english.

by Mossmanikin » Post

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):

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}
        },
    },

Noob 4 life!
My stuff

User avatar
wtfsamcrap
Member
Posts: 25
Joined: Mon Dec 09, 2013 21:23
Location: Look behind you :)
Contact:

by wtfsamcrap » Post

use tiles GIMP is my friend :D
Mods

artur99
Member
Posts: 76
Joined: Fri Feb 22, 2013 17:27
Location: Romania
Contact:

by artur99 » Post

look, for example in defautl mod, for glass, it is used:

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:

Code: Select all

tiles = {"default_glass.png"},
With the tiles name(those 2 with the png image, and 4 with the transparent image)
Last edited by artur99 on Fri Mar 14, 2014 08:48, edited 1 time in total.
Mods: Secret Mod
Contact: PM here or skype: artur1999skype

Post Reply

Who is online

Users browsing this forum: YaCy [Bot] and 15 guests