2014-12-29 11:19:46 -08:00
|
|
|
---
|
|
|
|
title: Node Drawtypes
|
|
|
|
layout: default
|
|
|
|
root: ../
|
|
|
|
---
|
|
|
|
|
2014-12-31 09:13:28 -08:00
|
|
|
<div class="notice">
|
|
|
|
<h2>This chapter is incomplete</h2>
|
|
|
|
|
|
|
|
Some drawtypes have not been explained yet,
|
|
|
|
and placeholder images are being used.
|
|
|
|
</div>
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Introduction
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
In this chapter we explain all the different types of node drawtypes there are.
|
|
|
|
|
2014-12-29 11:40:32 -08:00
|
|
|
First of all, what is a drawtype?
|
|
|
|
A drawtype defines how the node is to be drawn.
|
|
|
|
A torch looks different to water, water looks different to stone.
|
2014-12-29 11:19:46 -08:00
|
|
|
|
2014-12-31 08:51:24 -08:00
|
|
|
The string you use to determine the drawtype in the node definition is the same as
|
|
|
|
the title of the sections, except in lower case.
|
|
|
|
|
2014-12-29 11:19:46 -08:00
|
|
|
* Normal
|
|
|
|
* Airlike
|
2014-12-31 08:51:24 -08:00
|
|
|
* Liquid
|
|
|
|
* FlowingLiquid
|
2014-12-29 11:19:46 -08:00
|
|
|
* Glasslike
|
|
|
|
* Glasslike_Framed
|
|
|
|
* Glasslike_Framed_Optional
|
|
|
|
* Allfaces
|
|
|
|
* Allfaces_Optional
|
|
|
|
* Torchlike
|
|
|
|
* Nodebox
|
|
|
|
|
|
|
|
This article is not complete yet. These drawtypes are missing:
|
|
|
|
|
|
|
|
* Signlike
|
|
|
|
* Plantlike
|
|
|
|
* Firelike
|
|
|
|
* Fencelike
|
|
|
|
* Raillike
|
|
|
|
* Mesh
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Normal
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure class="right_image">
|
|
|
|
<img src="{{ page.root }}/static/drawtype_normal.png" alt="Normal Drawtype">
|
|
|
|
<figcaption>
|
|
|
|
Normal Drawtype
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
This is, well, the normal drawtypes.
|
|
|
|
Nodes that use this will be cubes with textures for each side, simple-as.\\
|
|
|
|
Here is the example from the [Nodes, Items and Crafting](nodes_items_crafting.html#registering-a-basic-node) chapter.
|
|
|
|
Notice how you don't need to declare the drawtype.
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("mymod:diamond", {
|
|
|
|
description = "Alien Diamond",
|
|
|
|
tiles = {
|
|
|
|
"mymod_diamond_up.png",
|
|
|
|
"mymod_diamond_down.png",
|
|
|
|
"mymod_diamond_right.png",
|
|
|
|
"mymod_diamond_left.png",
|
|
|
|
"mymod_diamond_back.png",
|
|
|
|
"mymod_diamond_front.png"
|
|
|
|
},
|
|
|
|
is_ground_content = true,
|
|
|
|
groups = {cracky = 3},
|
|
|
|
drop = "mymod:diamond_fragments"
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Airlike
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
These nodes are see through, and thus have no textures.
|
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("myair:air", {
|
|
|
|
description = "MyAir (you hacker you!)",
|
|
|
|
drawtype = "airlike",
|
2015-02-22 02:28:37 -08:00
|
|
|
|
|
|
|
paramtype = "light",
|
2015-01-27 01:59:46 -08:00
|
|
|
-- ^ Allows light to propagate through the node with the
|
|
|
|
-- light value falling by 1 per node.
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
sunlight_propagates = true, -- Sunlight shines through
|
|
|
|
walkable = false, -- Would make the player collide with the air node
|
|
|
|
pointable = false, -- You can't select the node
|
|
|
|
diggable = false, -- You can't dig the node
|
|
|
|
buildable_to = true, -- Nodes can be replace this node.
|
|
|
|
-- (you can place a node and remove the air node
|
|
|
|
-- that used to be there)
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
air_equivalent = true,
|
|
|
|
drop = "",
|
|
|
|
groups = {not_in_creative_inventory=1}
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Liquid
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure class="right_image">
|
|
|
|
<img src="{{ page.root }}/static/drawtype_liquid.png" alt="Liquid Drawtype">
|
|
|
|
<figcaption>
|
|
|
|
Liquid Drawtype
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
These nodes are complete liquid nodes, the liquid flows outwards from position using the flowing liquid drawtype.
|
|
|
|
For each liquid node you should also have a flowing liquid node.
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
-- Some properties have been removed as they are beyond the scope of this chapter.
|
|
|
|
minetest.register_node("default:water_source", {
|
|
|
|
drawtype = "liquid",
|
|
|
|
paramtype = "light",
|
|
|
|
|
|
|
|
inventory_image = minetest.inventorycube("default_water.png"),
|
|
|
|
-- ^ this is required to stop the inventory image from being animated
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2014-12-29 11:19:46 -08:00
|
|
|
tiles = {
|
|
|
|
{
|
|
|
|
name = "default_water_source_animated.png",
|
|
|
|
animation = {
|
2015-01-27 01:59:46 -08:00
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 16,
|
|
|
|
aspect_h = 16,
|
|
|
|
length = 2.0
|
2014-12-29 11:19:46 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2014-12-29 11:19:46 -08:00
|
|
|
special_tiles = {
|
|
|
|
-- New-style water source material (mostly unused)
|
|
|
|
{
|
2015-01-27 01:59:46 -08:00
|
|
|
name = "default_water_source_animated.png",
|
|
|
|
animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 2.0},
|
2014-12-29 11:19:46 -08:00
|
|
|
backface_culling = false,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Behavior
|
|
|
|
--
|
2015-01-27 01:59:46 -08:00
|
|
|
walkable = false, -- The player falls through
|
|
|
|
pointable = false, -- The player can't highlight it
|
|
|
|
diggable = false, -- The player can't dig it
|
|
|
|
buildable_to = true, -- Nodes can be replace this node
|
2014-12-29 11:19:46 -08:00
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
alpha = 160,
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Liquid Properties
|
|
|
|
--
|
|
|
|
drowning = 1,
|
|
|
|
liquidtype = "source",
|
|
|
|
|
|
|
|
liquid_alternative_flowing = "default:water_flowing",
|
|
|
|
-- ^ when the liquid is flowing
|
|
|
|
|
|
|
|
liquid_alternative_source = "default:water_source",
|
|
|
|
-- ^ when the liquid is a source
|
|
|
|
|
|
|
|
liquid_viscosity = WATER_VISC,
|
|
|
|
-- ^ how far
|
|
|
|
|
|
|
|
post_effect_color = {a=64, r=100, g=100, b=200},
|
|
|
|
-- ^ color of screen when the player is submerged
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2014-12-31 08:51:24 -08:00
|
|
|
### FlowingLiquid
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
See default:water_flowing in the default mod in minetest_game, it is mostly
|
|
|
|
the same as the above example
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Glasslike
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure class="right_image">
|
|
|
|
<img src="{{ page.root }}/static/drawtype_glasslike.png" alt="Glasslike Drawtype">
|
|
|
|
<figcaption>
|
|
|
|
Glasslike Drawtype
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
When you place multiple glasslike nodes together, you'll notice that the internal
|
|
|
|
edges are hidden, like this:
|
|
|
|
|
|
|
|
<figure>
|
|
|
|
<img src="{{ page.root }}/static/drawtype_glasslike_edges.png" alt="Glasslike's Edges">
|
|
|
|
<figcaption>
|
|
|
|
Glasslike's Edges
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("default:obsidian_glass", {
|
|
|
|
description = "Obsidian Glass",
|
|
|
|
drawtype = "glasslike",
|
|
|
|
tiles = {"default_obsidian_glass.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
is_ground_content = false,
|
|
|
|
sunlight_propagates = true,
|
|
|
|
sounds = default.node_sound_glass_defaults(),
|
|
|
|
groups = {cracky=3,oddly_breakable_by_hand=3},
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Glasslike_Framed
|
2014-12-29 11:19:46 -08:00
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
This makes the node's edge go around the whole thing with a 3D effect, rather
|
|
|
|
than individual nodes, like the following:
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure>
|
|
|
|
<img src="{{ page.root }}/static/drawtype_glasslike_framed.png" alt="Glasslike_framed's Edges">
|
|
|
|
<figcaption>
|
|
|
|
Glasslike_Framed's Edges
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("default:glass", {
|
|
|
|
description = "Glass",
|
|
|
|
drawtype = "glasslike_framed",
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2014-12-29 11:19:46 -08:00
|
|
|
tiles = {"default_glass.png", "default_glass_detail.png"},
|
|
|
|
inventory_image = minetest.inventorycube("default_glass.png"),
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2014-12-29 11:19:46 -08:00
|
|
|
paramtype = "light",
|
2015-01-27 01:59:46 -08:00
|
|
|
sunlight_propagates = true, -- Sunlight can shine through block
|
|
|
|
is_ground_content = false, -- Stops caves from being generated over this node.
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
groups = {cracky = 3, oddly_breakable_by_hand = 3},
|
|
|
|
sounds = default.node_sound_glass_defaults()
|
2014-12-29 11:19:46 -08:00
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
### Glasslike_Framed_Optional
|
|
|
|
|
|
|
|
"optional" drawtypes need less rendering time if deactivated on the client's side.
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Allfaces
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure class="right_image">
|
|
|
|
<img src="{{ page.root }}/static/drawtype_allfaces.png" alt="Allfaces drawtype">
|
|
|
|
<figcaption>
|
|
|
|
Allfaces drawtype
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
Allfaces nodes are partially transparent nodes - they have holes on
|
|
|
|
the faces - which show every single face of the cube, even if sides are
|
2014-12-29 11:19:46 -08:00
|
|
|
up against another node (which would normally be hidden).
|
2015-01-27 01:59:46 -08:00
|
|
|
Leaves in vanilla minetest_game use this drawtype.
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("default:leaves", {
|
|
|
|
description = "Leaves",
|
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
tiles = {"default_leaves.png"}
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
### Allfaces_Optional
|
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
Allows clients to disable it using `new_style_leaves = 0`, requiring less rendering time.
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
TorchLike
|
|
|
|
---------
|
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
TorchLike nodes are 2D nodes which allow you to have different textures
|
|
|
|
depending on whether they are placed against a wall, on the floor or on the ceiling.
|
|
|
|
|
|
|
|
TorchLike nodes are not restricted to torches, you could use the for switches or other
|
|
|
|
items which need to have different textures depending on where they are placed.
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
{% highlight lua %}
|
2015-01-27 01:59:46 -08:00
|
|
|
minetest.register_node("foobar:torch", {
|
|
|
|
description = "Foobar Torch",
|
2014-12-29 11:19:46 -08:00
|
|
|
drawtype = "torchlike",
|
|
|
|
tiles = {
|
2015-01-27 01:59:46 -08:00
|
|
|
{"foobar_torch_floor.png"},
|
|
|
|
{"foobar_torch_ceiling.png"},
|
|
|
|
{"foobar_torch_wall.png"}
|
2014-12-29 11:19:46 -08:00
|
|
|
},
|
2015-01-27 01:59:46 -08:00
|
|
|
inventory_image = "foobar_torch_floor.png",
|
|
|
|
wield_image = "default_torch_floor.png",
|
2014-12-29 11:19:46 -08:00
|
|
|
light_source = LIGHT_MAX-1,
|
2015-02-22 02:28:37 -08:00
|
|
|
|
2015-01-27 01:59:46 -08:00
|
|
|
-- Determines how the torch is selected, ie: the wire box around it.
|
|
|
|
-- each value is { x1, y1, z1, x2, y2, z2 }
|
|
|
|
-- (x1, y1, y1) is the bottom front left corner
|
|
|
|
-- (x2, y2, y2) is the opposite - top back right.
|
|
|
|
-- Similar to the nodebox format.
|
2014-12-29 11:19:46 -08:00
|
|
|
selection_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
wall_top = {-0.1, 0.5-0.6, -0.1, 0.1, 0.5, 0.1},
|
|
|
|
wall_bottom = {-0.1, -0.5, -0.1, 0.1, -0.5+0.6, 0.1},
|
|
|
|
wall_side = {-0.5, -0.3, -0.1, -0.5+0.3, 0.3, 0.1},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
2015-02-22 02:28:37 -08:00
|
|
|
## Nodebox
|
2014-12-29 11:19:46 -08:00
|
|
|
|
|
|
|
<figure class="right_image">
|
|
|
|
<img src="{{ page.root }}/static/drawtype_nodebox.gif" alt="Nodebox drawtype">
|
|
|
|
<figcaption>
|
|
|
|
Nodebox drawtype
|
|
|
|
</figcaption>
|
|
|
|
</figure>
|
|
|
|
|
|
|
|
Nodeboxes allow you to create a node which is not cubic, but is instead made out
|
|
|
|
of as many cuboids as you like.
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("stairs:stair_stone", {
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
The most important part is the nodebox table:
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
|
|
|
{-0.5, 0, 0, 0.5, 0.5, 0.5}
|
|
|
|
{% endhighlight %}
|
|
|
|
|
|
|
|
Each row is a cubiod which are joined to make a single node.
|
|
|
|
The first three numbers are the co-ordinates, from -0.5 to 0.5 inclusive, of
|
|
|
|
the bottom front left most corner, the last three numbers are the opposite corner.
|
|
|
|
They are in the form X, Y, Z, where Y is up.
|
|
|
|
|
|
|
|
You can use the [NodeBoxEditor](https://forum.minetest.net/viewtopic.php?f=14&t=2840) to
|
|
|
|
create node boxes by dragging the edges, it is more visual than doing it by hand.
|
|
|
|
|
|
|
|
### Wallmounted Nodebox
|
|
|
|
|
|
|
|
Sometimes you want different nodeboxes for when it is place on the floor, wall and
|
|
|
|
ceiling, like with torches.
|
|
|
|
|
|
|
|
{% highlight lua %}
|
|
|
|
minetest.register_node("default:sign_wall", {
|
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "wallmounted",
|
|
|
|
|
|
|
|
-- Ceiling
|
|
|
|
wall_top = {
|
|
|
|
{-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Floor
|
|
|
|
wall_bottom = {
|
|
|
|
{-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}
|
|
|
|
},
|
|
|
|
|
|
|
|
-- Wall
|
|
|
|
wall_side = {
|
|
|
|
{-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
})
|
|
|
|
{% endhighlight %}
|