5 - Node Drawtypes, italian translation added

This commit is contained in:
Zughy 2020-05-15 00:45:55 +02:00 committed by rubenwardy
parent 72a1d42082
commit 4528250c0c

View File

@ -1,99 +1,97 @@
--- ---
title: Node Drawtypes title: Tipi di nodo
layout: default layout: default
root: ../.. root: ../..
idx: 2.3 idx: 2.3
description: Guide to all drawtypes, including node boxes/nodeboxes and mesh nodes. description: Guida su tutti i tipi di nodo, inclusi cuboidi e mesh.
redirect_from: /en/chapters/node_drawtypes.html redirect_from: /it/chapters/node_drawtypes.html
--- ---
## Introduction <!-- omit in toc --> ## Introduzione <!-- omit in toc -->
The method by which a node is drawn is called a *drawtype*. There are many Il metodo col quale un nodo viene disegnato in gioco è chiamato *drawtype*.
available drawtypes. The behaviour of a drawtype can be controlled Ci sono diversi tipi di drawtype: il loro comportamento è determinato dalle proprietà
by providing properties in the node type definition. These properties impostate durante la definizione del tipo di nodo.
are fixed for all instances of this node. It is possible to control some properties Queste proprietà sono fisse, uguali per tutte le istanze, tuttavia
per-node using something called `param2`. è possibile manipolarne alcune per singolo nodo usando una cosa chiamata `param2`.
In the previous chapter, the concept of nodes and items was introduced, but a Il concetto di nodo è stato introdotto nello scorso capitolo, ma non è mai stata
full definition of a node wasn't given. The Minetest world is a 3D grid of data una definizione completa.
positions. Each position is called a node, and consists of the node type Il mondo di Minetest è una griglia 3D: un nodo è un punto di quella griglia ed è composto
(name) and two parameters (param1 and param2). The function da un tipo (name) e due parametri (param1 e param2).
`minetest.register_node` is a bit misleading in that it doesn't actually Non farti inoltre ingannare dalla funzione `minetest.register_node`, in quanto è un po' fuorviante:
register a node - it registers a new *type* of node. essa non registra infatti un nuovo nodo (c'è solo una definizione di nodo), bensì un nuovo *tipo* di nodo.
The node params are used to control how a node is individually rendered. I parametri sono infine usati per controllare come un nodo viene renderizzato individualmente:
`param1` is used to store the lighting of a node, and the meaning of `param1` immagazzina le proprietà di luce, mentre il ruolo di `param2` dipende dalla
`param2` depends on the `paramtype2` property of the node type definition. proprietà `paramtype2`, la quale è situata nella definizione dei singoli tipi di nodi.
- [Cubic Nodes: Normal and Allfaces](#cubic-nodes-normal-and-allfaces) - [Nodi cubici: normali e a facciate piene](#nodi-cubici-normali-e-a-facciate-piene)
- [Glasslike Nodes](#glasslike-nodes) - [Nodi vitrei](#nodi-vitrei)
- [Glasslike_Framed](#glasslikeframed) - [Vitreo incorniciato](#vitreo-incorniciato)
- [Airlike Nodes](#airlike-nodes) - [Nodi d'aria](#nodi-d-aria)
- [Lighting and Sunlight Propagation](#lighting-and-sunlight-propagation) - [Luce e propagazione solare](#luce-e-propagazione-solare)
- [Liquid Nodes](#liquid-nodes) - [Nodi liquidi](#nodi-liquidi)
- [Node Boxes](#node-boxes) - [Nodi complessi](#nodi-complessi)
- [Wallmounted Node Boxes](#wallmounted-node-boxes) - [Nodi complessi a muro](#nodi-complessi-a-muro)
- [Mesh Nodes](#mesh-nodes) - [Nodi mesh](#nodi-mesh)
- [Signlike Nodes](#signlike-nodes) - [Nodi insegna](#nodi-insegna)
- [Plantlike Nodes](#plantlike-nodes) - [Nodi pianta](#nodi-pianta)
- [Firelike Nodes](#firelike-nodes) - [Nodi fiamma](#firelike-nodes)
- [More Drawtypes](#more-drawtypes) - [Altri drawtype](#altri-drawtype)
## Cubic Nodes: Normal and Allfaces ## Nodi cubici: normali e a facciate piene
<figure class="right_image"> <figure class="right_image">
<img src="{{ page.root }}//static/drawtype_normal.png" alt="Normal Drawtype"> <img src="{{ page.root }}//static/drawtype_normal.png" alt="Drawtype normale">
<figcaption> <figcaption>
Normal Drawtype Drawtype normale
</figcaption> </figcaption>
</figure> </figure>
The normal drawtype is typically used to render a cubic node. Il drawtype normale è tipicamente usato per renderizzare un nodo cubico.
If the side of a normal node is against a solid side, then that side won't be rendered, Se il lato di uno di questi nodi tocca un nodo solido, allora quel lato non sarà renderizzato,
resulting in a large performance gain. risultando in un grande guadagno sulle prestazioni.
In contrast, the allfaces drawtype will still render the inner side when up against Al contrario, i drawtype a facciate piene (allfaces) renderizzeranno comunque il lato interno quando
a solid node. This is good for nodes with partially transparent sides, such as è contro un nodo solido. Ciò è buono per quei nodi con facce in parte trasparenti come
leaf nodes. You can use the allfaces_optional drawtype to allow users to opt-out le foglie. Puoi inoltre usare il drawtype `allfaces_optional` per permettere agli utenti
of the slower drawing, in which case it'll act like a normal node. di fare opt-out dal rendering più pesante, facendo comportare il nodo come se fosse di tipo normale.
```lua ```lua
minetest.register_node("mymod:diamond", { minetest.register_node("miamod:diamante", {
description = "Alien Diamond", description = "Diamante alieno",
tiles = {"mymod_diamond.png"}, tiles = {"miamod_diamante.png"},
groups = {cracky = 3}, groups = {cracky = 3},
}) })
minetest.register_node("default:leaves", { minetest.register_node("default:foglie", {
description = "Leaves", description = "Foglie",
drawtype = "allfaces_optional", drawtype = "allfaces_optional",
tiles = {"default_leaves.png"} tiles = {"default_foglie.png"}
}) })
``` ```
Note: the normal drawtype is the default drawtype, so you don't need to explicitly Attenzione: il drawtype normale è quello predefinito, quindi non c'è bisogno di specificarlo ogni volta.
specify it.
## Nodi vitrei
## Glasslike Nodes La differenza tra i nodi vitrei (glasslike) e quelli normali è che piazzando i primi vicino a un
nodo normale, non nasconderanno il lato di quest'ultimo.
The difference between glasslike and normal nodes is that placing a glasslike node Questo è utile in quanto i nodi vitrei tendono a essere trasparenti, perciò permettono
next to a normal node won't cause the side of the normal node to be hidden. di vedere attraverso.
This is useful because glasslike nodes tend to be transparent, and so using a normal
drawtype would result in the ability to see through the world.
<figure> <figure>
<img src="{{ page.root }}//static/drawtype_glasslike_edges.png" alt="Glasslike's Edges"> <img src="{{ page.root }}//static/drawtype_glasslike_edges.png" alt="Bordi vitrei">
<figcaption> <figcaption>
Glasslike's Edges Bordi vitrei
</figcaption> </figcaption>
</figure> </figure>
```lua ```lua
minetest.register_node("default:obsidian_glass", { minetest.register_node("default:obsidian_glass", {
description = "Obsidian Glass", description = "Vetro d'ossidiana",
drawtype = "glasslike", drawtype = "glasslike",
tiles = {"default_obsidian_glass.png"}, tiles = {"default_obsidian_glass.png"},
paramtype = "light", paramtype = "light",
@ -104,24 +102,21 @@ minetest.register_node("default:obsidian_glass", {
}) })
``` ```
### Glasslike_Framed ### Vitreo incorniciato
This makes the node's edge go around the whole thing with a 3D effect, rather Questa opzione crea un solo bordo lungo tutto l'insieme di nodi, al posto di
than individual nodes, like the following: crearne più per singolo nodo.
<figure> <figure>
<img src="{{ page.root }}//static/drawtype_glasslike_framed.png" alt="Glasslike_framed's Edges"> <img src="{{ page.root }}//static/drawtype_glasslike_framed.png" alt="Bordi vitrei incorniciati">
<figcaption> <figcaption>
Glasslike_Framed's Edges Bordi vitrei incorniciati
</figcaption> </figcaption>
</figure> </figure>
You can use the glasslike_framed_optional drawtype to allow the user to *opt-in*
to the framed appearance.
```lua ```lua
minetest.register_node("default:glass", { minetest.register_node("default:glass", {
description = "Glass", description = "Vetro",
drawtype = "glasslike_framed", drawtype = "glasslike_framed",
tiles = {"default_glass.png", "default_glass_detail.png"}, tiles = {"default_glass.png", "default_glass_detail.png"},
inventory_image = minetest.inventorycube("default_glass.png"), inventory_image = minetest.inventorycube("default_glass.png"),
@ -132,24 +127,24 @@ minetest.register_node("default:glass", {
}) })
``` ```
Puoi inoltre usare il drawtype glasslike_framed_optional per permettere un opt-in all'utente.
## Airlike Nodes ## Nodi d'aria
These nodes are not rendered and thus have no textures. I nodi d'aria (airlike) non sono renderizzati e perciò non hanno texture.
```lua ```lua
minetest.register_node("myair:air", { minetest.register_node("miaaria:aria", {
description = "MyAir (you hacker you!)", description = "Mia Aria",
drawtype = "airlike", drawtype = "airlike",
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
walkable = false, -- Would make the player collide with the air node walkable = false, -- Il giocatore può collidere col nodo
pointable = false, -- You can't select the node pointable = false, -- Non è selezionabile
diggable = false, -- You can't dig the node diggable = false, -- Non può essere scavato
buildable_to = true, -- Nodes can be replace this node. buildable_to = true, -- Può essere rimpiazzato da altri nodi
-- (you can place a node and remove the air node -- (basta costruire nella stessa coordinata)
-- that used to be there)
air_equivalent = true, air_equivalent = true,
drop = "", drop = "",
@ -158,46 +153,45 @@ minetest.register_node("myair:air", {
``` ```
## Lighting and Sunlight Propagation ## Luce e propagazione solare
The lighting of a node is stored in param1. In order to work out how to shade La luce di un nodo è salvata in param1. Per capire come ombreggiare
a node's side, the light value of the neighbouring node is used. il lato di un nodo, viene utilizzato il valore di luminosità dei nodi adiacenti.
Because of this, solid nodes don't have light values because they block light. Questo comporta un blocco della luce da parte dei nodi solidi.
By default, a node type won't allow light to be stored in any node instances. Di base, non viene salvata la luce in nessun nodo né nelle sue istanze.
It's usually desirable for some nodes such as glass and air to be able to È invece solitamente preferibile farla passare in tipi quali quelli d'aria e
let light through. To do this, there are two properties which need to be defined: vitrei. Per fare ciò, ci sono due proprietà che devono essere definite:
```lua ```lua
paramtype = "light", paramtype = "light",
sunlight_propagates = true, sunlight_propagates = true,
``` ```
The first line means that param1 does, in fact, store the light level. La prima riga dice a param1 di immagazzinare l'indice di luminosità.
The second line means that sunlight should go through this node without decreasing in value. La seconda riga invece permette alla luce del sole di propagarsi attraverso il nodo senza diminuire il suo valore.
## Nodi liquidi
## Liquid Nodes
<figure class="right_image"> <figure class="right_image">
<img src="{{ page.root }}//static/drawtype_liquid.png" alt="Liquid Drawtype"> <img src="{{ page.root }}//static/drawtype_liquid.png" alt="Drawtype liquido">
<figcaption> <figcaption>
Liquid Drawtype Drawtype liquido
</figcaption> </figcaption>
</figure> </figure>
Each type of liquid requires two node definitions - one for the liquid source, and Ogni tipo di liquido richiede due definizioni di nodi: una per la sorgente e l'altra
another for flowing liquid. per il liquido che scorre.
```lua ```lua
-- Some properties have been removed as they are beyond -- Alcune proprietà sono state rimosse perché non
-- the scope of this chapter. -- rilevanti per questo capitolo
minetest.register_node("default:water_source", { minetest.register_node("default:water_source", {
drawtype = "liquid", drawtype = "liquid",
paramtype = "light", paramtype = "light",
inventory_image = minetest.inventorycube("default_water.png"), inventory_image = minetest.inventorycube("default_water.png"),
-- ^ this is required to stop the inventory image from being animated -- ^ questo è necessario per impedire che l'immagine nell'inventario sia animata
tiles = { tiles = {
{ {
@ -212,7 +206,7 @@ minetest.register_node("default:water_source", {
}, },
special_tiles = { special_tiles = {
-- New-style water source material (mostly unused) -- Nuovo stile per il materiale dell'acqua statica (praticamente inutilizzato)
{ {
name = "default_water_source_animated.png", name = "default_water_source_animated.png",
animation = {type = "vertical_frames", aspect_w = 16, animation = {type = "vertical_frames", aspect_w = 16,
@ -222,53 +216,53 @@ minetest.register_node("default:water_source", {
}, },
-- --
-- Behavior -- Comportamento
-- --
walkable = false, -- The player falls through walkable = false, -- Il giocatore può attraversarlo
pointable = false, -- The player can't highlight it pointable = false, -- Il giocatore non può selezionarlo
diggable = false, -- The player can't dig it diggable = false, -- Il giocatore non può scavarlo
buildable_to = true, -- Nodes can be replace this node buildable_to = true, -- Può essere rimpiazzato da altri nodi
alpha = 160, alpha = 160,
-- --
-- Liquid Properties -- Proprietà del liquido
-- --
drowning = 1, drowning = 1,
liquidtype = "source", liquidtype = "source",
liquid_alternative_flowing = "default:water_flowing", liquid_alternative_flowing = "default:water_flowing",
-- ^ when the liquid is flowing -- ^ quando scorre
liquid_alternative_source = "default:water_source", liquid_alternative_source = "default:water_source",
-- ^ when the liquid is a source -- ^ quando è sorgente (statico)
liquid_viscosity = WATER_VISC, liquid_viscosity = WATER_VISC,
-- ^ how fast -- ^ quanto veloce
liquid_range = 8, liquid_range = 8,
-- ^ how far -- ^ quanto lontano
post_effect_color = {a=64, r=100, g=100, b=200}, post_effect_color = {a=64, r=100, g=100, b=200},
-- ^ colour of screen when the player is submerged -- ^ colore dello schermo quando il player ne è immerso
}) })
``` ```
Flowing nodes have a similar definition, but with a different name and animation. I nodi fluidi hanno una definizione simile, ma con nome e animazione differenti.
See default:water_flowing in the default mod in minetest_game for a full example. Guarda default:water_flowing nella mod default di minetest_game per un esempio completo.
## Node Boxes ## Nodi complessi
<figure class="right_image"> <figure class="right_image">
<img src="{{ page.root }}//static/drawtype_nodebox.gif" alt="Nodebox drawtype"> <img src="{{ page.root }}//static/drawtype_nodebox.gif" alt="Drawtype complesso">
<figcaption> <figcaption>
Nodebox drawtype Drawtype complesso
</figcaption> </figcaption>
</figure> </figure>
Node boxes allow you to create a node which is not cubic, but is instead made out I nodi complessi (nodebox) ti permettono di creare un nodo che non è cubico, bensì un insieme
of as many cuboids as you like. di più cuboidi.
```lua ```lua
minetest.register_node("stairs:stair_stone", { minetest.register_node("stairs:stair_stone", {
@ -284,25 +278,27 @@ minetest.register_node("stairs:stair_stone", {
}) })
``` ```
The most important part is the node box table: La parte più importable è la tabella node_box:
```lua ```lua
{-0.5, -0.5, -0.5, 0.5, 0, 0.5}, {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
{-0.5, 0, 0, 0.5, 0.5, 0.5} {-0.5, 0, 0, 0.5, 0.5, 0.5}
``` ```
Each row is a cuboid which are joined to make a single node. Ogni riga corrisponde a un cuboide e l'insieme delle righe forma il nodo complesso:
The first three numbers are the co-ordinates, from -0.5 to 0.5 inclusive, of i primi tre numeri sono le coordinate (da -0.5 a 0.5) dell'angolo davanti in basso a sinistra,
the bottom front left most corner, the last three numbers are the opposite corner. mentre gli altri tre equivalgono all'angolo opposto.
They are in the form X, Y, Z, where Y is up. Essi sono in formato X, Y, Z, dove Y indica il sopra.
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 Node Boxes Puoi usare [NodeBoxEditor](https://forum.minetest.net/viewtopic.php?f=14&t=2840) per
creare nodi complessi più facilmente, in quanto permette di vedere in tempo reale le modifiche
sul nodo che si sta modellando.
Sometimes you want different nodeboxes for when it is placed on the floor, wall, or ceiling like with torches. ### Nodi complessi a muro
Certe volte si vogliono avere nodi complessi che cambiano a seconda della loro posizione
sul pavimento, sul muro e sul soffitto, come le torce.
```lua ```lua
minetest.register_node("default:sign_wall", { minetest.register_node("default:sign_wall", {
@ -310,17 +306,17 @@ minetest.register_node("default:sign_wall", {
node_box = { node_box = {
type = "wallmounted", type = "wallmounted",
-- Ceiling -- Soffitto
wall_top = { wall_top = {
{-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125} {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}
}, },
-- Floor -- Pavimento
wall_bottom = { wall_bottom = {
{-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125} {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}
}, },
-- Wall -- Muro
wall_side = { wall_side = {
{-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375} {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}
} }
@ -328,46 +324,44 @@ minetest.register_node("default:sign_wall", {
}) })
``` ```
## Mesh Nodes ## Nodi mesh
Whilst node boxes are generally easier to make, they are limited in that Mentre i nodi complessi sono generalmente più semplici da fare, essi sono limitati
they can only consist of cuboids. Node boxes are also unoptimised; in quanto possono essere composti solo da cuboidi. I nodi complessi sono anche non ottimizzati:
Inner faces will still be rendered even when they're completely hidden. le facce interne, infatti, saranno comunque renderizzate, anche quando completamente nascoste.
A face is a flat surface on a mesh. An inner face occurs when the faces of two Una faccia è una superficie piatta di una mesh. Una faccia interna appare quando le
different node boxes overlap, causing parts of the node box model to be facce di due nodi complessi si sovrappongono, rendendo invisibili parti del modello
invisible but still rendered. ma renderizzandole comunque.
You can register a mesh node as so: Puoi registrare un nodo mesh come segue:
```lua ```lua
minetest.register_node("mymod:meshy", { minetest.register_node("miamod:meshy", {
drawtype = "mesh", drawtype = "mesh",
-- Holds the texture for each "material" -- Contiene le texture di ogni materiale
tiles = { tiles = {
"mymod_meshy.png" "mymod_meshy.png"
}, },
-- Path to the mesh -- Percorso della mesh
mesh = "mymod_meshy.b3d", mesh = "mymod_meshy.b3d",
}) })
``` ```
Make sure that the mesh is available in a `models` directory. Assicurati che la mesh sia presente nella cartella `models`.
Most of the time the mesh should be in your mod's folder, however, it's okay to La maggior parte delle volte la mesh dovrebbe essere nella cartella della tua mod, tuttavia
share a mesh provided by another mod you depend on. For example, a mod that è ok condividere una mesh fornita da un'altra mod dalla quale dipendi.
adds more types of furniture may want to share the model provided by a basic Per esempio, una mod che aggiunge più tipi di mobili potrebbe usfruire di un modello
furniture mod. fornito da una mod di mobili base.
## Nodi insegna
## Signlike Nodes I nodi insegna (signlike) sono nodi piatti che possono essere affissi sulle facce di altri nodi.
Signlike nodes are flat nodes with can be mounted on the sides of other nodes. Al contrario del loro nome, i cartelli non rientrano nei nodi insegna bensì nei nodi complessi,
per fornire un effetto 3D. I tipi insegna tuttavia, sono comunemente usati dalle scale a pioli.
Despite the name of this drawtype, signs don't actually tend to use signlike but
instead use the `nodebox` drawtype to provide a 3D effect. The `signlike` drawtype
is, however, commonly used by ladders.
```lua ```lua
minetest.register_node("default:ladder_wood", { minetest.register_node("default:ladder_wood", {
@ -375,7 +369,7 @@ minetest.register_node("default:ladder_wood", {
tiles = {"default_ladder_wood.png"}, tiles = {"default_ladder_wood.png"},
-- Required: store the rotation in param2 -- Necessario: memorizza la rotazione in param2
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
selection_box = { selection_box = {
@ -384,23 +378,22 @@ minetest.register_node("default:ladder_wood", {
}) })
``` ```
## Nodi pianta
## Plantlike Nodes
<figure class="right_image"> <figure class="right_image">
<img src="{{ page.root }}//static/drawtype_plantlike.png" alt="Plantlike Drawtype"> <img src="{{ page.root }}//static/drawtype_plantlike.png" alt="Drawtype pianta">
<figcaption> <figcaption>
Plantlike Drawtype Drawtype pianta
</figcaption> </figcaption>
</figure> </figure>
Plantlike nodes draw their tiles in an X like pattern. I nodi pianta raffigurano la loro texture in un pattern a forma di X.
```lua ```lua
minetest.register_node("default:papyrus", { minetest.register_node("default:papyrus", {
drawtype = "plantlike", drawtype = "plantlike",
-- Only one texture used -- Viene usata solo una texture
tiles = {"default_papyrus.png"}, tiles = {"default_papyrus.png"},
selection_box = { selection_box = {
@ -410,37 +403,37 @@ minetest.register_node("default:papyrus", {
}) })
``` ```
## Firelike Nodes ## Nodi fiamma
Firelike is similar to plantlike, except that it is designed to "cling" to walls I nodi fiamma (firelike) sono simili ai pianta, ad eccezione del fatto che sono
and ceilings. ideati per "avvinghiarsi" ai muri e ai soffitti.
<figure> <figure>
<img src="{{ page.root }}//static/drawtype_firelike.png" alt="Firelike nodes"> <img src="{{ page.root }}//static/drawtype_firelike.png" alt="Drawtype fiamma">
<figcaption> <figcaption>
Firelike nodes Drawtype fiamma
</figcaption> </figcaption>
</figure> </figure>
```lua ```lua
minetest.register_node("mymod:clingere", { minetest.register_node("miamod:avvinghiatutto", {
drawtype = "firelike", drawtype = "firelike",
-- Only one texture used -- Viene usata solo una texture
tiles = { "mymod:clinger" }, tiles = { "miamod:avvinghiatutto" },
}) })
``` ```
## More Drawtypes ## Altri drawtype
This is not a comprehensive list, there are more types including: Questa non è una lista definitiva, ci sono infatti altri tipi di nodi come:
* Fencelike * Nodi staccionata
* Plantlike rooted - for underwater plants * Nodi pianta radicata - per quelle acquatiche
* Raillike - for cart tracks * Nodi rotaia - per i binari del carrello
* Torchlike - for 2D wall/floor/ceiling nodes. * Nodi torcia - per nodi 2D su pavimenti/muri/soffitti.
The torches in Minetest Game actually use two different node definitions of Le torce in Minetest Game usano in verità due diverse definizioni dei
mesh nodes (default:torch and default:torch_wall). nodi mesh (default:torch e default:torch_wall).
As always, read the [Lua API documentation](../../lua_api.html#node-drawtypes) Come al solito, consulta la [documentazione sull'API Lua](../../lua_api.html#node-drawtypes)
for the complete list. per l'elenco completo.