3 - Nodes, Items and Crafting, Italian translation
This commit is contained in:
parent
287da22236
commit
765e60a133
@ -1,367 +1,356 @@
|
||||
---
|
||||
title: Nodes, Items, and Crafting
|
||||
title: Nodi, Oggetti e Fabbricazione
|
||||
layout: default
|
||||
root: ../..
|
||||
idx: 2.1
|
||||
description: Learn how to register node, items, and craft recipes using register_node, register_item, and register_craft.
|
||||
redirect_from: /en/chapters/nodes_items_crafting.html
|
||||
description: Impara come registrare nodi, oggetti e ricette di fabbricazione usando register_node, register_item e register_craft.
|
||||
redirect_from: /it/chapters/nodes_items_crafting.html
|
||||
---
|
||||
|
||||
## Introduction <!-- omit in toc -->
|
||||
## Introduzione <!-- omit in toc -->
|
||||
|
||||
Registering new nodes and craftitems, and creating craft recipes, are
|
||||
basic requirements for many mods.
|
||||
Saper registrare nuovi nodi, oggetti fabbricabili e conseguenti ricette, è un requisito fondamentale per molte mod.
|
||||
|
||||
- [What are Nodes and Items?](#what-are-nodes-and-items)
|
||||
- [Registering Items](#registering-items)
|
||||
- [Item Names and Aliases](#item-names-and-aliases)
|
||||
- [Textures](#textures)
|
||||
- [Registering a basic node](#registering-a-basic-node)
|
||||
- [Actions and Callbacks](#actions-and-callbacks)
|
||||
- [Cosa sono i nodi e gli oggetti?](#cosa-sono-i-nodi-e-gli-oggetti)
|
||||
- [Registrare gli oggetti](#registrare-gli-oggetti)
|
||||
- [Nomi oggetto e alias](#nomi-oggetto-e-alias)
|
||||
- [Texture](#texture)
|
||||
- [Registrare un nodo base](#registrare-un-nodo-base)
|
||||
- [Azioni e callback](#azioni-e-callback)
|
||||
- [on_use](#onuse)
|
||||
- [Crafting](#crafting)
|
||||
- [Shaped](#shaped)
|
||||
- [Shapeless](#shapeless)
|
||||
- [Cooking and Fuel](#cooking-and-fuel)
|
||||
- [Groups](#groups)
|
||||
- [Tools, Capabilities, and Dig Types](#tools-capabilities-and-dig-types)
|
||||
- [Fabbricazione](#fabbricazione)
|
||||
- [Fisse (shaped)](#fisse-shaped)
|
||||
- [Informi (shapeless)](#informi-shapeless)
|
||||
- [Cottura (cooking) e Carburante (fuel)](#cottura-cooking-e-carburante-fuel)
|
||||
- [Gruppi](#gruppi)
|
||||
- [Strumenti, Capacità e Friabilità](#strumenti-capacita-e-friabilita)
|
||||
|
||||
## What are Nodes and Items?
|
||||
## Cosa sono i nodi e gli oggetti?
|
||||
|
||||
Nodes, craftitems, and tools are all Items.
|
||||
An item is something that could be found in an inventory -
|
||||
even though it may not be possible through normal gameplay.
|
||||
Nodi, oggetti fabbricabili e strumenti sono tutti oggetti.
|
||||
Un oggetto è qualcosa che può essere trovato in un inventario —
|
||||
anche se potrebbe non risultare possibile durante una normale sessione di gioco.
|
||||
|
||||
A node is an item which can be placed or be found in the world.
|
||||
Every position in the world must be occupied with one and only one node -
|
||||
seemingly blank positions are usually air nodes.
|
||||
Un nodo è un oggetto che può essere piazzato o trovato nel mondo.
|
||||
Ogni coordinata nel mondo deve essere occupata da un unico nodo —
|
||||
ciò che appare vuoto è solitamente un nodo d'aria.
|
||||
|
||||
A craftitem can't be placed and is only found in inventories or as a dropped item
|
||||
in the world.
|
||||
Un oggetto fabbricabile (*craftitem*) non può essere invece piazzato, potendo apparire solo negli inventari
|
||||
o come oggetto rilasciato nel mondo.
|
||||
|
||||
A tool has the ability to wear and typically has non-default digging capabilities.
|
||||
In the future, it's likely that craftitems and tools will merge into one type of
|
||||
item, as the distinction between them is rather artificial.
|
||||
Uno strumento (*tool*) può usurarsi e solitamente non possiede la capacità di scavare.
|
||||
In futuro, è probabile che gli oggetti fabbricabili e gli strumenti verranno fusi in un unico tipo,
|
||||
in quanto la distinzione fra di essi è alquanto artificiosa.
|
||||
|
||||
## Registering Items
|
||||
## Registrare gli oggetti
|
||||
|
||||
Item definitions consist of an *item name* and a *definition table*.
|
||||
The definition table contains attributes which affect the behaviour of the item.
|
||||
Le definizioni degli oggetti consistono in un *nome oggetto* e una *tabella di definizioni*.
|
||||
La tabella di definizioni contiene attributi che influenzano il comportamento dell'oggetto.
|
||||
|
||||
```lua
|
||||
minetest.register_craftitem("modname:itemname", {
|
||||
description = "My Special Item",
|
||||
inventory_image = "modname_itemname.png"
|
||||
minetest.register_craftitem("nomemod:nomeoggetto", {
|
||||
description = "Il Mio Super Oggetto",
|
||||
inventory_image = "nomemod_nomeoggetto.png"
|
||||
})
|
||||
```
|
||||
|
||||
### Item Names and Aliases
|
||||
### Nomi oggetto e alias
|
||||
|
||||
Every item has an item name used to refer to it, which should be in the
|
||||
following format:
|
||||
Ogni oggetto ha un nome usato per riferirsi a esso, che dovrebbe seguire la seguente struttura:
|
||||
|
||||
modname:itemname
|
||||
nomemod:nomeoggetto
|
||||
|
||||
The modname is the name of the mod in which the item is registered, and the
|
||||
item name is the name of the item itself.
|
||||
The item name should be relevant to what the item is and can't already be registered.
|
||||
Il nomemod equivale appunto al nome della mod che registra l'oggetto, e nomeoggetto è
|
||||
il nome che si vuole assegnare a quest'ultimo.
|
||||
Il nome dell'oggetto dovrebbe essere inerente a quello che rappresenta e deve essere unico nella mod.
|
||||
|
||||
Items can also have *aliases* pointing to their name.
|
||||
An *alias* is a pseudo-item name which results in the engine treating any
|
||||
occurrences of the alias as if it were the item name.
|
||||
There are two main common uses of this:
|
||||
Gli oggetti possono anche avere degli *alias* che puntano al loro nome.
|
||||
Un *alias* è uno pseudonimo che dice al motore di gioco di trattarlo come se fosse il nome a cui punta.
|
||||
Ciò è comunemente usato in due casi:
|
||||
|
||||
* Renaming removed items to something else.
|
||||
There may be unknown nodes in the world and in inventories if an item is
|
||||
removed from a mod without any corrective code.
|
||||
It's important to avoid aliasing to an unobtainable node if the remove node
|
||||
could be obtained.
|
||||
* Adding a shortcut. `/giveme dirt` is easier than `/giveme default:dirt`.
|
||||
* Rinominare gli oggetti rimossi in qualcos'altro.
|
||||
Ci potrebbero essere nodi sconosciuti nel mondo e negli inventari se un oggetto
|
||||
viene rimosso da una mod senza nessun codice per gestirlo.
|
||||
È importante evitare di assegnare come alias nomi di nodi inottenibili già esistenti
|
||||
al nodo rimosso, se quest'ultimo poteva essere ottenuto.
|
||||
* Aggiungere una scorciatoia. `/giveme dirt` è più semplice di `/giveme default:dirt`.
|
||||
|
||||
Registering an alias is pretty simple.
|
||||
A good way to remember the order of the arguments is `from → to` where
|
||||
*from* is the alias and *to* is the target.
|
||||
Registrare un alias è alquanto semplice.
|
||||
Un buon modo per ricordarne il funzionamento è `da → a`, dove *da*
|
||||
è l'alias e *a* è il nome dell'oggetto a cui punta.
|
||||
|
||||
```lua
|
||||
minetest.register_alias("dirt", "default:dirt")
|
||||
```
|
||||
|
||||
Mods need to make sure to resolve aliases before dealing directly with item names,
|
||||
as the engine won't do this.
|
||||
This is pretty simple though:
|
||||
Le mod devono assicurarsi di elaborare gli alias prima di occuparsi direttamente
|
||||
del nome dell'oggeto, in quanto l'engine non lo fa di suo.
|
||||
Ciò è comunque molto semplice:
|
||||
|
||||
```lua
|
||||
itemname = minetest.registered_aliases[itemname] or itemname
|
||||
```
|
||||
|
||||
### Textures
|
||||
### Texture
|
||||
|
||||
Textures should be placed in the textures/ folder with names in the format
|
||||
`modname_itemname.png`.\\
|
||||
JPEG textures are supported, but they do not support transparency and are generally
|
||||
bad quality at low resolutions.
|
||||
It is often better to use the PNG format.
|
||||
Per convenzione le texture andrebbero messe nella cartella textures/ con nomi che seguono la struttura
|
||||
`nomemod_nomeoggetto.png`.\\
|
||||
Le immagini in JPEG sono supportate, ma non supportano la trasparenza e sono generalmente
|
||||
di cattiva qualità nelle basse risoluzioni.
|
||||
Si consiglia quindi il formato PNG.
|
||||
|
||||
Textures in Minetest are usually 16 by 16 pixels.
|
||||
They can be any resolution, but it is recommended that they are in the order of 2,
|
||||
for example, 16, 32, 64, or 128.
|
||||
This is because other resolutions may not be supported correctly on older devices,
|
||||
resulting in decreased performance.
|
||||
Le texture su Minetest sono generalmente 16x16 pixel.
|
||||
Possono essere di qualsiasi dimensione, ma è buona norma che rientrino nelle potenze di 2,
|
||||
per esempio 16, 32, 64 o 128.
|
||||
Questo perché dimensioni differenti potrebbero non essere supportate dai vecchi dispositivi,
|
||||
comportando una diminuzione delle performance.
|
||||
|
||||
## Registering a basic node
|
||||
## Registrare un nodo base
|
||||
|
||||
```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"},
|
||||
is_ground_content = true,
|
||||
groups = {cracky=3, stone=1}
|
||||
})
|
||||
```
|
||||
|
||||
The `tiles` property is a table of texture names the node will use.
|
||||
When there is only one texture, this texture is used on every side.
|
||||
To give a different texture per-side, supply the names of 6 textures in this order:
|
||||
La proprietà `tiles` è una tabella contenente le texture che il nodo userà.
|
||||
Quando è presente una sola texture, questa sarà applicata su tutte le facce.
|
||||
Per assegnarne invece di diverse, bisogna fornire il nome di 6 texture in quest'ordine:
|
||||
|
||||
up (+Y), down (-Y), right (+X), left (-X), back (+Z), front (-Z).
|
||||
sopra (+Y), sotto (-Y), destra (+X), sinistra (-X), dietro (+Z), davanti (-Z).
|
||||
(+Y, -Y, +X, -X, +Z, -Z)
|
||||
|
||||
Remember that +Y is upwards in Minetest, as is the convention with
|
||||
3D computer graphics.
|
||||
Ricorda che su Minetest, come nella convenzione della computer grafica 3D, +Y punta verso l'alto.
|
||||
|
||||
```lua
|
||||
minetest.register_node("mymod:diamond", {
|
||||
description = "Alien Diamond",
|
||||
minetest.register_node("miamod:diamante", {
|
||||
description = "Diamante alieno",
|
||||
tiles = {
|
||||
"mymod_diamond_up.png", -- y+
|
||||
"mymod_diamond_down.png", -- y-
|
||||
"mymod_diamond_right.png", -- x+
|
||||
"mymod_diamond_left.png", -- x-
|
||||
"mymod_diamond_back.png", -- z+
|
||||
"mymod_diamond_front.png", -- z-
|
||||
"miamod_diamante_up.png", -- y+
|
||||
"miamod_diamante_down.png", -- y-
|
||||
"miamod_diamante_right.png", -- x+
|
||||
"miamod_diamante_left.png", -- x-
|
||||
"miamod_diamante_back.png", -- z+
|
||||
"miamod_diamante_front.png", -- z-
|
||||
},
|
||||
is_ground_content = true,
|
||||
groups = {cracky = 3},
|
||||
drop = "mymod:diamond_fragments"
|
||||
-- ^ Rather than dropping diamond, drop mymod:diamond_fragments
|
||||
drop = "miamod:diamante_frammenti"
|
||||
-- ^ Al posto di rilasciare diamanti, rilascia miamod:diamante_frammenti
|
||||
})
|
||||
```
|
||||
|
||||
The is_ground_content attribute allows caves to be generated over the stone.
|
||||
This is essential for any node which may be placed during map generation underground.
|
||||
Caves are cut out of the world after all the other nodes in an area have generated.
|
||||
L'attributo is_ground_content è essenziale per ogni nodo che si vuole far apparire sottoterra
|
||||
durante la generazione della mappa.
|
||||
Le caverne vengono scavate nel mondo dopo che tutti gli altri nodi nell'area sono stati generati.
|
||||
|
||||
## Actions and Callbacks
|
||||
## Azioni e callback
|
||||
|
||||
Minetest heavily uses a callback-based modding design.
|
||||
Callbacks can be placed in the item definition table to allow response to various
|
||||
different user events.
|
||||
Minetest usa ampiamente una struttura per il modding incentrata sui callback (richiami).
|
||||
I callback possono essere inseriti nella tabella di definizioni dell'oggetto per permettere una
|
||||
risposta a vari tipi di eventi generati dall'utente.
|
||||
|
||||
### on_use
|
||||
|
||||
By default, the use callback is triggered when a player left-clicks with an item.
|
||||
Having a use callback prevents the item being used to dig nodes.
|
||||
One common use of the use callback is for food:
|
||||
Di base, il callback on_use scatta quando un giocatore clicca col tasto sinistro con l'oggetto in mano.
|
||||
Avere un callback sull'uso previene che l'oggetto venga utilizzato per scavare nodi.
|
||||
Un utilizzo comune di questo callback è per il cibo:
|
||||
|
||||
```lua
|
||||
minetest.register_craftitem("mymod:mudpie", {
|
||||
description = "Alien Mud Pie",
|
||||
inventory_image = "myfood_mudpie.png",
|
||||
minetest.register_craftitem("miamod:fangotorta", {
|
||||
description = "Torta aliena di fango",
|
||||
inventory_image = "miamod_fangotorta.png",
|
||||
on_use = minetest.item_eat(20),
|
||||
})
|
||||
```
|
||||
|
||||
The number supplied to the minetest.item_eat function is the number of hit points
|
||||
healed when this food is consumed.
|
||||
Each heart icon the player has is worth two hitpoints.
|
||||
A player can usually have up to 10 hearts, which is equal to 20 hitpoints.
|
||||
Hitpoints don't have to be integers (whole numbers); they can be decimals.
|
||||
Il numero fornito alla funzione minetest.item_eat è il numero di punti salute ripristinati al
|
||||
consumare il cibo.
|
||||
In gioco ogni cuore equivale a due punti.
|
||||
Un giocatore ha solitamente un massimo di 10 cuori, ovvero 20 punti salute.
|
||||
Quest'ultimi non devono per forza essere interi, bensì possono anche essere decimali.
|
||||
|
||||
minetest.item_eat() is a function which returns a function, setting it
|
||||
as the on_use callback.
|
||||
This means the code above is roughly similar to this:
|
||||
minetest.item_eat() è una funzione che ritorna un'altra funzione, in questo caso
|
||||
quindi impostandola come callback di on_use.
|
||||
Ciò significa che il codice in alto è alquanto simile al seguente:
|
||||
|
||||
```lua
|
||||
minetest.register_craftitem("mymod:mudpie", {
|
||||
description = "Alien Mud Pie",
|
||||
inventory_image = "myfood_mudpie.png",
|
||||
minetest.register_craftitem("miamod:fangotorta", {
|
||||
description = "Torta aliena di fango",
|
||||
inventory_image = "miamod_fangotorta.png",
|
||||
on_use = function(...)
|
||||
return minetest.do_item_eat(20, nil, ...)
|
||||
end,
|
||||
})
|
||||
```
|
||||
|
||||
By understanding how item_eat works by simply returning a function, it's
|
||||
possible to modify it to do more complex behaviour such as play a custom sound.
|
||||
Capendo come funziona item_eat, è possibile modificarlo per operazioni più complesse
|
||||
come per esempio riprodurre un suono personalizzato.
|
||||
|
||||
## Crafting
|
||||
## Fabbricazione
|
||||
|
||||
There are several types of crafting recipe available, indicated by the `type`
|
||||
property.
|
||||
Ci sono diversi tipi di ricette di fabbricazione disponibili, indicate dalla proprietà `type`.
|
||||
|
||||
* shaped - Ingredients must be in the correct position.
|
||||
* shapeless - It doesn't matter where the ingredients are,
|
||||
just that there is the right amount.
|
||||
* cooking - Recipes for the furnace to use.
|
||||
* fuel - Defines items which can be burned in furnaces.
|
||||
* tool_repair - Defines items which can be tool repaired.
|
||||
* shaped - Gli ingredienti devono essere nel giusta posizione.
|
||||
* shapeless - Non importa dove sono gli ingredienti, solo che siano abbastanza.
|
||||
* cooking - Ricette di cottura per la fornace.
|
||||
* fuel - Definisce gli oggetti che possono alimentare il fuoco nella fornace.
|
||||
* tool_repair - Definisce gli oggetti che possono essere riparati.
|
||||
|
||||
Craft recipes are not items, so they do not use Item Names to uniquely
|
||||
identify themselves.
|
||||
Le ricette di fabbricazione non sono oggetti, perciò non usano nomi oggetto per
|
||||
identificare in maniera univoca se stesse
|
||||
|
||||
### Shaped
|
||||
### Fisse (shaped)
|
||||
|
||||
Shaped recipes are when the ingredients need to be in the right shape or
|
||||
pattern to work. In the example below, the fragments need to be in a
|
||||
chair-like pattern for the craft to work.
|
||||
Le ricette fisse avvengono quando gli ingredienti devono essere nella forma o sequenza
|
||||
corretta per funzionare. Nell'esempio sotto, i frammenti necessitano di essere in
|
||||
in una figura a forma di sedia per poter fabbricare appunto 99 sedie.
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
type = "shaped",
|
||||
output = "mymod:diamond_chair 99",
|
||||
output = "miamod:diamante_sedia 99",
|
||||
recipe = {
|
||||
{"mymod:diamond_fragments", "", ""},
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments", ""},
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments", ""}
|
||||
{"miamod:diamante_frammenti", "", ""},
|
||||
{"miamod:diamante_frammenti", "miamod:diamante_frammenti", ""},
|
||||
{"miamod:diamante_frammenti", "miamod:diamante_frammenti", ""}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
One thing to note is the blank column on the right-hand side.
|
||||
This means that there *must* be an empty column to the right of the shape, otherwise
|
||||
this won't work.
|
||||
If this empty column shouldn't be required, then the empty strings can be left
|
||||
out like so:
|
||||
Una cosa da tener presente è la colonna vuota sulla parte destra.
|
||||
Questo significa che ci *deve* essere una colonna vuota a destra della forma, altrimenti
|
||||
ciò non funzionerà.
|
||||
Se invece la colonna non dovesse servire, basta ometterla in questo modo:
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
output = "mymod:diamond_chair 99",
|
||||
output = "miamod:diamante_sedia 99",
|
||||
recipe = {
|
||||
{"mymod:diamond_fragments", "" },
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments"},
|
||||
{"mymod:diamond_fragments", "mymod:diamond_fragments"}
|
||||
{"miamod:diamante_frammenti", "" },
|
||||
{"miamod:diamante_frammenti", "miamod:diamante_frammenti"},
|
||||
{"miamod:diamante_frammenti", "miamod:diamante_frammenti"}
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
The type field isn't actually needed for shaped crafts, as shaped is the
|
||||
default craft type.
|
||||
Il campo type non è davvero necessario per le ricette fisse, in quanto sono
|
||||
il tipo di base.
|
||||
|
||||
### Shapeless
|
||||
### Informi (shapeless)
|
||||
|
||||
Shapeless recipes are a type of recipe which is used when it doesn't matter
|
||||
where the ingredients are placed, just that they're there.
|
||||
Le ricette informi sono ricette che vengono usate quando non importa
|
||||
dove sono posizionati gli ingredienti, ma solo che ci siano.
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mymod:diamond 3",
|
||||
output = "miamod:diamante 3",
|
||||
recipe = {
|
||||
"mymod:diamond_fragments",
|
||||
"mymod:diamond_fragments",
|
||||
"mymod:diamond_fragments",
|
||||
"miamod:diamante_frammenti",
|
||||
"miamod:diamante_frammenti",
|
||||
"miamod:diamante_frammenti",
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
### Cooking and Fuel
|
||||
### Cottura (cooking) e carburante (fuel)
|
||||
|
||||
Recipes with the type "cooking" are not made in the crafting grid,
|
||||
but are cooked in furnaces, or other cooking tools that might be found in mods.
|
||||
Le ricette di tipo "cottura" non vengono elaborate nella griglia di fabbricazione,
|
||||
bensì nelle fornaci o in qualsivoglia altro strumento di cottura che può essere trovato
|
||||
nelle mod.
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "mymod:diamond_fragments",
|
||||
output = "miamod_diamante_frammenti",
|
||||
recipe = "default:coalblock",
|
||||
cooktime = 10,
|
||||
})
|
||||
```
|
||||
|
||||
The only real difference in the code is that the recipe is just a single item,
|
||||
compared to being in a table (between braces).
|
||||
They also have an optional "cooktime" parameter which
|
||||
defines how long the item takes to cook.
|
||||
If this is not set, it defaults to 3.
|
||||
L'unica vera differenza nel codice è che in questo la ricetta non è una tabella (tra parentesi graffe),
|
||||
bensì un singolo oggetto.
|
||||
Le ricette di cottura dispongono anche di un parametro aggiuntivo "cooktime"
|
||||
che indica in secondi quanto tempo ci impiega l'oggetto a cuocersi.
|
||||
Se non è impostato, di base è 3.
|
||||
|
||||
The recipe above works when the coal block is in the input slot,
|
||||
with some form of fuel below it.
|
||||
It creates diamond fragments after 10 seconds!
|
||||
La ricetta qui sopra genera un'unità di frammenti di diamante dopo 10 secondi quando
|
||||
il blocco di carbone (coalblock) è nello slot di input, con un qualche tipo di carburante sotto di esso.
|
||||
|
||||
This type is an accompaniment to the cooking type, as it defines
|
||||
what can be burned in furnaces and other cooking tools from mods.
|
||||
Il tipo "carburante" invece funge da accompagnamento alle ricette di cottura,
|
||||
in quanto definisce cosa può alimentare il fuoco.
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "mymod:diamond",
|
||||
recipe = "miamod:diamante",
|
||||
burntime = 300,
|
||||
})
|
||||
```
|
||||
|
||||
They don't have an output like other recipes, but they have a burn time
|
||||
which defines how long they will last as fuel in seconds.
|
||||
So, the diamond is good as fuel for 300 seconds!
|
||||
Esso non ha un output come le altre ricette, e possiede un tempo di arsura (burntime)
|
||||
che definisce in secondi per quanto alimenterà la fiamma. In questo caso, 300 secondi!
|
||||
|
||||
## Groups
|
||||
## Gruppi
|
||||
|
||||
Items can be members of many groups and groups can have many members.
|
||||
Groups are defined using the `groups` property in the definition table
|
||||
and have an associated value.
|
||||
Gli oggetti possono essere membri di più gruppi, e i gruppi possono avere più membri.
|
||||
Essi sono definiti usando la proprietà `groups` nella tabella di definizione,
|
||||
e possiedono un valore associato.
|
||||
|
||||
```lua
|
||||
groups = {cracky = 3, wood = 1}
|
||||
```
|
||||
|
||||
There are several reasons you use groups.
|
||||
Firstly, groups are used to describe properties such as dig types and flammability.
|
||||
Secondly, groups can be used in a craft recipe instead of an item name to allow
|
||||
any item in the group to be used.
|
||||
Ci sono diverse ragioni per cui usare i gruppi.
|
||||
In primis, vengono utilizzati per descrivere proprietà come friabilità e infiammabilità.
|
||||
In secundis, possono essere usati in una ricetta al posto di un nome oggetto per permettere
|
||||
a qualsiasi oggetto nel gruppo di essere utilizzato.
|
||||
|
||||
```lua
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "mymod:diamond_thing 3",
|
||||
recipe = {"group:wood", "mymod:diamond"}
|
||||
output = "miamod:diamante_qualcosa 3",
|
||||
recipe = {"group:wood", "miamod:diamante"}
|
||||
})
|
||||
```
|
||||
|
||||
## Tools, Capabilities, and Dig Types
|
||||
## Strumenti, Capacità e Friabilità
|
||||
|
||||
Dig types are groups which are used to define how strong a node is when dug
|
||||
with different tools.
|
||||
A dig type group with a higher associated value means the node is easier
|
||||
and quicker to cut.
|
||||
It's possible to combine multiple dig types to allow the more efficient use
|
||||
of multiple types of tools.
|
||||
A node with no dig types cannot be dug by any tools.
|
||||
Le friabilità sono dei gruppi particolari utilizzati per definire la resistenza di un nodo
|
||||
quando scavato con un determinato strumento.
|
||||
Una friabilità elevata equivale a una maggior facilità e velocità nel romperlo.
|
||||
È possibile combinarne di più tipi per permettere al nodo di essere distrutto da più tipi di strumento.
|
||||
Un nodo senza friabilità non può essere distrutto da nessuno strumento.
|
||||
|
||||
| Gruppo | Miglior strumento | Descrizione |
|
||||
|---------|-------------------|-------------|
|
||||
| crumbly | pala | Terra, sabbia |
|
||||
| cracky | piccone | Cose dure e sgretolabili come la pietra |
|
||||
| snappy | *qualsiasi* | Può essere rotto usando uno strumento adatto;<br>es. foglie, piantine, filo, lastre di metallo |
|
||||
| choppy | ascia | Può essere rotto con dei fendenti; es. alberi, assi di legno |
|
||||
| fleshy | spada | Esseri viventi come animali e giocatori.<br>Potrebbe implicare effetti di sangue al colpire |
|
||||
| explody | ? | Predisposti ad esplodere |
|
||||
| oddly_breakable_by_hand | *qualsiasi* | Torce e simili — molto veloci da rompere |
|
||||
|
||||
|
||||
| Group | Best Tool | Description |
|
||||
|--------|-----------|-------------|
|
||||
| crumbly | spade | Dirt, sand |
|
||||
| cracky | pickaxe | Tough (but brittle) stuff like stone |
|
||||
| snappy | *any* | Can be cut using fine tools;<br>e.g. leaves, smallplants, wire, sheets of metal |
|
||||
| choppy | axe | Can be cut using a sharp force; e.g. trees, wooden planks |
|
||||
| fleshy | sword | Living things like animals and the player.<br>This could imply some blood effects when hitting. |
|
||||
| explody | ? | Especially prone to explosions |
|
||||
| oddly_breakable_by_hand | *any* | Torches and such - very quick to dig |
|
||||
|
||||
|
||||
Every tool has a tool capability.
|
||||
A capability includes a list of supported dig types, and associated properties
|
||||
for each type such as dig times and the amount of wear.
|
||||
Tools can also have a maximum supported hardness for each type, which makes
|
||||
it possible to prevent weaker tools from digging harder nodes.
|
||||
It's very common for tools to include all dig types in their capabilities,
|
||||
with the less suitable ones having very inefficient properties.
|
||||
If the item a player is currently wielding doesn't have an explicit tool
|
||||
capability, then the capability of the current hand is used instead.
|
||||
Ogni strumento possiede poi delle capacità (capability).
|
||||
Una capacità include una lista di friabilità supportate, e proprietà associate
|
||||
per ognuna di esse come la velocità di scavata e il livello di usura.
|
||||
Gli strumenti possono anche avere una durezza massima supportata per ogni tipo;
|
||||
ciò serve a prevenire che strumenti più deboli possano rompere nodi meno friabili.
|
||||
È poi molto comune che uno strumento includa tutte le friabilità nelle sue capacità,
|
||||
con quelle meno adatte equivalenti a proprietà inefficienti.
|
||||
Se l'oggetto impugnato dal giocatore non ha una capacità esplicitata,
|
||||
verrà allora usata quella della mano.
|
||||
|
||||
```lua
|
||||
minetest.register_tool("mymod:tool", {
|
||||
description = "My Tool",
|
||||
inventory_image = "mymod_tool.png",
|
||||
minetest.register_tool("miamod:strumento", {
|
||||
description = "Il mio strumento",
|
||||
inventory_image = "miamod_strumento.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = 1.5,
|
||||
max_drop_level = 1,
|
||||
@ -376,7 +365,6 @@ minetest.register_tool("mymod:tool", {
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
Groupcaps is the list of supported dig types for digging nodes.
|
||||
Damage groups are for controlling how tools damage objects, which will be
|
||||
discussed later in the Objects, Players, and Entities chapter.
|
||||
I gruppi limite (groupcaps) sono una lista delle friabilità supportate dallo strumento.
|
||||
I gruppi di danno invece (damage_groups) servono a controllare come uno strumento (esterno) danneggia
|
||||
quell'oggetto. Quest'ultimi verranno discussi in seguito nel capitolo Oggetti, Giocatori e Entità.
|
||||
|
Loading…
x
Reference in New Issue
Block a user