5 - Node Drawtypes, italian translation added

master
Zughy 2020-05-15 00:45:55 +02:00 committed by rubenwardy
parent 72a1d42082
commit 4528250c0c
1 changed files with 167 additions and 174 deletions

View File

@ -1,99 +1,97 @@
---
title: Node Drawtypes
title: Tipi di nodo
layout: default
root: ../..
idx: 2.3
description: Guide to all drawtypes, including node boxes/nodeboxes and mesh nodes.
redirect_from: /en/chapters/node_drawtypes.html
description: Guida su tutti i tipi di nodo, inclusi cuboidi e mesh.
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
available drawtypes. The behaviour of a drawtype can be controlled
by providing properties in the node type definition. These properties
are fixed for all instances of this node. It is possible to control some properties
per-node using something called `param2`.
Il metodo col quale un nodo viene disegnato in gioco è chiamato *drawtype*.
Ci sono diversi tipi di drawtype: il loro comportamento è determinato dalle proprietà
impostate durante la definizione del tipo di nodo.
Queste proprietà sono fisse, uguali per tutte le istanze, tuttavia
è 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
full definition of a node wasn't given. The Minetest world is a 3D grid of
positions. Each position is called a node, and consists of the node type
(name) and two parameters (param1 and param2). The function
`minetest.register_node` is a bit misleading in that it doesn't actually
register a node - it registers a new *type* of node.
Il concetto di nodo è stato introdotto nello scorso capitolo, ma non è mai stata
data una definizione completa.
Il mondo di Minetest è una griglia 3D: un nodo è un punto di quella griglia ed è composto
da un tipo (name) e due parametri (param1 e param2).
Non farti inoltre ingannare dalla funzione `minetest.register_node`, in quanto è un po' fuorviante:
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.
`param1` is used to store the lighting of a node, and the meaning of
`param2` depends on the `paramtype2` property of the node type definition.
I parametri sono infine usati per controllare come un nodo viene renderizzato individualmente:
`param1` immagazzina le proprietà di luce, mentre il ruolo di `param2` dipende dalla
proprietà `paramtype2`, la quale è situata nella definizione dei singoli tipi di nodi.
- [Cubic Nodes: Normal and Allfaces](#cubic-nodes-normal-and-allfaces)
- [Glasslike Nodes](#glasslike-nodes)
- [Glasslike_Framed](#glasslikeframed)
- [Airlike Nodes](#airlike-nodes)
- [Lighting and Sunlight Propagation](#lighting-and-sunlight-propagation)
- [Liquid Nodes](#liquid-nodes)
- [Node Boxes](#node-boxes)
- [Wallmounted Node Boxes](#wallmounted-node-boxes)
- [Mesh Nodes](#mesh-nodes)
- [Signlike Nodes](#signlike-nodes)
- [Plantlike Nodes](#plantlike-nodes)
- [Firelike Nodes](#firelike-nodes)
- [More Drawtypes](#more-drawtypes)
- [Nodi cubici: normali e a facciate piene](#nodi-cubici-normali-e-a-facciate-piene)
- [Nodi vitrei](#nodi-vitrei)
- [Vitreo incorniciato](#vitreo-incorniciato)
- [Nodi d'aria](#nodi-d-aria)
- [Luce e propagazione solare](#luce-e-propagazione-solare)
- [Nodi liquidi](#nodi-liquidi)
- [Nodi complessi](#nodi-complessi)
- [Nodi complessi a muro](#nodi-complessi-a-muro)
- [Nodi mesh](#nodi-mesh)
- [Nodi insegna](#nodi-insegna)
- [Nodi pianta](#nodi-pianta)
- [Nodi fiamma](#firelike-nodes)
- [Altri drawtype](#altri-drawtype)
## Cubic Nodes: Normal and Allfaces
## Nodi cubici: normali e a facciate piene
<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>
Normal Drawtype
Drawtype normale
</figcaption>
</figure>
The normal drawtype is typically used to render a cubic node.
If the side of a normal node is against a solid side, then that side won't be rendered,
resulting in a large performance gain.
Il drawtype normale è tipicamente usato per renderizzare un nodo cubico.
Se il lato di uno di questi nodi tocca un nodo solido, allora quel lato non sarà renderizzato,
risultando in un grande guadagno sulle prestazioni.
In contrast, the allfaces drawtype will still render the inner side when up against
a solid node. This is good for nodes with partially transparent sides, such as
leaf nodes. You can use the allfaces_optional drawtype to allow users to opt-out
of the slower drawing, in which case it'll act like a normal node.
Al contrario, i drawtype a facciate piene (allfaces) renderizzeranno comunque il lato interno quando
è contro un nodo solido. Ciò è buono per quei nodi con facce in parte trasparenti come
le foglie. Puoi inoltre usare il drawtype `allfaces_optional` per permettere agli utenti
di fare opt-out dal rendering più pesante, facendo comportare il nodo come se fosse di tipo normale.
```lua
minetest.register_node("mymod:diamond", {
description = "Alien Diamond",
tiles = {"mymod_diamond.png"},
minetest.register_node("miamod:diamante", {
description = "Diamante alieno",
tiles = {"miamod_diamante.png"},
groups = {cracky = 3},
})
minetest.register_node("default:leaves", {
description = "Leaves",
minetest.register_node("default:foglie", {
description = "Foglie",
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
specify it.
Attenzione: il drawtype normale è quello predefinito, quindi non c'è bisogno di specificarlo ogni volta.
## Nodi vitrei
## Glasslike Nodes
The difference between glasslike and normal nodes is that placing a glasslike node
next to a normal node won't cause the side of the normal node to be hidden.
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.
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.
Questo è utile in quanto i nodi vitrei tendono a essere trasparenti, perciò permettono
di vedere attraverso.
<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>
Glasslike's Edges
Bordi vitrei
</figcaption>
</figure>
```lua
minetest.register_node("default:obsidian_glass", {
description = "Obsidian Glass",
description = "Vetro d'ossidiana",
drawtype = "glasslike",
tiles = {"default_obsidian_glass.png"},
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
than individual nodes, like the following:
Questa opzione crea un solo bordo lungo tutto l'insieme di nodi, al posto di
crearne più per singolo nodo.
<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>
Glasslike_Framed's Edges
Bordi vitrei incorniciati
</figcaption>
</figure>
You can use the glasslike_framed_optional drawtype to allow the user to *opt-in*
to the framed appearance.
```lua
minetest.register_node("default:glass", {
description = "Glass",
description = "Vetro",
drawtype = "glasslike_framed",
tiles = {"default_glass.png", "default_glass_detail.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
minetest.register_node("myair:air", {
description = "MyAir (you hacker you!)",
minetest.register_node("miaaria:aria", {
description = "Mia Aria",
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
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)
walkable = false, -- Il giocatore può collidere col nodo
pointable = false, -- Non è selezionabile
diggable = false, -- Non può essere scavato
buildable_to = true, -- Può essere rimpiazzato da altri nodi
-- (basta costruire nella stessa coordinata)
air_equivalent = true,
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
a node's side, the light value of the neighbouring node is used.
Because of this, solid nodes don't have light values because they block light.
La luce di un nodo è salvata in param1. Per capire come ombreggiare
il lato di un nodo, viene utilizzato il valore di luminosità dei nodi adiacenti.
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.
It's usually desirable for some nodes such as glass and air to be able to
let light through. To do this, there are two properties which need to be defined:
Di base, non viene salvata la luce in nessun nodo né nelle sue istanze.
È invece solitamente preferibile farla passare in tipi quali quelli d'aria e
vitrei. Per fare ciò, ci sono due proprietà che devono essere definite:
```lua
paramtype = "light",
sunlight_propagates = true,
```
The first line means that param1 does, in fact, store the light level.
The second line means that sunlight should go through this node without decreasing in value.
La prima riga dice a param1 di immagazzinare l'indice di luminosità.
La seconda riga invece permette alla luce del sole di propagarsi attraverso il nodo senza diminuire il suo valore.
## Liquid Nodes
## Nodi liquidi
<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>
Liquid Drawtype
Drawtype liquido
</figcaption>
</figure>
Each type of liquid requires two node definitions - one for the liquid source, and
another for flowing liquid.
Ogni tipo di liquido richiede due definizioni di nodi: una per la sorgente e l'altra
per il liquido che scorre.
```lua
-- Some properties have been removed as they are beyond
-- the scope of this chapter.
-- Alcune proprietà sono state rimosse perché non
-- rilevanti per questo capitolo
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
-- ^ questo è necessario per impedire che l'immagine nell'inventario sia animata
tiles = {
{
@ -212,7 +206,7 @@ minetest.register_node("default:water_source", {
},
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",
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
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
walkable = false, -- Il giocatore può attraversarlo
pointable = false, -- Il giocatore non può selezionarlo
diggable = false, -- Il giocatore non può scavarlo
buildable_to = true, -- Può essere rimpiazzato da altri nodi
alpha = 160,
--
-- Liquid Properties
-- Proprietà del liquido
--
drowning = 1,
liquidtype = "source",
liquid_alternative_flowing = "default:water_flowing",
-- ^ when the liquid is flowing
-- ^ quando scorre
liquid_alternative_source = "default:water_source",
-- ^ when the liquid is a source
-- ^ quando è sorgente (statico)
liquid_viscosity = WATER_VISC,
-- ^ how fast
-- ^ quanto veloce
liquid_range = 8,
-- ^ how far
-- ^ quanto lontano
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.
See default:water_flowing in the default mod in minetest_game for a full example.
I nodi fluidi hanno una definizione simile, ma con nome e animazione differenti.
Guarda default:water_flowing nella mod default di minetest_game per un esempio completo.
## Node Boxes
## Nodi complessi
<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>
Nodebox drawtype
Drawtype complesso
</figcaption>
</figure>
Node boxes allow you to create a node which is not cubic, but is instead made out
of as many cuboids as you like.
I nodi complessi (nodebox) ti permettono di creare un nodo che non è cubico, bensì un insieme
di più cuboidi.
```lua
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
{-0.5, -0.5, -0.5, 0.5, 0, 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.
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.
Ogni riga corrisponde a un cuboide e l'insieme delle righe forma il nodo complesso:
i primi tre numeri sono le coordinate (da -0.5 a 0.5) dell'angolo davanti in basso a sinistra,
mentre gli altri tre equivalgono all'angolo opposto.
Essi sono in formato X, Y, Z, dove Y indica il sopra.
### 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
minetest.register_node("default:sign_wall", {
@ -310,17 +306,17 @@ minetest.register_node("default:sign_wall", {
node_box = {
type = "wallmounted",
-- Ceiling
-- Soffitto
wall_top = {
{-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}
},
-- Floor
-- Pavimento
wall_bottom = {
{-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}
},
-- Wall
-- Muro
wall_side = {
{-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
they can only consist of cuboids. Node boxes are also unoptimised;
Inner faces will still be rendered even when they're completely hidden.
Mentre i nodi complessi sono generalmente più semplici da fare, essi sono limitati
in quanto possono essere composti solo da cuboidi. I nodi complessi sono anche non ottimizzati:
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
different node boxes overlap, causing parts of the node box model to be
invisible but still rendered.
Una faccia è una superficie piatta di una mesh. Una faccia interna appare quando le
facce di due nodi complessi si sovrappongono, rendendo invisibili parti del modello
ma renderizzandole comunque.
You can register a mesh node as so:
Puoi registrare un nodo mesh come segue:
```lua
minetest.register_node("mymod:meshy", {
minetest.register_node("miamod:meshy", {
drawtype = "mesh",
-- Holds the texture for each "material"
-- Contiene le texture di ogni materiale
tiles = {
"mymod_meshy.png"
},
-- Path to the mesh
-- Percorso della mesh
mesh = "mymod_meshy.b3d",
})
```
Make sure that the mesh is available in a `models` directory.
Most of the time the mesh should be in your mod's folder, however, it's okay to
share a mesh provided by another mod you depend on. For example, a mod that
adds more types of furniture may want to share the model provided by a basic
furniture mod.
Assicurati che la mesh sia presente nella cartella `models`.
La maggior parte delle volte la mesh dovrebbe essere nella cartella della tua mod, tuttavia
è ok condividere una mesh fornita da un'altra mod dalla quale dipendi.
Per esempio, una mod che aggiunge più tipi di mobili potrebbe usfruire di un modello
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.
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.
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.
```lua
minetest.register_node("default:ladder_wood", {
@ -375,7 +369,7 @@ minetest.register_node("default:ladder_wood", {
tiles = {"default_ladder_wood.png"},
-- Required: store the rotation in param2
-- Necessario: memorizza la rotazione in param2
paramtype2 = "wallmounted",
selection_box = {
@ -384,23 +378,22 @@ minetest.register_node("default:ladder_wood", {
})
```
## Plantlike Nodes
## Nodi pianta
<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>
Plantlike Drawtype
Drawtype pianta
</figcaption>
</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
minetest.register_node("default:papyrus", {
drawtype = "plantlike",
-- Only one texture used
-- Viene usata solo una texture
tiles = {"default_papyrus.png"},
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
and ceilings.
I nodi fiamma (firelike) sono simili ai pianta, ad eccezione del fatto che sono
ideati per "avvinghiarsi" ai muri e ai soffitti.
<figure>
<img src="{{ page.root }}//static/drawtype_firelike.png" alt="Firelike nodes">
<img src="{{ page.root }}//static/drawtype_firelike.png" alt="Drawtype fiamma">
<figcaption>
Firelike nodes
Drawtype fiamma
</figcaption>
</figure>
```lua
minetest.register_node("mymod:clingere", {
minetest.register_node("miamod:avvinghiatutto", {
drawtype = "firelike",
-- Only one texture used
tiles = { "mymod:clinger" },
-- Viene usata solo una texture
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
* Plantlike rooted - for underwater plants
* Raillike - for cart tracks
* Torchlike - for 2D wall/floor/ceiling nodes.
The torches in Minetest Game actually use two different node definitions of
mesh nodes (default:torch and default:torch_wall).
* Nodi staccionata
* Nodi pianta radicata - per quelle acquatiche
* Nodi rotaia - per i binari del carrello
* Nodi torcia - per nodi 2D su pavimenti/muri/soffitti.
Le torce in Minetest Game usano in verità due diverse definizioni dei
nodi mesh (default:torch e default:torch_wall).
As always, read the [Lua API documentation](../../lua_api.html#node-drawtypes)
for the complete list.
Come al solito, consulta la [documentazione sull'API Lua](../../lua_api.html#node-drawtypes)
per l'elenco completo.