From fb99ab6d6cebf727840e88fa1f4e2bac23f3cbb9 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sat, 26 Jun 2021 23:15:26 +0100
Subject: [PATCH 01/40] Fix syntax error in Lua in environment.md
---
_en/map/environment.md | 2 +-
_it/map/environment.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/_en/map/environment.md b/_en/map/environment.md
index fe7cf6d..cd26fc2 100644
--- a/_en/map/environment.md
+++ b/_en/map/environment.md
@@ -202,7 +202,7 @@ local function emerge_callback(pos, action,
-- Send progress message
if context.total_blocks == context.loaded_blocks then
minetest.chat_send_all("Finished loading blocks!")
- end
+ else
local perc = 100 * context.loaded_blocks / context.total_blocks
local msg = string.format("Loading blocks %d/%d (%.2f%%)",
context.loaded_blocks, context.total_blocks, perc)
diff --git a/_it/map/environment.md b/_it/map/environment.md
index 7852a54..9e46c3d 100644
--- a/_it/map/environment.md
+++ b/_it/map/environment.md
@@ -184,7 +184,7 @@ local function mio_callback(pos, action,
-- Invia messaggio indicante il progresso
if param.blocchi_totali == param.blocchi_caricati then
minetest.chat_send_all("Ho finito di caricare blocchi!")
- end
+ else
local percentuale = 100 * param.blocchi_caricati / param.blocchi_totali
local msg = string.format("Caricamento blocchi %d/%d (%.2f%%)",
param.blocchi_caricati, param.blocchi_totali, percentuale)
From 6c8ef461b7c74fff8a6c8751f07e9322450a9493 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Mon, 21 Mar 2022 00:39:02 +0000
Subject: [PATCH 02/40] Update .gitlab-ci.yml
---
.gitlab-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index be6ed38..18d70da 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -24,7 +24,7 @@ pages:
before_script:
- rm Gemfile.lock
script:
- - bundle exec jekyll build -d public
+ - bundle exec jekyll build -d public --baseurl /minetest_modding_book
artifacts:
paths:
- public
From 310f2d120d03e7325429cd5dc6063c2bba46e6a8 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 22 Mar 2022 12:25:47 +0000
Subject: [PATCH 03/40] Lua: Reorder programming section
---
_en/basics/lua.md | 35 +++++++++++++++++++----------------
_it/basics/lua.md | 35 ++++++++++++++++++++---------------
2 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/_en/basics/lua.md b/_en/basics/lua.md
index e0188b6..6ae2f3f 100644
--- a/_en/basics/lua.md
+++ b/_en/basics/lua.md
@@ -12,6 +12,7 @@ redirect_from: /en/chapters/lua.html
In this chapter we'll talk about scripting in Lua, the tools required
to assist with this, and some techniques which you may find useful.
+- [Programming](#programming)
- [Code Editors](#code-editors)
- [Coding in Lua](#coding-in-lua)
- [Program Flow](#program-flow)
@@ -19,11 +20,27 @@ to assist with this, and some techniques which you may find useful.
- [Arithmetic Operators](#arithmetic-operators)
- [Selection](#selection)
- [Logical Operators](#logical-operators)
-- [Programming](#programming)
- [Local and Global Scope](#local-and-global-scope)
- - [Locals should be used as much as possible](#locals-should-be-used-as-much-as-possible)
- [Including other Lua Scripts](#including-other-lua-scripts)
+
+## Programming
+
+Programming is the action of taking a problem, such as sorting a list
+of items, and turning it into steps that a computer can understand.
+
+Teaching you the logical process of programming is beyond the scope of this book;
+however, the following websites are quite useful in developing this:
+
+* [Codecademy](http://www.codecademy.com/) is one of the best resources for
+ learning to write code. It provides an interactive tutorial experience.
+* [Scratch](https://scratch.mit.edu) is a good resource for starting from
+ absolute basics, and learning the problem-solving techniques required to program.\\
+ Scratch is *designed to teach children* how to program and isn't a serious
+ programming language.
+* [Programming with Mosh](https://www.youtube.com/user/programmingwithmosh) is
+ a good YouTube series to learn programming.
+
## Code Editors
A code editor with code highlighting is sufficient for writing scripts in Lua.
@@ -184,20 +201,6 @@ if is_equal then
end
```
-## Programming
-
-Programming is the action of taking a problem, such as sorting a list
-of items, and turning it into steps that a computer can understand.
-
-Teaching you the logical process of programming is beyond the scope of this book;
-however, the following websites are quite useful in developing this:
-
-* [Codecademy](http://www.codecademy.com/) is one of the best resources for
- learning to write code. It provides an interactive tutorial experience.
-* [Scratch](https://scratch.mit.edu) is a good resource for starting from
- absolute basics, and learning the problem-solving techniques required to program.\\
- Scratch is *designed to teach children* how to program and isn't a serious
- programming language.
## Local and Global Scope
diff --git a/_it/basics/lua.md b/_it/basics/lua.md
index ebe3bd4..762ca75 100644
--- a/_it/basics/lua.md
+++ b/_it/basics/lua.md
@@ -11,17 +11,31 @@ redirect_from: /it/chapters/lua.html
In questo capitolo parleremo della programmazione in Lua, degli strumenti necessari, e tratteremo alcune tecniche che troverai probabilmente utili.
+- [Programmare](#programmare)
- [Editor di codice](#editor-di-codice)
- [Programmare in Lua](#programmare-in-lua)
- - [Flusso del programma](#flusso-del-programma)
- - [Tipi di variabili](#tipi-di-variabili)
- - [Operatori matematici](#operatori-matematici)
- - [Selezione](#selezione)
- - [Operatori logici](#operatori-logici)
-- [Programmare](#programmare)
+ - [Flusso del programma](#flusso-del-programma)
+ - [Tipi di variabili](#tipi-di-variabili)
+ - [Operatori matematici](#operatori-matematici)
+ - [Selezione](#selezione)
+ - [Operatori logici](#operatori-logici)
- [Portata locale e globale](#portata-locale-e-globale)
- [Inclusione di altri script Lua](#inclusione-di-altri-script-lua)
+
+## Programmare
+
+Programmare è l'azione di prendere un problema, come ordinare una lista di oggetti, e tramutarlo in dei passaggi che il computer può comprendere.
+
+Insegnarti i processi logici della programmazione non rientra nell'ambito di questo libro; tuttavia, i seguenti siti sono alquanto utili per approfondire l'argomento:
+
+* [Codecademy](http://www.codecademy.com/) è una delle migliori risorse per imparare come scrivere codice; offre un'esperienza guidata interattiva.
+* [Scratch](https://scratch.mit.edu) è una buona risorsa quando si comincia dalle basi assolute, imparando le tecniche di problem solving necessarie per la programmazione.\\
+ Scratch è *ideato per insegnare ai bambini* e non è un linguaggio serio di programmazione.
+* [Programming with Mosh](https://www.youtube.com/user/programmingwithmosh) is
+ a good YouTube series to learn programming.
+
+
## Editor di codice
Un editor di codice con evidenziamento delle parole chiave è sufficiente per scrivere script in Lua.
@@ -166,15 +180,6 @@ if is_equal then
end
```
-## Programmare
-
-Programmare è l'azione di prendere un problema, come ordinare una lista di oggetti, e tramutarlo in dei passaggi che il computer può comprendere.
-
-Insegnarti i processi logici della programmazione non rientra nell'ambito di questo libro; tuttavia, i seguenti siti sono alquanto utili per approfondire l'argomento:
-
-* [Codecademy](http://www.codecademy.com/) è una delle migliori risorse per imparare come scrivere codice; offre un'esperienza guidata interattiva.
-* [Scratch](https://scratch.mit.edu) è una buona risorsa quando si comincia dalle basi assolute, imparando le tecniche di problem solving necessarie per la programmazione.\\
- Scratch è *ideato per insegnare ai bambini* e non è un linguaggio serio di programmazione.
## Portata locale e globale
From f1fb608e98964cdb9c5dd51fd78abf346d2aad5d Mon Sep 17 00:00:00 2001
From: Zughy <4279489-marco_a@users.noreply.gitlab.com>
Date: Wed, 30 Mar 2022 12:39:54 +0000
Subject: [PATCH 04/40] IT | small fixes
---
_it/index.md | 14 +++++++-------
_it/quality/luacheck.md | 12 ++++++------
_it/quality/unit_testing.md | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/_it/index.md b/_it/index.md
index b0524ca..5074fbd 100644
--- a/_it/index.md
+++ b/_it/index.md
@@ -8,7 +8,7 @@ idx: 0.1
---
-
Minetest: Libro del Modding
+
Minetest: Libro del Moddaggio
di rubenwardycon modifiche di Shara
@@ -17,20 +17,20 @@ idx: 0.1
## Introduzione
-Il modding su Minetest è supportato grazie a script in Lua.
+Il moddaggio su Minetest è supportato grazie a script in Lua.
Questo libro mira a insegnarti come creare le tue mod, iniziando dalle basi.
-Ogni capitolo si concentra su un punto specifico dell'API, e ti porterà presto
+Ogni capitolo si concentra su un punto specifico dell'API, portandoti in breve tempo
a fare le tue mod.
Oltre che [leggere questo libro online](https://rubenwardy.com/minetest_modding_book),
puoi anche [scaricarlo in HTML](https://github.com/rubenwardy/minetest_modding_book/releases).
-### Feedback e Contributi
+### Riscontri e Contributi
-Hai notato un errore o vuoi dare un feedback? Assicurati di farmelo presente.
+Hai notato un errore o vuoi darmi il tuo parere? Assicurati di farmelo presente.
-* Crea una [Issue su GitLab](https://gitlab.com/rubenwardy/minetest_modding_book/-/issues).
-* Posta nel [Topic sul Forum](https://forum.minetest.net/viewtopic.php?f=14&t=10729).
+* Apri una [Segnalazione su GitLab](https://gitlab.com/rubenwardy/minetest_modding_book/-/issues).
+* Rispondi alla [Discussione sul Forum](https://forum.minetest.net/viewtopic.php?f=14&t=10729).
* [Contattami (in inglese)](https://rubenwardy.com/contact/).
* Voglia di contribuire?
[Leggi il README](https://gitlab.com/rubenwardy/minetest_modding_book/-/blob/master/README.md).
diff --git a/_it/quality/luacheck.md b/_it/quality/luacheck.md
index 33f9de9..06fc249 100644
--- a/_it/quality/luacheck.md
+++ b/_it/quality/luacheck.md
@@ -25,7 +25,7 @@ LuaCheck può essere usato in combinazione con l'editor per fornire avvertimenti
### Windows
-Basta scaricare luacheck.exe dall'apposita [pagina delle release su Github](https://github.com/mpeterv/luacheck/releases).
+Basta scaricare luacheck.exe dall'apposita [pagina delle versioni su Github](https://github.com/mpeterv/luacheck/releases).
### Linux
@@ -53,7 +53,7 @@ Su Linux, esegui `luacheck .` nella cartella principale del progetto.
## Configurare LuaCheck
Crea un file chiamato .luacheckrc nella cartella principale del tuo progetto.
-Questa può essere quella di un gioco, di una modpack o di una mod.
+Questa può essere quella di un gioco, di un pacchetto mod o di una mod singola.
Inserisci il seguente codice all'interno:
@@ -80,7 +80,7 @@ read_globals = {
Poi, avrai bisogno di assicurarti che funzioni eseguendo LuaCheck: dovresti ottenere molti meno errori questa volta.
Partendo dal primo errore, modifica il codice per risolvere il problema, o modifica la configurazione di LuaCheck se il codice è corretto.
-Dai un occhio alla lista sottostante.
+Dài un occhio alla lista sottostante.
### Risoluzione problemi
@@ -105,11 +105,11 @@ Queste sono disponibili nella maggior parte degli editor, come:
## Controllare i commit con Travis
Se il tuo progetto è pubblico ed è su Github, puoi usare TravisCI - un servizio gratuito per eseguire controlli sui commit.
-Questo significa che ogni commit pushato verrà controllato secondo le impostazioni di LuaCheck, e una spunta verde o una X rossa appariranno al suo fianco per segnalare se sono stati trovati errori o meno.
+Questo significa che ogni nuovo commit verrà controllato secondo le impostazioni di LuaCheck, e una spunta verde o una X rossa appariranno al suo fianco per segnalare se sono stati trovati errori o meno.
Ciò è utile soprattutto per quando il tuo progetto riceve una richiesta di modifica (*pull request*) per verificare se il codice è scritto bene senza doverlo scaricare.
Prima di tutto, vai su [travis-ci.org](https://travis-ci.org/) ed esegui l'accesso con il tuo account Github.
-Dopodiché cerca la repo del tuo progetto nel tuo profilo Travis, e abilita Travis cliccando sull'apposito bottone.
+Dopodiché cerca la repo del tuo progetto nel tuo profilo Travis, e abilita Travis cliccando sull'apposito pulsante.
Poi, crea un file chiamato `.travis.yml` con il seguente contenuto:
@@ -134,7 +134,7 @@ Se il tuo progetto è un gioco piuttosto che una mod o un pacchetto di mod, camb
- $HOME/.luarocks/bin/luacheck mods/
```
-Ora esegui il commit e il push su Github.
+Ora crea il commit e mandalo a Github.
Vai alla pagina del tuo progetto e clicca su "commits".
Dovresti vedere un cerchietto arancione di fianco al commit che hai appena fatto.
Dopo un po' di tempo il cerchietto dovrebbe cambiare in una spunta verde o in una X rossa (a seconda dell'esito, come detto prima).
diff --git a/_it/quality/unit_testing.md b/_it/quality/unit_testing.md
index 7071d97..40ea8ea 100644
--- a/_it/quality/unit_testing.md
+++ b/_it/quality/unit_testing.md
@@ -179,4 +179,4 @@ notifications:
I testing d'unità aumenteranno notevolmente la qualità e l'affidabilità di un progetto se usati adeguatamente, ma ti richiederanno di strutturare il codice in maniera diversa dal solito.
-Per un esempio di mod con molti testing d'unità, vedere la [crafting di rubenwardy](https://github.com/rubenwardy/crafting).
+Per un esempio di mod con molti testing d'unità, vedere la mod [*crafting* di rubenwardy](https://github.com/rubenwardy/crafting).
From 6494e4b3415ed908b1088bb51147ef40d878630f Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 7 Jun 2022 17:55:25 +0100
Subject: [PATCH 05/40] Add language and tags
---
_layouts/base.html | 19 +++++++++++++++++++
index.html | 1 +
2 files changed, 20 insertions(+)
diff --git a/_layouts/base.html b/_layouts/base.html
index 6e02eee..72ef1c0 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -3,7 +3,15 @@ layout: compress
---
+
+{% assign pathsplit = page.url | split: '/' %}
+{% assign language = pathsplit[1] %}
+{% assign language_info = site.data.languages | where: "code", language %}
+{% if language_info %}
+
+{% else %}
+{% endif %}
{% if page.homepage %}{% else %}{{ page.title }} - {% endif %}Minetest Modding Book
@@ -13,6 +21,17 @@ layout: compress
+
+
+ {% assign oldSegment = "/" | append: language | append: "/" %}
+ {% for other_lang in site.data.languages %}
+ {% unless other_lang.code == language %}
+ {% assign newSegment = "/" | append: other_lang.code | append: "/" %}
+
+
+ {% endunless %}
+ {% endfor %}
+
diff --git a/index.html b/index.html
index f6a1ef4..181283a 100644
--- a/index.html
+++ b/index.html
@@ -1,6 +1,7 @@
---
layout: none
---
+
Redirecting...
From f6f17982a29ef271f97cf47f531ecec03bb8ba9a Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 7 Jun 2022 18:05:28 +0100
Subject: [PATCH 06/40] Fix .gitlab-ci.yml
---
.gitlab-ci.yml | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 18d70da..179c084 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,6 +6,7 @@ variables:
before_script:
- rm Gemfile.lock
+ - bundle install
test:
stage: test
@@ -21,8 +22,6 @@ test:
pages:
stage: deploy
interruptible: true
- before_script:
- - rm Gemfile.lock
script:
- bundle exec jekyll build -d public --baseurl /minetest_modding_book
artifacts:
From 7e12752e12db2619234ac061fdf3d0c542fd9787 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 7 Jun 2022 18:10:31 +0100
Subject: [PATCH 07/40] Fix canonical link
---
_layouts/base.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_layouts/base.html b/_layouts/base.html
index 72ef1c0..265bb74 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -21,7 +21,7 @@ layout: compress
-
+
{% assign oldSegment = "/" | append: language | append: "/" %}
{% for other_lang in site.data.languages %}
From 770a6f4e2e43acd0a5af3149cc3f274e60c2bb13 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 7 Jun 2022 18:14:53 +0100
Subject: [PATCH 08/40] Fix URLs
---
_layouts/base.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/_layouts/base.html b/_layouts/base.html
index 265bb74..9b78984 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -28,7 +28,8 @@ layout: compress
{% unless other_lang.code == language %}
{% assign newSegment = "/" | append: other_lang.code | append: "/" %}
-
+
{% endunless %}
{% endfor %}
From ca08a9af49e7777c59692344e1f4bdb04ed6a501 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 14 Jun 2022 00:21:06 +0100
Subject: [PATCH 09/40] Remove mentions of Travis
---
_en/quality/luacheck.md | 44 ------------------------------------
_en/quality/unit_testing.md | 25 +--------------------
_it/quality/luacheck.md | 45 +++----------------------------------
_it/quality/unit_testing.md | 28 +++--------------------
_layouts/default.html | 2 +-
5 files changed, 8 insertions(+), 136 deletions(-)
diff --git a/_en/quality/luacheck.md b/_en/quality/luacheck.md
index d9b4410..855d117 100644
--- a/_en/quality/luacheck.md
+++ b/_en/quality/luacheck.md
@@ -20,7 +20,6 @@ editor to provide alerts to any mistakes.
- [Configuring LuaCheck](#configuring-luacheck)
- [Troubleshooting](#troubleshooting)
- [Using with editor](#using-with-editor)
-- [Checking Commits with Travis](#checking-commits-with-travis)
## Installing LuaCheck
@@ -107,46 +106,3 @@ available.
* **Sublime** - Install using package-control:
[SublimeLinter](https://github.com/SublimeLinter/SublimeLinter),
[SublimeLinter-luacheck](https://github.com/SublimeLinter/SublimeLinter-luacheck).
-
-## Checking Commits with Travis
-
-If your project is public and is on Github, you can use TravisCI - a free service
-to run jobs on commits to check them. This means that every commit you push will
-be checked against LuaCheck, and a green tick or red cross will be displayed next to them
-depending on whether LuaCheck finds any mistakes. This is especially helpful for
-when your project receives a pull request - you'll be able to see the LuaCheck output
-without downloading the code.
-
-First, you should visit [travis-ci.org](https://travis-ci.org/) and sign in with
-your Github account. Then find your project's repo in your Travis profile,
-and enable Travis by flipping the switch.
-
-Next, create a file called .travis.yml with the following content:
-
-```yml
-language: generic
-sudo: false
-addons:
- apt:
- packages:
- - luarocks
-before_install:
- - luarocks install --local luacheck
-script:
-- $HOME/.luarocks/bin/luacheck .
-notifications:
- email: false
-```
-
-If your project is a game rather than a mod or mod pack,
-change the line after `script:` to:
-
-```yml
-- $HOME/.luarocks/bin/luacheck mods/
-```
-
-Now commit and push to Github. Go to your project's page on Github, and click
-'commits'. You should see an orange disc next to the commit you just made.
-After awhile it should change either into a green tick or a red cross depending on the
-outcome of LuaCheck. In either case, you can click the icon to see the build logs
-and the output of LuaCheck.
diff --git a/_en/quality/unit_testing.md b/_en/quality/unit_testing.md
index 643380a..830f99e 100644
--- a/_en/quality/unit_testing.md
+++ b/_en/quality/unit_testing.md
@@ -17,9 +17,8 @@ we discussed how to structure your code avoid this.
- [Your First Test](#your-first-test)
- [init.lua](#initlua)
- [api.lua](#apilua)
- - [tests/api_spec.lua](#testsapispeclua)
+ - [tests/api_spec.lua](#testsapi_speclua)
- [Mocking: Using External Functions](#mocking-using-external-functions)
-- [Checking Commits with Travis](#checking-commits-with-travis)
- [Conclusion](#conclusion)
## Installing Busted
@@ -164,28 +163,6 @@ end)
```
-## Checking Commits with Travis
-
-The Travis script from the [Automatic Error Checking](luacheck.html)
-chapter can be modified to also run Busted.
-
-```yml
-language: generic
-sudo: false
-addons:
- apt:
- packages:
- - luarocks
-before_install:
- - luarocks install --local luacheck && luarocks install --local busted
-script:
-- $HOME/.luarocks/bin/luacheck .
-- $HOME/.luarocks/bin/busted .
-notifications:
- email: false
-```
-
-
## Conclusion
Unit tests will greatly increase the quality and reliability of your project if used
diff --git a/_it/quality/luacheck.md b/_it/quality/luacheck.md
index 06fc249..1c91704 100644
--- a/_it/quality/luacheck.md
+++ b/_it/quality/luacheck.md
@@ -13,13 +13,12 @@ In questo capitolo, imparerai come usare uno strumento chiamato LuaCheck per sca
LuaCheck può essere usato in combinazione con l'editor per fornire avvertimenti vari.
- [Installare LuaCheck](#installare-luacheck)
- - [Windows](#windows)
- - [Linux](#linux)
+ - [Windows](#windows)
+ - [Linux](#linux)
- [Eseguire LuaCheck](#eseguire-luacheck)
- [Configurare LuaCheck](#configurare-luacheck)
- - [Risoluzione problemi](#risoluzione-problemi)
+ - [Risoluzione problemi](#risoluzione-problemi)
- [Uso nell'editor](#uso-nelleditor)
-- [Controllare i commit con Travis](#controllare-i-commit-con-travis)
## Installare LuaCheck
@@ -101,41 +100,3 @@ Queste sono disponibili nella maggior parte degli editor, come:
* **Sublime** - Installala usando package-control:
[SublimeLinter](https://github.com/SublimeLinter/SublimeLinter),
[SublimeLinter-luacheck](https://github.com/SublimeLinter/SublimeLinter-luacheck).
-
-## Controllare i commit con Travis
-
-Se il tuo progetto è pubblico ed è su Github, puoi usare TravisCI - un servizio gratuito per eseguire controlli sui commit.
-Questo significa che ogni nuovo commit verrà controllato secondo le impostazioni di LuaCheck, e una spunta verde o una X rossa appariranno al suo fianco per segnalare se sono stati trovati errori o meno.
-Ciò è utile soprattutto per quando il tuo progetto riceve una richiesta di modifica (*pull request*) per verificare se il codice è scritto bene senza doverlo scaricare.
-
-Prima di tutto, vai su [travis-ci.org](https://travis-ci.org/) ed esegui l'accesso con il tuo account Github.
-Dopodiché cerca la repo del tuo progetto nel tuo profilo Travis, e abilita Travis cliccando sull'apposito pulsante.
-
-Poi, crea un file chiamato `.travis.yml` con il seguente contenuto:
-
-```yml
-language: generic
-sudo: false
-addons:
- apt:
- packages:
- - luarocks
-before_install:
- - luarocks install --local luacheck
-script:
-- $HOME/.luarocks/bin/luacheck .
-notifications:
- email: false
-```
-
-Se il tuo progetto è un gioco piuttosto che una mod o un pacchetto di mod, cambia la riga dopo `script:` con:
-
-```yml
-- $HOME/.luarocks/bin/luacheck mods/
-```
-
-Ora crea il commit e mandalo a Github.
-Vai alla pagina del tuo progetto e clicca su "commits".
-Dovresti vedere un cerchietto arancione di fianco al commit che hai appena fatto.
-Dopo un po' di tempo il cerchietto dovrebbe cambiare in una spunta verde o in una X rossa (a seconda dell'esito, come detto prima).
-In entrambi i casi, puoi cliccare l'icona per vedere il resoconto dell'operazione e l'output di LuaCheck.
diff --git a/_it/quality/unit_testing.md b/_it/quality/unit_testing.md
index 40ea8ea..99ec1db 100644
--- a/_it/quality/unit_testing.md
+++ b/_it/quality/unit_testing.md
@@ -13,11 +13,10 @@ Scrivere i testing d'unità per le funzioni dove vengono chiamate quelle di Mine
- [Installare Busted](#installare-busted)
- [Il tuo primo test](#il-tuo-primo-test)
- - [init.lua](#initlua)
- - [api.lua](#apilua)
- - [tests/api_spec.lua](#testsapispeclua)
+ - [init.lua](#initlua)
+ - [api.lua](#apilua)
+ - [tests/api_spec.lua](#testsapi_speclua)
- [Simulare: usare funzioni esterne](#simulare-usare-funzioni-esterne)
-- [Controllare commit con Travis](#controllare-commit-con-travis)
- [Conclusione](#conclusione)
## Installare Busted
@@ -154,27 +153,6 @@ end)
```
-## Controllare commit con Travis
-
-Lo script di Travis usato nel capitolo [Controllo automatico degli errori](luacheck.html) può essere modificato per eseguire (anche) Busted
-
-```yml
-language: generic
-sudo: false
-addons:
- apt:
- packages:
- - luarocks
-before_install:
- - luarocks install --local luacheck && luarocks install --local busted
-script:
-- $HOME/.luarocks/bin/luacheck .
-- $HOME/.luarocks/bin/busted .
-notifications:
- email: false
-```
-
-
## Conclusione
I testing d'unità aumenteranno notevolmente la qualità e l'affidabilità di un progetto se usati adeguatamente, ma ti richiederanno di strutturare il codice in maniera diversa dal solito.
diff --git a/_layouts/default.html b/_layouts/default.html
index 900a200..5e131e4 100644
--- a/_layouts/default.html
+++ b/_layouts/default.html
@@ -63,7 +63,7 @@ layout: base
+ So make sure that you don't assume that the player is online.
+ You can check by seeing if `minetest.get_player_by_name` returns a player.
cb_cmdsprivs:
level: warning
title: Privileges and Chat Commands
- message: The shout privilege isn't needed for a player to trigger this callback.
- This is because chat commands are implemented in Lua, and are just
- chat messages that begin with a /.
+ message: |
+ The shout privilege isn't needed for a player to trigger this callback.
+ This is because chat commands are implemented in Lua, and are just
+ chat messages that begin with a /.
---
@@ -29,17 +31,20 @@ cb_cmdsprivs:
Mods can interact with player chat, including
sending messages, intercepting messages, and registering chat commands.
-- [Sending Messages to All Players](#sending-messages-to-all-players)
-- [Sending Messages to Specific Players](#sending-messages-to-specific-players)
+- [Sending Messages](#sending-messages)
+ - [To All Players](#to-all-players)
+ - [To Specific Players](#to-specific-players)
- [Chat Commands](#chat-commands)
-- [Complex Subcommands](#complex-subcommands)
- - [Using string.split](#using-stringsplit)
- - [Using Lua patterns](#using-lua-patterns)
+ - [Accepting Multiple Arguments](#accepting-multiple-arguments)
+ - [Using string.split](#using-stringsplit)
+ - [Using Lua patterns](#using-lua-patterns)
- [Intercepting Messages](#intercepting-messages)
-## Sending Messages to All Players
+## Sending Messages
-To send a message to every player in the game, call the chat_send_all function.
+### To All Players
+
+To send a message to every player in the game, call the `chat_send_all` function.
```lua
minetest.chat_send_all("This is a chat message to all players")
@@ -53,9 +58,9 @@ Here is an example of how this appears in-game:
The message appears on a separate line to distinguish it from in-game player chat.
-## Sending Messages to Specific Players
+### To Specific Players
-To send a message to a specific player, call the chat_send_player function:
+To send a message to a specific player, call the `chat_send_player` function:
```lua
minetest.chat_send_player("player1", "This is a chat message for player1")
@@ -82,20 +87,25 @@ minetest.register_chatcommand("foo", {
In the above snippet, `interact` is listed as a required
[privilege](privileges.html) meaning that only players with the `interact` privilege can run the command.
+`param` is a string containing everything a player writes after the chatcommand
+name. For example, if a user types `/grantme one,two,three` then `param` will be
+`one,two,three`.
+
Chat commands can return up to two values,
the first being a Boolean indicating success, and the second being a
message to send to the user.
{% include notice.html notice=page.cmd_online %}
-## Complex Subcommands
+### Accepting Multiple Arguments
-It's common for chat commands to require multiple arguments, for example,
-`/team join `. There are two ways
-of doing this, either using Minetest's string split or Lua patterns.
+
+`param` gives you all the arguments to a chat command in a single string. It's
+common for chat commands to need to extract multiple arguments. There are two
+ways of doing this, either using Minetest's string split or Lua patterns.
-### Using string.split
+#### Using string.split
A string can be split up into words using `string.split(" ")`:
@@ -120,8 +130,7 @@ else
end
```
-
-### Using Lua patterns
+#### Using Lua patterns
[Lua patterns](https://www.lua.org/pil/20.2.html) are a way of extracting stuff
from text using rules. They're best suited for when there are arguments that can
From f6c8a4269646720b9525431839bd447bd759c3ce Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sat, 18 Jun 2022 21:44:03 +0100
Subject: [PATCH 16/40] Translations: Fix typos
---
_en/quality/translations.md | 2 +-
_it/quality/translations.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/_en/quality/translations.md b/_en/quality/translations.md
index 56ed37b..37e63ad 100644
--- a/_en/quality/translations.md
+++ b/_en/quality/translations.md
@@ -133,7 +133,7 @@ you join multiple sentences using concatenation. This helps translators by
keeping strings smaller.
```lua
-S("Hwllo @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
+S("Hello @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
```
diff --git a/_it/quality/translations.md b/_it/quality/translations.md
index 56ed37b..37e63ad 100644
--- a/_it/quality/translations.md
+++ b/_it/quality/translations.md
@@ -133,7 +133,7 @@ you join multiple sentences using concatenation. This helps translators by
keeping strings smaller.
```lua
-S("Hwllo @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
+S("Hello @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
```
From f9bc3f1fc0bb0c9ef191bee6d088c7883908d054 Mon Sep 17 00:00:00 2001
From: Zughy <4279489-marco_a@users.noreply.gitlab.com>
Date: Sun, 19 Jun 2022 22:18:53 +0000
Subject: [PATCH 17/40] IT | translation chapter + cleanup
---
_it/basics/lua.md | 127 ++-----------------------
_it/players/chat.md | 81 ++++++++--------
_it/quality/translations.md | 178 ++++++++++++++----------------------
3 files changed, 123 insertions(+), 263 deletions(-)
diff --git a/_it/basics/lua.md b/_it/basics/lua.md
index 762ca75..475fd78 100644
--- a/_it/basics/lua.md
+++ b/_it/basics/lua.md
@@ -12,14 +12,10 @@ redirect_from: /it/chapters/lua.html
In questo capitolo parleremo della programmazione in Lua, degli strumenti necessari, e tratteremo alcune tecniche che troverai probabilmente utili.
- [Programmare](#programmare)
+ - [Programmare in Lua](#programmare-in-lua)
- [Editor di codice](#editor-di-codice)
-- [Programmare in Lua](#programmare-in-lua)
- - [Flusso del programma](#flusso-del-programma)
- - [Tipi di variabili](#tipi-di-variabili)
- - [Operatori matematici](#operatori-matematici)
- - [Selezione](#selezione)
- - [Operatori logici](#operatori-logici)
- [Portata locale e globale](#portata-locale-e-globale)
+ - [Precedenza alla portata locale](#precedenza-alla-portata-locale)
- [Inclusione di altri script Lua](#inclusione-di-altri-script-lua)
@@ -35,6 +31,11 @@ Insegnarti i processi logici della programmazione non rientra nell'ambito di que
* [Programming with Mosh](https://www.youtube.com/user/programmingwithmosh) is
a good YouTube series to learn programming.
+### Programmare in Lua
+
+Neanche insegnarti come programmare in lua rientra nell'ambito di questo libro.
+Tuttavia, se mastichi l'inglese puoi rifarti a quest'altro libro, ["Programming in Lua"](https://www.lua.org/pil/contents.html), per un'eccellente infarinatura sull'argomento. Se invece l'inglese non è il tuo forte, troverai comunque svariate guide in italiano in giro per la rete.
+
## Editor di codice
@@ -70,117 +71,6 @@ Tra gli editor più famosi che ben si prestano a lavorare in Lua, troviamo:
(ne esistono ovviamente anche altri)
-## Programmare in Lua
-
-### Flusso del programma
-
-I programmi sono una serie di comandi che vengono eseguiti uno dopo l'altro.
-Chiamiamo questi comandi "istruzioni".
-Il flusso del programma è il come queste istruzioni vengono eseguite, e a differenti tipi di flusso corrispondono comportamenti diversi.
-Essi possono essere:
-
-* Sequenziali: eseguono un'istruzione dopo l'altra, senza salti.
-* Selettivi: saltano alcune sequenze a seconda delle condizioni.
-* Iteranti: continuano a eseguire le stesse istruzioni finché una condizione non è soddisfatta.
-
-Quindi, come vengono rappresentate le istruzioni in Lua?
-
-```lua
-local a = 2 -- Imposta 'a' a 2
-local b = 2 -- Imposta 'b' a 2
-local risultato = a + b -- Imposta 'risultato' ad a + b, cioè 4
-a = a + 10
-print("La somma è ".. risultato)
-```
-
-In quest'esempio, `a`, `b`, e `risultato` sono *variabili*. Le variabili locali si dichiarano tramite l'uso della parola chiave `local` (che vedremo tra poco), e assegnando eventualmente loro un valore iniziale.
-
-Il simbolo `=` significa *assegnazione*, quindi `risultato = a + b` significa impostare "risultato" ad a + b.
-Per quanto riguarda i nomi delle variabili, essi possono essere più lunghi di un carattere - al contrario che in matematica - come visto in `risultato`, e vale anche la pena notare che Lua è *case-sensitive* (differenzia maiuscole da minuscole); `A` è una variabile diversa da `a`.
-
-### Tipi di variabili
-
-Una variabile può equivalere solo a uno dei seguenti tipi e può cambiare tipo dopo l'assegnazione.
-È buona pratica assicurarsi che sia sempre solo o nil o diversa da nil.
-
-| Tipo | Descrizione | Esempio |
-|----------|---------------------------------|----------------|
-| Nil | Non inizializzata. La variabile è vuota, non ha valore | `local A`, `D = nil` |
-| Numero | Un numero intero o decimale | `local A = 4` |
-| Stringa | Una porzione di testo | `local D = "one two three"` |
-| Booleano | Vero o falso (true, false) | `local is_true = false`, `local E = (1 == 1)` |
-| Tabella | Liste | Spiegate sotto |
-| Funzione | Può essere eseguita. Può richiedere input e ritornare un valore | `local result = func(1, 2, 3)` |
-
-### Operatori matematici
-
-Tra gli operatori di Lua ci sono:
-
-| Simbolo | Scopo | Esempio |
-|---------|--------------------|---------------------------|
-| A + B | Addizione | 2 + 2 = 4 |
-| A - B | Sottrazione | 2 - 10 = -8 |
-| A * B | Moltiplicazione | 2 * 2 = 4 |
-| A / B | Divisione | 100 / 50 = 2 |
-| A ^ B | Potenze | 2 ^ 2 = 22 = 4 |
-| A .. B | Concatena stringhe | "foo" .. "bar" = "foobar" |
-
-Si tenga presente che questa non è comunque una lista esaustiva.
-
-### Selezione
-
-Il metodo di selezione più basico è il costrutto if.
-Si presenta così:
-
-```lua
-local random_number = math.random(1, 100) -- Tra 1 e 100.
-if random_number > 50 then
- print("Woohoo!")
-else
- print("No!")
-end
-```
-
-Questo esempio genera un numero casuale tra 1 e 100.
-Stampa poi "Woohoo!" se il numero è superiore a 50, altrimenti stampa "No!".
-
-### Operatori logici
-
-Tra gli operatori logici di Lua ci sono:
-
-| Simbolo | Scopo | Esempio |
-|---------|--------------------------------------|-------------------------------------------------------------|
-| A == B | Uguale a | 1 == 1 (true), 1 == 2 (false) |
-| A ~= B | Non uguale a (diverso da) | 1 ~= 1 (false), 1 ~= 2 (true) |
-| A > B | Maggiore di | 5 > 2 (true), 1 > 2 (false), 1 > 1 (false) |
-| A < B | Minore di | 1 < 3 (true), 3 < 1 (false), 1 < 1 (false) |
-| A >= B | Maggiore o uguale a | 5 >= 5 (true), 5 >= 3 (true), 5 >= 6 (false) |
-| A <= B | Minore o uguale a | 3 <= 6 (true), 3 <= 3 (true) |
-| A and B | E (entrambi devono essere veri) | (2 > 1) and (1 == 1) (true), (2 > 3) and (1 == 1) (false) |
-| A or B | O (almeno uno dei due vero) | (2 > 1) or (1 == 2) (true), (2 > 4) or (1 == 3) (false) |
-| not A | non vero | not (1 == 2) (true), not (1 == 1) (false) |
-
-La lista non è esaustiva, e gli operatori possono essere combinati, come da esempio:
-
-```lua
-if not A and B then
- print("Yay!")
-end
-```
-
-Che stampa "Yay!" se `A` è falso e `B` vero.
-
-Gli operatori logici e matematici funzionano esattamente allo stesso modo; entrambi accettano input e ritornano un valore che può essere immagazzinato. Per esempio:
-
-```lua
-local A = 5
-local is_equal = (A == 5)
-if is_equal then
- print("È equivalente!")
-end
-```
-
-
## Portata locale e globale
L'essere locale o globale di una variabile determina da dove è possibile accederci.
@@ -216,6 +106,9 @@ one()
two()
```
+
+### Precedenza alla portata locale
+
Le variabili locali dovrebbero venire usate il più possibile, con le mod che creano al massimo una globale corrispondente al nome della mod.
Crearne di ulteriori è considerato cattiva programmazione, e Minetest ci avviserà di ciò:
diff --git a/_it/players/chat.md b/_it/players/chat.md
index bba9167..f099932 100755
--- a/_it/players/chat.md
+++ b/_it/players/chat.md
@@ -8,17 +8,19 @@ redirect_from: /it/chapters/chat.html
cmd_online:
level: warning
title: I giocatori offline possono eseguire comandi
- message:
Viene passato il nome del giocatore al posto del giocatore in sé perché le mod possono eseguire comandi in vece di un giocatore offline.
- Per esempio, il bridge IRC permette ai giocatori di eseguire comandi senza dover entrare in gioco.
+ message: |
+ Viene passato il nome del giocatore al posto del giocatore in sé perché le mod possono eseguire comandi in vece di un giocatore offline.
+ Per esempio, il ponte IRC permette ai giocatori di eseguire comandi senza dover entrare in gioco.
-
Assicurati quindi di non dar per scontato che un giocatore sia connesso.
- Puoi controllare ciò tramite
minetest.get_player_by_name
, per vedere se ritorna qualcosa o meno.
+ Assicurati quindi di non dar per scontato che un giocatore sia connesso.
+ Puoi controllare ciò tramite `minetest.get_player_by_name`, per vedere se ritorna qualcosa o meno.
cb_cmdsprivs:
level: warning
title: Privilegi e comandi
- message: Il privilegio shout non è necessario per far sì che un giocatore attivi questo callback.
- Questo perché i comandi sono implementati in Lua, e sono semplicemente dei messaggi in chat che iniziano con /.
+ message: |
+ Il privilegio shout non è necessario per far sì che un giocatore attivi questo richiamo.
+ Questo perché i comandi sono implementati in Lua, e sono semplicemente dei messaggi in chat che iniziano con /.
---
@@ -26,15 +28,18 @@ cb_cmdsprivs:
Le mod possono interagire con la chat del giocatore, tra l'inviare messaggi, intercettarli e registrare dei comandi.
-- [Inviare messaggi a tutti i giocatori](#inviare-messaggi-a-tutti-i-giocatori)
-- [Inviare messaggi a giocatori specifici](#inviare-messaggi-a-giocatori-specifici)
+- [Inviare messaggi](#inviare-messaggi)
+ - [A tutti i giocatori](#a-tutti-i-giocatori)
+ - [A giocatori specifici](#a-giocatori-specifici)
- [Comandi](#comandi)
-- [Complex Subcommands](#complex-subcommands)
- - [Using string.split](#using-stringsplit)
- - [Using Lua patterns](#using-lua-patterns)
+ - [Accettare più argomenti](#accettare-più-argomenti)
+ - [Usare string.split](#usare-stringsplit)
+ - [Usare i pattern Lua](#usare-i-pattern-lua)
- [Intercettare i messaggi](#intercettare-i-messaggi)
-## Inviare messaggi a tutti i giocatori
+## Inviare messaggi
+
+### A tutti i giocatori
Per inviare un messaggio a tutti i giocatori connessi in gioco, si usa la funzione `chat_send_all`:
@@ -50,7 +55,7 @@ Segue un esempio di come apparirerebbe in gioco:
Il messaggio appare su una nuova riga, per distinguerlo dai messaggi dei giocatori.
-## Inviare messaggi a giocatori specifici
+### A giocatori specifici
Per inviare un messaggio a un giocatore in particolare, si usa invece la funzione `chat_send_player`:
@@ -77,50 +82,50 @@ minetest.register_chatcommand("foo", {
Nel codice qui in alto, `interact` è elencato come [privilegio](privileges.html) necessario; in altre parole, solo i giocatori che hanno quel privilegio possono usare il comando.
+`param` è una stringa contenente tutto ciò che un giocatore scrive dopo il nome del comando.
+Per esempio, in `/grantme uno,due,tre`, `param` equivarrà a `uno,due,tre`.
+
I comandi ritornano un massimo di due valori, dove il primo è un booleano che indica l'eventuale successo, mentre il secondo è un messaggio da inviare all'utente.
{% include notice.html notice=page.cmd_online %}
-## Complex Subcommands
+### Accettare più argomenti
-It's common for chat commands to require multiple arguments, for example,
-`/team join `. There are two ways
-of doing this, either using Minetest's string split or Lua patterns.
+Non è raro che i comandi richiedano più argomenti, come per esempio `/squadra entra `.
+Ci sono due modi per implementare ciò: usare `string.split` o i pattern Lua.
-### Using string.split
+#### Usare string.split
-A string can be split up into words using `string.split(" ")`:
+Una stringa può essere spezzettata in più parti tramite `string.split(" ")`:
```lua
-local parts = param:split(" ")
-local cmd = parts[1]
+local parti = param:split(" ")
+local cmd = parti[1]
-if cmd == "join" then
- local team_name = parts[2]
- team.join(name, team_name)
- return true, "Joined team!"
-elseif cmd == "max_users" then
- local team_name = parts[2]
- local max_users = tonumber(parts[3])
- if team_name and max_users then
- return true, "Set max users of team " .. team_name .. " to " .. max_users
+if cmd == "entra" then
+ local nome_squadra = parti[2]
+ squadra.entra(name, nome_squadra)
+ return true, "Sei dentro la squadra!"
+elseif cmd == "gioc_max" then
+ local nome_squadra = parti[2]
+ local gioc_max = tonumber(parti[3])
+ if nome_squadra and gioc_max then
+ return true, "Giocatori massimi della squadra " .. nome_squadra .. " impostati a " .. gioc_max
else
- return false, "Usage: /team max_users "
+ return false, "Uso: /squadra gioc_max "
end
else
- return false, "Command needed"
+ return false, "È necessario un comando"
end
```
-### Using Lua patterns
-
-[Lua patterns](https://www.lua.org/pil/20.2.html) are a way of extracting stuff
-from text using rules. They're best suited for when there are arguments that can
-contain spaces or more control is needed on how parameters are captured.
+#### Usare i pattern Lua
+[I pattern Lua](https://www.lua.org/pil/20.2.html) sono un modo per estrapolare pezzi di testo seguendo delle regole.
+Sono perfetti in caso di argomenti che contengono spazi, o comunque quando è richiesto un controllo più meticoloso dei parametri catturati.
```lua
local a, msg = string.match(param, "^([%a%d_-]+) (*+)$")
@@ -161,7 +166,7 @@ minetest.register_on_chat_message(function(name, message)
end)
```
-Ritornando false, si permette al messaggio di essere inviato.
+Ritornando `false`, si permette al messaggio di essere inviato.
In verità `return false` può anche essere omesso in quanto `nil` verrebbe ritornato implicitamente, e nil è trattato come false.
{% include notice.html notice=page.cb_cmdsprivs %}
diff --git a/_it/quality/translations.md b/_it/quality/translations.md
index 37e63ad..7bdf825 100644
--- a/_it/quality/translations.md
+++ b/_it/quality/translations.md
@@ -1,5 +1,5 @@
---
-title: Translation (i18n / l10n)
+title: Traduzione
layout: default
root: ../..
idx: 8.05
@@ -7,117 +7,92 @@ marked_text_encoding:
level: info
title: Marked Text Encoding
message: |
- You don't need to know the exact format of marked text, but it might help
- you understand.
+ Non hai davvero bisogno di capire come funziona il testo formattato, ma potrebbe aiutarti a capire meglio.
```
- "\27(T@mymod)Hello everyone!\27E"
+ "\27(T@miamod)Hello everyone!\27E"
```
- * `\27` is the escape character - it's used to tell Minetest to pay attention as
- something special is coming up. This is used for both translations and text
- colorisation.
- * `(T@mymod)` says that the following text is translatable using the `mymod`
- textdomain.
- * `Hello everyone!` is the translatable text in English, as passed to the
- translator function.
- * `\27E` is the escape character again and `E`, used to signal that the end has
- been reached.
+ * `\27` è il carattere di escape - è usato per dire a Minetest di far attenzione, in quanto sta per seguire qualcosa di speciale. È usato sia per le traduzioni che per la colorazione del testo.
+ * `(T@miamod)` dice che il testo a seguire è traducibile usando il dominio testuale di `miamod`.
+ * `Hello everyone!` è il testo in inglese da tradurre, passato alla funzione di traduzione.
+ * `\27E` è di nuovo il carattere di escape, dove `E` è usato per segnalare che si è arrivati alla fine.
---
-## Introduction
+## Introduzione
-Adding support for translation to your mods and games allows more people to
-enjoy them. According to Google Play, 64% of Minetest Android users don't have
-English as their primary language. Minetest doesn't track stats for user
-languages across all platforms, but there's likely to be a high proportion of
-non-English speaking users.
+Aggiungere il supporto per le traduzioni nelle tue mod e giochi dà la possibilità a più persone di gustarsele.
+Stando a Google Play, il 64% dei giocatori di Minetest Android non usano l'inglese come prima lingua.
+Per quanto Minetest non tenga traccia di questo parametro nelle altre piattaforme, vien comunque da sé pensare che una buona parte di giocatrici e giocatori non siano madrelingua inglesi.
-Minetest allows you to translate your mods and games into different languages by
-writing your text in English, and using translation files to map into other
-languages. Translation is done on each player's client, allowing each player to
-see a different language.
+Minetest ti permette di localizzare i tuoi contenuti in tante lingue diverse, chiedendoti il testo base in inglese, seguito da dei file di traduzione che mappano le parole/frasi equivalenti nelle altre lingue. Questo processo di traduzione è fatto a lato client, cosicché ogni giocatore possa vedere il contenuto nella propria lingua (se disponibile).
-- [How does client-side translation work?](#how-does-client-side-translation-work)
- - [Marked text](#marked-text)
- - [Translation files](#translation-files)
-- [Format strings](#format-strings)
-- [Best practices and Common Falsehoods about Translation](#best-practices-and-common-falsehoods-about-translation)
-- [Server-side translations](#server-side-translations)
-- [Conclusion](#conclusion)
+- [Come funziona la traduzione lato client?](#come-funziona-la-traduzione-lato-client)
+ - [Testo formattato](#testo-formattato)
+ - [File di traduzione](#file-di-traduzione)
+- [Formattare una stringa](#formattare-una-stringa)
+- [Buona prassi per una buona traduzione](#buona-prassi-per-una-buona--traduzione)
+- [Traduzioni lato server](#traduzioni-lato-server)
+- [Per concludere](#per-concludere)
-## How does client-side translation work?
+## Come funziona la traduzione lato client?
-### Marked text
+### Testo formattato
-The server needs to tell clients how to translate text. This is done by marking
-text as translatable using a translator function (`S()`), returned by
-`minetest.get_translator(textdomain)`:
+Il server ha bisogno di dire ai client come tradurre il testo.
+Questo accade grazie alla funzione `minetest.get_translator(dominiotestuale)`, che abbrevieremo con `S()`:
```lua
-local S = minetest.get_translator("mymod")
+local S = minetest.get_translator("miamod")
-minetest.register_craftitem("mymod:item", {
+minetest.register_craftitem("miamod:oggetto", {
description = S("My Item"),
})
```
-The first argument of `get_translator` is the `textdomain`, which acts as a
-namespace. Rather than having all translations for a language stored in the same
-file, translations are separated into textdomains, with a file per textdomain
-per language. The textdomain should be the same as the mod name, as it helps
-avoid mod conflicts.
+Il primo parametro di `get_translator` è il dominio testuale, che funge da [spazio dei nomi](https://it.wikipedia.org/wiki/Namespace).
+Piuttosto che avere tutte le traduzioni di una lingua salvate nello stesso file, queste possono essere suddivise in domini testuali (un file per dominio per lingua).
+È buona norma assegnare al dominio testuale lo stesso nome della mod, onde evitare conflitti tra mod diverse.
-Marked text can be used in most places where human-readable text is accepted,
-including formspecs, item def fields, infotext, and more. When including marked
-text in formspecs, you need to escape the text using
-`minetest.formspec_escape`.
+Il testo formattato può essere usato nella maggior parte dei casi dove è richiesto un testo fatto per gli esseri umani - come i formspec, i campi di definizioni di un oggetto, `infotext` ecc.
+Nel caso dei formspec, tieni presente che dovrai usare la funzione di escape `minetest.formspec_escape` per una corretta visualizzazione.
-When the client encounters marked text, such as that passed to `description`, it
-looks it up in the player's language's translation file. If a translation cannot
-be found, it falls back to the English translation.
+Quando il client incontra del testo formattato, come quello passato in `description`, ne andrà a cercare il corrispettivo nel file di traduzione della lingua del giocatore. Se la ricerca non avrà avuto esito positivo, ritornerà quello in inglese.
-Marked text contains the English source text, the textdomain, and any additional
-arguments passed to `S()`. It's essentially a text encoding of the `S` call,
-containing all the required information.
+Nel testo formattato sono presenti il testo sorgente in inglese, il dominio testuale, e qualsivoglia altro parametro passato a `S()`.
+Essenzialmente, è una codifica testuale della chiamata a `S` che contiene tutte le informazioni necessarie.
{% include notice.html notice=page.marked_text_encoding %}
-### Translation files
+### File di traduzione
-Translation files are media files that can be found in the `locale` folder for
-each mod. Currently, the only supported format is `.tr`, but support for more
-common formats is likely in the future. Translation files must be named
-in the following way: `[textdomain].[lang].tr`.
+I file di traduzione sono file che possono essere trovati nella cartella `locale` di ogni mod.
+Al momento, l'unico formato supportato è `.tr`, ma è probabile che altri formati più tipici saranno aggiunti in futuro.
+I file di traduzione devono essere nominati nel seguente modo: `[dominiotestuale].[codicelingua].tr`.
-Files in the `.tr` start with a comment specifying the textdomain, and then
-further lines mapping from the English source text to the translation.
+I file `.tr` iniziano con un commento che ne specifica il dominio, seguito poi da righe che mappano il testo originale in inglese nella lingua del file.
-For example, `mymod.fr.tr`:
+Per esempio, `miamod.it.tr`:
```
-# textdomain: mymod
-Hello everyone!=Bonjour à tous !
-I like grapefruit=J'aime le pamplemousse
+# textdomain: miamod
+Hello everyone!=Ciao a tutti!
+I like grapefruit=Mi piace il pompelmo
```
-You should create translation files based on your mod/game's source code,
-using a tool like
-[update_translations](https://github.com/minetest-tools/update_translations).
-This tool will look for `S(` in your Lua code, and automatically create a
-template that translators can use to translate into their language.
-It also handles updating the translation files when your source changes.
+Dovresti creare dei file di traduzione basati sul codice sorgente delle tue mod/giochi, usando uno strumento come [update_translations](https://github.com/minetest-tools/update_translations).
+Questo cercherà tutte le occorrenze di `S(` nel tuo codice Lua, creando in automatico un modello che traduttrici e traduttori potranno usare per tradurre nella loro lingua.
+Inoltre, si prenderà cura di aggiornare i file di traduzione ogniqualvolta verranno effettuate modifiche al codice.
-## Format strings
+## Formattare una stringa
-It's common to need to include variable information within a translation
-string. It's important that text isn't just concatenated, as that prevents
-translators from changing the order of variables within a sentence. Instead,
-you should use the translation system's format/arguments system:
+Non è raro dover inserire una variabile dentro una stringa da tradurre.
+È importante che il testo non sia semplicemente concatenato, in quanto impedirebbe a chi traduce di cambiare l'ordine delle variabili all'interno della frase.
+Al contrario, dovresti usare il seguente sistema di formattazione:
```lua
minetest.register_on_joinplayer(function(player)
@@ -125,39 +100,29 @@ minetest.register_on_joinplayer(function(player)
end)
```
-If you want to include a literal `@` in your translation, you'll need to escape
-by writing `@@`.
+Se vuoi scrivere letteralmente `@` nella tua frase, dovrai usare una sequenza di escape scrivendo `@@`.
-You should avoid concatenation *within* a sentence, but it's recommended that
-you join multiple sentences using concatenation. This helps translators by
-keeping strings smaller.
+Dovresti evitare di concatenare stringhe *all'interno* di una frase; piuttosto, sarebbe meglio concatenare più frasi come da esempio, in quanto permette a chi traduce di lavorare su stringhe più piccole:
```lua
S("Hello @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
```
-## Best practices and Common Falsehoods about Translation
+## Buona prassi per una buona traduzione
-* Avoid concatenating text and use format arguments instead. This gives
- translators full control over changing the order of things.
-* Create translation files automatically, using
- [update_translations](https://github.com/minetest-tools/update_translations).
-* It's common for variables to change the surrounding text, for example, with
- gender and pluralisation. This is often hard to deal with, so is
- frequently glossed over or worked around with gender neutral phrasings.
-* Translations may be much longer or much smaller than the English text. Make
- sure to leave plenty of space.
-* Other languages may write numbers in a different way, for example, with commas
- as decimal points. `1.000,23`, `1'000'000,32`
-* Don't assume that other languages use capitalisation in the same way.
+* Evita di concatenare il testo, optando invece per formattare le stringhe. Questo permette a chi traduce di avere pieno controllo sull'ordine degli elementi;
+* Crea i file di traduzione in automatico usando [update_translations](https://github.com/minetest-tools/update_translations);
+* È cosa comune che le variabili cambino il testo circostante, per esempio tramite genere e numero. Risulta spesso difficile trovare qualcosa che si sposi bene in tutti i casi, perciò si tende a cambiare la struttura della frase in modo che risulti sempre corretta ("Hai ottenuto 3 mele" -> "Hai ottenuto mela (x3)");
+* Le traduzioni potrebbero essere molto più lunghe o molto più corte rispetto all'originale. Assicurati di lasciare sempre un po' di respiro;
+* Non tutte le lingue scrivono i numeri nella stessa maniera, come per esempio `1.000` e `1'000`;
+* Non dar per scontato che le altre lingue usino le maiscuole nella stessa maniera della tua.
-## Server-side translations
+## Traduzioni lato server
-Sometimes you need to know the translation of text on the server, for example,
-to sort or search text. You can use `get_player_information` to get a player's
-lang,uage and `get_translated_string` to translate marked text.
+Certe volte ti capiterà di voler sapere quale traduzione di una tal stringa stia venendo visualizzata dal giocatore.
+Puoi usare `get_player_information` per ottenere la lingua utilizzata e `get_translated_string` per tradurne il testo formattato.
```lua
local list = {
@@ -168,24 +133,21 @@ local list = {
minetest.register_chatcommand("find", {
func = function(name, param)
local info = minetest.get_player_information(name)
- local language = info and info.language or "en"
+ local lingua = info and info.language or "en"
- for _, line in ipairs(list) do
- local trans = minetest.get_translated_string(language, line)
- if trans:contains(query) then
- return line
+ for _, riga in ipairs(lista) do
+ local trad = minetest.get_translated_string(language, riga)
+ if trad:contains(query) then
+ return riga
end
end
end,
})
```
-## Conclusion
+## Per concludere
-The translation API allows making mods and games more accessible, but care is
-needed in order to use it correctly.
+Se ben gestita, l'API per le traduzioni permette di rendere mod e giochi più accessibili.
-Minetest is continuously improving, and the translation API is likey to be
-extended in the future. For example, support for gettext translation files will
-allow common translator tools and platforms (like weblate) to be used, and
-there's likely to be support for pluralisation and gender added.
+Si tenga comunque conto che Minetest è in continua evoluzione e che l'API verrà probabilmente ampliata in futuro.
+Per esempio, il supporto per i file di traduzione *gettext* permetterà l'utilizzo di piattaforme e strumenti consolidati come Weblate, mentre nel frattempo si sta lavorando al supporto per il genere e il numero.
From b5c530c99e4cd8f14fb89e202eac02da4bb3b57e Mon Sep 17 00:00:00 2001
From: Zughy <4279489-marco_a@users.noreply.gitlab.com>
Date: Sun, 19 Jun 2022 22:29:35 +0000
Subject: [PATCH 18/40] IT | small fixes
---
_it/map/objects.md | 2 +-
_it/players/player_physics.md | 2 +-
_it/quality/translations.md | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/_it/map/objects.md b/_it/map/objects.md
index d9ea231..767682b 100644
--- a/_it/map/objects.md
+++ b/_it/map/objects.md
@@ -1,5 +1,5 @@
---
-title: Oggetti, giocatori e entità
+title: Oggetti, giocatori ed entità
layout: default
root: ../..
idx: 3.4
diff --git a/_it/players/player_physics.md b/_it/players/player_physics.md
index 22aa9b4..a59d3df 100644
--- a/_it/players/player_physics.md
+++ b/_it/players/player_physics.md
@@ -61,4 +61,4 @@ Quando si imposta una sovrascrittura, sovrascriverà qualsiasi altro suo simile
* **Sonic**: Imposta il moltiplicatore di velocità a un valore elevato (almeno 6) quando un giocatore entra in gioco;
* **Super rimbalzo**: Aumenta il valore del salto in modo che il giocatore possa saltare 20 metri (1 cubo = 1 metro);
-* **Space**: Fai in modo che la gravità diminuisca man mano che si sale di altitudine.
+* **Spazio**: Fai in modo che la gravità diminuisca man mano che si sale di altitudine.
diff --git a/_it/quality/translations.md b/_it/quality/translations.md
index 7bdf825..657a2e4 100644
--- a/_it/quality/translations.md
+++ b/_it/quality/translations.md
@@ -32,7 +32,7 @@ Minetest ti permette di localizzare i tuoi contenuti in tante lingue diverse, ch
- [Testo formattato](#testo-formattato)
- [File di traduzione](#file-di-traduzione)
- [Formattare una stringa](#formattare-una-stringa)
-- [Buona prassi per una buona traduzione](#buona-prassi-per-una-buona--traduzione)
+- [Buona prassi per una buona traduzione](#buona-prassi-per-una-buona-traduzione)
- [Traduzioni lato server](#traduzioni-lato-server)
- [Per concludere](#per-concludere)
From 8a021d8b39818487ddb44d57b44f109bb51a1fa0 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Mon, 4 Jul 2022 17:46:40 +0100
Subject: [PATCH 19/40] Translations: Fix typos and improve wording
---
_en/quality/translations.md | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/_en/quality/translations.md b/_en/quality/translations.md
index 37e63ad..ab183ea 100644
--- a/_en/quality/translations.md
+++ b/_en/quality/translations.md
@@ -40,7 +40,7 @@ see a different language.
- [How does client-side translation work?](#how-does-client-side-translation-work)
- - [Marked text](#marked-text)
+ - [Marked up text](#marked-up-text)
- [Translation files](#translation-files)
- [Format strings](#format-strings)
- [Best practices and Common Falsehoods about Translation](#best-practices-and-common-falsehoods-about-translation)
@@ -50,10 +50,13 @@ see a different language.
## How does client-side translation work?
-### Marked text
+### Marked up text
-The server needs to tell clients how to translate text. This is done by marking
-text as translatable using a translator function (`S()`), returned by
+The server needs to tell clients how to translate text. This is done by placing
+control characters in text, telling Minetest where and how to translate
+text. This is referred to as marked up text, and will be discussed more later.
+
+To mark text as translatable, use a translator function (`S()`), obtained using
`minetest.get_translator(textdomain)`:
```lua
@@ -70,18 +73,19 @@ file, translations are separated into textdomains, with a file per textdomain
per language. The textdomain should be the same as the mod name, as it helps
avoid mod conflicts.
-Marked text can be used in most places where human-readable text is accepted,
+Marked up text can be used in most places where human-readable text is accepted,
including formspecs, item def fields, infotext, and more. When including marked
-text in formspecs, you need to escape the text using
-`minetest.formspec_escape`.
+text in formspecs, you need to escape the text using `minetest.formspec_escape`.
-When the client encounters marked text, such as that passed to `description`, it
-looks it up in the player's language's translation file. If a translation cannot
-be found, it falls back to the English translation.
+When the client encounters translatable text, such as that passed to
+`description`, it looks it up in the player's language's translation file. If a
+translation cannot be found, it falls back to the English translation.
-Marked text contains the English source text, the textdomain, and any additional
-arguments passed to `S()`. It's essentially a text encoding of the `S` call,
-containing all the required information.
+Translatable marked up text contains the English source text, the textdomain,
+and any additional arguments passed to `S()`. It's essentially a text encoding
+of the `S` call, containing all the required information.
+
+Another type of marked up text is that returned by `minetest.colorize`.
{% include notice.html notice=page.marked_text_encoding %}
@@ -111,6 +115,9 @@ This tool will look for `S(` in your Lua code, and automatically create a
template that translators can use to translate into their language.
It also handles updating the translation files when your source changes.
+You should always put literal text (`"`) inside S rather than using a variable,
+as it helps tools find translations.
+
## Format strings
@@ -157,7 +164,7 @@ S("Hello @1!", player_name) .. " " .. S("You have @1 new messages.", #msgs)
Sometimes you need to know the translation of text on the server, for example,
to sort or search text. You can use `get_player_information` to get a player's
-lang,uage and `get_translated_string` to translate marked text.
+language and `get_translated_string` to translate marked text.
```lua
local list = {
@@ -185,7 +192,7 @@ minetest.register_chatcommand("find", {
The translation API allows making mods and games more accessible, but care is
needed in order to use it correctly.
-Minetest is continuously improving, and the translation API is likey to be
+Minetest is continuously improving, and the translation API is likely to be
extended in the future. For example, support for gettext translation files will
allow common translator tools and platforms (like weblate) to be used, and
there's likely to be support for pluralisation and gender added.
From e4bb144c7d4e7211525aaf11b56edd8f78940e00 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Tue, 12 Jul 2022 20:16:18 +0100
Subject: [PATCH 20/40] Remove mentions of Atom editor
---
_en/basics/lua.md | 1 -
_en/quality/luacheck.md | 1 -
_it/quality/luacheck.md | 1 -
3 files changed, 3 deletions(-)
diff --git a/_en/basics/lua.md b/_en/basics/lua.md
index 47bf68d..52bc164 100644
--- a/_en/basics/lua.md
+++ b/_en/basics/lua.md
@@ -78,7 +78,6 @@ Commonly used editors which are well-suited for Lua include:
open source (as Code-OSS or VSCodium), popular, and has
[plugins for Minetest modding](https://marketplace.visualstudio.com/items?itemName=GreenXenith.minetest-tools).
* [Notepad++](http://notepad-plus-plus.org/) - Windows-only
-* [Atom](http://atom.io/)
Other suitable editors are also available.
diff --git a/_en/quality/luacheck.md b/_en/quality/luacheck.md
index 855d117..963196f 100644
--- a/_en/quality/luacheck.md
+++ b/_en/quality/luacheck.md
@@ -101,7 +101,6 @@ It is highly recommended that you find and install a plugin for your editor of c
to show you errors without running a command. Most editors will likely have a plugin
available.
-* **Atom** - `linter-luacheck`.
* **VSCode** - Ctrl+P, then paste: `ext install dwenegar.vscode-luacheck`
* **Sublime** - Install using package-control:
[SublimeLinter](https://github.com/SublimeLinter/SublimeLinter),
diff --git a/_it/quality/luacheck.md b/_it/quality/luacheck.md
index 1c91704..931b0db 100644
--- a/_it/quality/luacheck.md
+++ b/_it/quality/luacheck.md
@@ -95,7 +95,6 @@ Dài un occhio alla lista sottostante.
È caldamente consigliato installare un'estensione per il tuo editor di fiducia che ti mostri gli errori senza eseguire alcun comando.
Queste sono disponibili nella maggior parte degli editor, come:
-* **Atom** - `linter-luacheck`;
* **VSCode** - Ctrl+P, poi incolla: `ext install dwenegar.vscode-luacheck`;
* **Sublime** - Installala usando package-control:
[SublimeLinter](https://github.com/SublimeLinter/SublimeLinter),
From e88b8925510b9bb99a0436283161dc7b4e23ea45 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sun, 31 Jul 2022 17:20:24 +0100
Subject: [PATCH 21/40] Getting Started: Improve chapter
---
_en/basics/getting_started.md | 145 +++++++++++++++++-----------------
1 file changed, 71 insertions(+), 74 deletions(-)
diff --git a/_en/basics/getting_started.md b/_en/basics/getting_started.md
index aa814a7..73ddd31 100644
--- a/_en/basics/getting_started.md
+++ b/_en/basics/getting_started.md
@@ -12,18 +12,18 @@ redirect_from:
## Introduction
Understanding the basic structure of a mod's folder is an essential skill when
-creating mods.
+creating mods. In this chapter, you'll learn about how modding in Minetest works
+and create your first mod.
- [What are Games and Mods?](#what-are-games-and-mods)
- [Where are mods stored?](#where-are-mods-stored)
-- [Mod Directory](#mod-directory)
-- [mod.conf](#modconf)
- - [Dependencies](#dependencies)
+- [Creating your first mod](#creating-your-first-mod)
+ - [Mod directory](#mod-directory)
+ - [mod.conf](#modconf)
+ - [init.lua](#initlua)
+ - [Summary](#summary)
+- [Dependencies](#dependencies)
- [Mod Packs](#mod-packs)
-- [Example](#example)
- - [Mod Folder](#mod-folder)
- - [init.lua](#initlua)
- - [mod.conf](#modconf-1)
## What are Games and Mods?
@@ -53,7 +53,7 @@ and is applicable for both game developers and modders.
Each mod has its own directory where its Lua code, textures, models, and
-sounds are placed. Minetest checks in a number of different locations for
+sounds are placed. Minetest checks in several different locations for
mods. These locations are commonly called *mod load paths*.
For a given world/save game, three mod locations are checked.
@@ -78,54 +78,91 @@ mod will be loaded in place of the earlier mod. This means that you can override
game mods by placing a mod with the same name in the global mod location.
-## Mod Directory
+## Creating your first mod
-![Find the mod's directory]({{ page.root }}/static/folder_modfolder.jpg)
+### Mod directory
-A *mod name* is used to refer to a mod. Each mod should have a unique name.
-Mod names can include letters, numbers, and underscores. A good name should
-describe what the mod does, and the directory which contains the components of a mod
-must have the same name as the mod name.
-To find out if a mod name is available, try searching for it on
+Go to the global mods directory (About > Open user data directory > mods) and
+create a new folder called "mymod". `mymod` is the mod name.
+
+Each mod should have a unique *mod name*, a technical identifier (id) used to
+refer to the mod. Mod names can include letters, numbers, and underscores. A
+good name should describe what the mod does, and the directory that contains
+the components of a mod must have the same name as the mod name. To find out if
+a mod name is available, try searching for it on
[content.minetest.net](https://content.minetest.net).
mymod
- ├── init.lua (required) - Runs when the game loads.
- ├── mod.conf (recommended) - Contains description and dependencies.
- ├── textures (optional)
- │ └── ... any textures or images
- ├── sounds (optional)
- │ └── ... any sounds
- └── ... any other files or directories
+ ├── textures
+ │ └── mymod_node.png files
+ ├── init.lua
+ └── mod.conf
-Only the init.lua file is required in a mod for it to run on game load;
+Mods only require an init.lua file;
however, mod.conf is recommended and other components may be needed
depending on the mod's functionality.
-## mod.conf
+### mod.conf
+
+Create a mod.conf file with the following content:
+
+```
+name = mymod
+description = Adds foo, bar, and bo.
+depends = default
+```
This file is used for mod metadata including the mod's name, description, and other
information.
-For example:
+### init.lua
- name = mymod
- description = Adds foo, bar, and bo.
- depends = modone, modtwo
+Create an init.lua file with the following content:
-### Dependencies
+```lua
+print("This file will be run at load time!")
+
+minetest.register_node("mymod:node", {
+ description = "This is a node",
+ tiles = {"mymod_node.png"},
+ groups = {cracky = 1}
+})
+
+minetest.register_craft({
+ type = "shapeless",
+ output = "mymod:node 3",
+ recipe = { "default:dirt", "default:stone" },
+})
+```
+
+The init.lua file is the entrypoint to a mod, and runs when the mod is loaded.
+
+
+### Summary
+
+
+This mod has the name "mymod". It has two text files: init.lua and mod.conf. The
+script prints a message and then registers a node and a craft recipe – these
+will be explained later on. There's a single dependency, the
+[default mod](https://content.minetest.net/metapackages/default/), which is
+usually found in Minetest Game. There is also a texture in textures/ for the
+node.
+
+
+## Dependencies
A dependency occurs when a mod requires another mod to be loaded before itself.
-One mod may require another mod's code, items, or other resources to be available
-for it to use.
+One mod may require another mod's code, items, or other resources to be
+available for it to use.
There are two types of dependencies: hard and optional dependencies.
Both require the mod to be loaded first. If the mod being depended on isn't
available, a hard dependency will cause the mod to fail to load, while an optional
dependency might lead to fewer features being enabled.
-An optional dependency is useful if you want to optionally support another mod; it can
-enable extra content if the user wishes to use both the mods at the same time.
+An optional dependency is useful if you want to optionally support another mod;
+it can enable extra content if the user wishes to use both the mods at the same
+time.
Dependencies are specified in a comma-separated list in mod.conf.
@@ -148,43 +185,3 @@ a player, but don't want to make them download each one individually.
Please note that a modpack is not a *game*.
Games have their own organisational structure which will be explained in the
Games chapter.
-
-## Example
-
-Here is an example which puts all of this together:
-
-### Mod Folder
- mymod
- ├── textures
- │ └── mymod_node.png files
- ├── init.lua
- └── mod.conf
-
-### init.lua
-```lua
-print("This file will be run at load time!")
-
-minetest.register_node("mymod:node", {
- description = "This is a node",
- tiles = {"mymod_node.png"},
- groups = {cracky = 1}
-})
-
-minetest.register_craft({
- type = "shapeless",
- output = "mymod:node 3",
- recipe = { "default:dirt", "default:stone" },
-})
-```
-
-### mod.conf
- name = mymod
- descriptions = Adds a node
- depends = default
-
-This mod has the name "mymod". It has two text files: init.lua and mod.conf. The
-script prints a message and then registers a node and craft recipe – these will
-be explained later on. There's a single dependency, the
-[default mod](https://content.minetest.net/metapackages/default/),
-which is usually found in Minetest Game. There is also a texture in textures/
-for the node.
From b5fcac7ed53d14bf3bbf8e6ef9795ef4de0ed6db Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sun, 31 Jul 2022 17:39:25 +0100
Subject: [PATCH 22/40] Lua Scripting: Update chapter
---
_en/basics/lua.md | 64 +++++++++++++++++++++++++----------------------
1 file changed, 34 insertions(+), 30 deletions(-)
diff --git a/_en/basics/lua.md b/_en/basics/lua.md
index 52bc164..71f17c4 100644
--- a/_en/basics/lua.md
+++ b/_en/basics/lua.md
@@ -9,8 +9,8 @@ redirect_from: /en/chapters/lua.html
## Introduction
-In this chapter we'll talk about scripting in Lua, the tools required
-to assist with this, and some techniques which you may find useful.
+In this chapter, you'll learn about scripting in Lua, the tools required
+to help with this, and some techniques that you may find useful.
- [Programming](#programming)
- [Coding in Lua](#coding-in-lua)
@@ -24,23 +24,21 @@ to assist with this, and some techniques which you may find useful.
Programming is the action of taking a problem, such as sorting a list
of items, and turning it into steps that a computer can understand.
-
Teaching you the logical process of programming is beyond the scope of this book;
however, the following websites are quite useful in developing this:
* [Codecademy](http://www.codecademy.com/) is one of the best resources for
learning to write code. It provides an interactive tutorial experience.
* [Scratch](https://scratch.mit.edu) is a good resource for starting from
- absolute basics, and learning the problem-solving techniques required to program.\\
- Scratch is *designed to teach children* how to program and isn't a serious
- programming language.
+ absolute basics, and learning the problem-solving techniques required to program.
+ It's great for children and teenagers.
* [Programming with Mosh](https://www.youtube.com/user/programmingwithmosh) is
a good YouTube series to learn programming.
### Coding in Lua
It's also beyond the scope of this book to teach Lua coding.
-The [Programming in Lua](https://www.lua.org/pil/contents.html) book is an
+The [Programming in Lua (PiL)](https://www.lua.org/pil/contents.html) book is an
excellent introduction to Lua programming.
@@ -74,10 +72,10 @@ Functions which come with Lua by default, such as `table.insert`, are also highl
Commonly used editors which are well-suited for Lua include:
-* [VSCode](https://code.visualstudio.com/) -
+* [VSCode](https://code.visualstudio.com/):
open source (as Code-OSS or VSCodium), popular, and has
- [plugins for Minetest modding](https://marketplace.visualstudio.com/items?itemName=GreenXenith.minetest-tools).
-* [Notepad++](http://notepad-plus-plus.org/) - Windows-only
+ [plugins for Minetest](https://marketplace.visualstudio.com/items?itemName=GreenXenith.minetest-tools).
+* [Notepad++](http://notepad-plus-plus.org/): simple, Windows-only
Other suitable editors are also available.
@@ -85,8 +83,25 @@ Other suitable editors are also available.
## Local and Global Scope
Whether a variable is local or global determines where it can be written to or
-read from. A local variable is only accessible from where it is defined. Here
-are some examples:
+read from. Global variables can be accessed from anywhere in the script file,
+and from any other mod:
+
+```lua
+function one()
+ foo = "bar"
+end
+
+function two()
+ print(dump(foo)) -- Output: "bar"
+end
+
+one()
+two()
+```
+
+In constrast, a local variable is only accessible from where it is defined.
+Lua defaults to variables being global, so you need to explicitly use the
+`local` keyword:
```lua
-- Accessible from within this script file
@@ -103,22 +118,6 @@ function myfunc()
end
```
-In contrast, global variables can be accessed from anywhere in the script file, and
-from any other mod.
-
-```lua
-function one()
- foo = "bar"
-end
-
-function two()
- print(dump(foo)) -- Output: "bar"
-end
-
-one()
-two()
-```
-
### Locals should be used as much as possible
@@ -170,6 +169,9 @@ end
mymod.foo("foobar")
```
+`function mymod.foo()` is equivalent to `mymod.foo = function()`, it's just a
+nicer way to write it.
+
## Including other Lua Scripts
The recommended way to include other Lua scripts in a mod is to use *dofile*.
@@ -182,11 +184,13 @@ A script can return a value, which is useful for sharing private locals:
```lua
-- script.lua
-return "Hello world!"
+local module = {}
+module.message = "Hello World!"
+return module
-- init.lua
local ret = dofile(minetest.get_modpath("modname") .. "/script.lua")
-print(ret) -- Hello world!
+print(ret.message) -- Hello world!
```
[Later chapters](../quality/clean_arch.html) will discuss how best to split up
From bc8820c4b61ab37c11d1483a28afe2ae477784e6 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sun, 31 Jul 2022 17:57:55 +0100
Subject: [PATCH 23/40] Inventories: Update chapter
#104
---
_en/items/inventories.md | 82 ++++++++++++++++++++++------------------
1 file changed, 46 insertions(+), 36 deletions(-)
diff --git a/_en/items/inventories.md b/_en/items/inventories.md
index 198c58e..9c81187 100644
--- a/_en/items/inventories.md
+++ b/_en/items/inventories.md
@@ -19,6 +19,9 @@ that be a player inventory, a node inventory, or a detached inventory.
- [What are ItemStacks and Inventories?](#what-are-itemstacks-and-inventories)
- [ItemStacks](#itemstacks)
- [Inventory Locations](#inventory-locations)
+ - [Node Inventories](#node-inventories)
+ - [Player Inventories](#player-inventories)
+ - [Detached Inventories](#detached-inventories)
- [Lists](#lists)
- [Size and Width](#size-and-width)
- [Checking Contents](#checking-contents)
@@ -33,21 +36,21 @@ that be a player inventory, a node inventory, or a detached inventory.
An ItemStack is the data behind a single cell in an inventory.
-An *inventory* is a collection of *inventory lists*, each of which
-is a 2D grid of ItemStacks.
-Inventory lists are simply called *lists* in the context
-of inventories.
-The point of an inventory is to allow multiple grids when Players
-and Nodes only have at most one inventory in them.
+An *inventory* is a collection of *inventory lists*, each of which is a 2D grid
+of ItemStacks. Inventory lists are referred to as *lists* in the context of
+inventories.
+
+Players and nodes only have a single inventory; lists enable you to have
+multiple grids within that inventory. By default, the player has the "main" list
+for the bulk of its inventory and a few lists for the crafting system.
## ItemStacks
-ItemStacks have four components to them: name, count, wear and metadata.
+ItemStacks have four components to them: `name`, `count`, `wear`, and metadata.
The item name may be the item name of a registered item, an alias, or an unknown
-item name.
-Unknown items are common when users uninstall mods, or when mods remove items without
-precautions, such as registering aliases.
+item name. Unknown items are common when users uninstall mods, or when mods
+remove items without precautions, such as registering aliases.
```lua
print(stack:get_name())
@@ -58,19 +61,14 @@ if not stack:is_known() then
end
```
-The count will always be 0 or greater.
-Through normal gameplay, the count should be no more than the maximum stack size
-of the item - `stack_max`.
-However, admin commands and buggy mods may result in stacks exceeding the maximum
-size.
+The count will always be 0 or greater. Through normal gameplay, the count should
+be no more than the maximum stack size of the item - `stack_max`. However, admin
+commands and buggy mods may result in stacks exceeding the maximum size.
```lua
print(stack:get_stack_max())
```
-
-
-
An ItemStack can be empty, in which case the count will be 0.
```lua
@@ -78,7 +76,7 @@ print(stack:get_count())
stack:set_count(10)
```
-ItemStacks can be constructed in multiple ways using the ItemStack function.
+ItemStacks can be constructed in multiple ways using the ItemStack function:
```lua
ItemStack() -- name="", count=0
@@ -87,24 +85,31 @@ ItemStack("default:stone 30")
ItemStack({ name = "default:wood", count = 10 })
```
-Item metadata is an unlimited key-value store for data about the item.
-Key-value means that you use a name (called the key) to access the data (called the value).
-Some keys have special meaning, such as `description` which is used to have a per-stack
-item description.
-This will be covered in more detail in the Metadata and Storage chapter.
+Item metadata is an unlimited key-value store for data about the item. Key-value
+means that you use a name (called the key) to access the data (called the
+value). Some keys have special meaning, such as `description` which is used to
+have a per-stack item description. This will be covered in more detail in the
+[Storage and Metadata](../map/storage.html) chapter.
## Inventory Locations
-An Inventory Location is where and how the inventory is stored.
-There are three types of inventory location: player, node, and detached.
-An inventory is directly tied to one and only one location - updating the inventory
-will cause it to update immediately.
+An Inventory Location is where and how the inventory is stored. There are three
+types of inventory location: player, node, and detached. An inventory is
+directly tied to one and only one location - updating the inventory will cause
+it to update immediately.
-Node inventories are related to the position of a specific node, such as a chest.
-The node must be loaded because it is stored in [node metadata](../map/storage.html#metadata).
+### Node Inventories
+
+Node inventories are related to the position of a specific node, such as a
+chest. The node must be loaded because it is stored in
+[node metadata](../map/storage.html#metadata).
```lua
-local inv = minetest.get_inventory({ type="node", pos={x=1, y=2, z=3} })
+-- In a node def
+on_punch = function(pos, node)
+ local inv = minetest.get_inventory({ type="node", pos=pos })
+ -- now use the inventory
+end,
```
The above obtains an *inventory reference*, commonly referred to as *InvRef*.
@@ -118,6 +123,8 @@ The location of an inventory reference can be found like so:
local location = inv:get_location()
```
+### Player Inventories
+
Player inventories can be obtained similarly or using a player reference.
The player must be online to access their inventory.
@@ -127,8 +134,10 @@ local inv = minetest.get_inventory({ type="player", name="player1" })
local inv = player:get_inventory()
```
-A detached inventory is one which is independent of players or nodes.
-Detached inventories also don't save over a restart.
+### Detached Inventories
+
+A detached inventory is one that is independent of players or nodes. Detached
+inventories also don't save over a restart.
```lua
local inv = minetest.get_inventory({
@@ -177,9 +186,10 @@ On the contrary, action callbacks - starting with `on_` - don't have a return va
## Lists
-Inventory Lists are a concept used to allow multiple grids to be stored inside a single location.
-This is especially useful for the player as there are a number of common lists
-which all games have, such as the *main* inventory and *craft* slots.
+Inventory Lists are a concept used to allow multiple grids to be stored inside a
+single location. This is especially useful for the player as there are several
+common lists that all games have, such as the *main* inventory and *craft*
+slots.
### Size and Width
From f8c9da8261532f3ce17c3d877fb24109fc1f14b4 Mon Sep 17 00:00:00 2001
From: rubenwardy
Date: Sun, 31 Jul 2022 20:10:04 +0100
Subject: [PATCH 24/40] Item Callbacks: Add chapter
---
_en/items/callbacks.md | 207 ++++++++++++++++++++++++++++++
_en/items/nodes_items_crafting.md | 103 +++++----------
_layouts/base.html | 2 +-
_sass/_table.scss | 17 +++
static/style.scss | 1 +
5 files changed, 258 insertions(+), 72 deletions(-)
create mode 100644 _en/items/callbacks.md
create mode 100644 _sass/_table.scss
diff --git a/_en/items/callbacks.md b/_en/items/callbacks.md
new file mode 100644
index 0000000..44b8fad
--- /dev/null
+++ b/_en/items/callbacks.md
@@ -0,0 +1,207 @@
+---
+title: Node and Item Callbacks
+layout: default
+root: ../..
+idx: 2.15
+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
+---
+
+## Introduction
+
+Minetest heavily uses a callback-based modding design. A callback is a function
+that you give to an API and is called when an event happens. For example, you
+can provide an `on_punch` function in a node definition to be called when a player
+punches a node. There are also global callbacks like
+`minetest.register_on_punchnode` to receive events for all nodes.
+
+- [Item Callbacks](#item-callbacks)
+ - [on_use](#on_use)
+ - [on_place and on_secondary_use](#on_place-and-on_secondary_use)
+ - [on_drop](#on_drop)
+ - [after_use](#after_use)
+- [item_place vs place_item](#item_place-vs-place_item)
+- [Node Callbacks](#node-callbacks)
+ - [Right-clicking and placing a node](#right-clicking-and-placing-a-node)
+ - [Punching and digging](#punching-and-digging)
+ - [...and more!](#and-more)
+
+
+## Item Callbacks
+
+When a player has a node, craftitem, or tool in their inventory, they may trigger
+certain events:
+
+| Callback | Default binding | Default value |
+|------------------|---------------------------|----------------------------------------------|
+| on_use | left-click | nil |
+| on_place | right-click on a node | `minetest.item_place` |
+| on_secondary_use | right-click not on a node | `minetest.item_secondary_use` (does nothing) |
+| on_drop | Q | `minetest.item_drop` |
+| after_use | digging a node | nil |
+
+
+### on_use
+
+Having a use callback prevents the item from being used to dig nodes. One common
+use of the use callback is for food:
+
+```lua
+minetest.register_craftitem("mymod:mudpie", {
+ description = "Alien Mud Pie",
+ inventory_image = "myfood_mudpie.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.
+
+minetest.item_eat() is a function that returns a function, setting it as the
+on_use callback. This means the code above is equivalent to this:
+
+```lua
+minetest.register_craftitem("mymod:mudpie", {
+ description = "Alien Mud Pie",
+ inventory_image = "myfood_mudpie.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 like playing a custom sound.
+
+
+### on_place and on_secondary_use
+
+The difference between `on_place` and `on_secondary_use` is that `on_place` is
+called when the player is pointing at a node and `on_secondary_use` when the
+player isn't.
+
+Both callbacks are called for all types of items. `on_place` defaults to the
+`minetest.item_place` function, which handles calling the `on_rightclick`
+callback of the pointed node or placing the wielded item if it is a node.
+
+
+### on_drop
+
+on_drop is called when the player requests to drop an item, for example using
+the drop key (Q) or dragging it outside of the inventory. It defaults to the
+`minetest.item_drop` function, which will handle dropping the item.
+
+
+### after_use
+
+`after_use` is called when digging a node and allows you to customise how wear
+is applied to a tool. If after_use doesn't exist, then it is the same as:
+
+```lua
+after_use = function(itemstack, user, node, digparams)
+ itemstack:add_wear(digparams.wear)
+ return itemstack
+end
+```
+
+
+## item_place vs place_item
+
+Minetest's API includes many different built-in callback implementations for you
+to use. These callbacks are named with the item type first, for example,
+`minetest.item_place` and `minetest.node_dig`. Some callback implementations are
+used directly whereas some are functions that return the callback:
+
+```lua
+minetest.register_item("mymod:example", {
+ on_place = minetest.item_place,
+ on_use = minetest.item_eat(10),
+})
+```
+
+Minetest's API also includes built-in functions that _do_ something. These are
+often named in a confusingly similar way to built-in callback implementations
+but have the verb first. Examples include `minetest.place_item` and
+`minetest.dig_node` - these functions allow you to dig and place nodes with a
+similar effect to players.
+
+
+## Node Callbacks
+
+When a node is in an inventory, it uses Item Callbacks, as discussed above. When
+a node is placed in the world, it uses Node Callbacks. There are quite a lot of
+node callbacks, too many to discuss in this book. However, quite a few of them
+will be talked about later in the book.
+
+Several of the callbacks are related to node operations such as placing and
+removing from the world. It's important to note that node operation callbacks
+like these aren't called from bulk changes - those that set a large number of
+nodes at once - for performance reasons. Therefore, you can't rely on these
+callbacks to always be called.
+
+
+### Right-clicking and placing a node
+
+When the user right-clicks with an item whilst pointing at a node, the item's
+`on_place` callback is called. By default, this is set to `minetest.item_place`.
+If the pointed node has an `on_rightclick` callback and sneak (shift) is held,
+then the `on_rightclick` callback is called. Otherwise, `minetest.item_place`
+will place the node.
+
+Placing a node will call both `on_construct` and `after_place_node`.
+`on_construct` is called by any node set event that wasn't in bulk and is just
+given the node's position and value .`after_place_node` is only called by node
+place, and so has more information - such as the placer and itemstack.
+
+It's important to note that players aren't the only objects that can place
+nodes; it's common for mobs and mods to place nodes. To account for this,
+`placer` could be a player, entity, or nil.
+
+```lua
+minetest.register_node("mymod:mynode", {
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing),
+ if clicker:is_player() then
+ minetest.chat_send_player(clicker:get_player_name(), "Hello world!")
+ end
+ end,
+ on_construct = function(pos, node)
+ local meta = minetest.get_meta(pos)
+ meta:set_string("infotext", "My node!")
+ end,
+ after_place_node = function(pos, placer, itemstack, pointed_thing)
+ -- Make sure to check placer
+ if placer and placer:is_player() then
+ local meta = minetest.get_meta(pos)
+ meta:set_string("owner", placer:get_player_name())
+ end
+ end,
+})
+```
+
+### Punching and digging
+
+Punching is when the player left-clicks for a short period. If the wielded item
+has an `on_use` callback, this will be called. Otherwise, the `on_punch`
+callback on the pointed node will be called.
+
+When the player attempts to dig a node, the `on_dig` callback on the node will be called.
+This defaults to `minetest.node_dig`, which will check for area protection, wear
+out the tool, remove the node, and run the `after_dig_node` callback.
+
+
+```lua
+minetest.register_node("mymod:mynode", {
+ on_punch = function(pos, node, puncher, pointed_thing)
+ if clicker:is_player() then
+ minetest.chat_send_player(clicker:get_player_name(), "Ow!")
+ end
+ end,
+})
+```
+
+### ...and more!
+
+Check out Minetest's Lua API reference for a list of all node callbacks, and
+more information on the callbacks above.
diff --git a/_en/items/nodes_items_crafting.md b/_en/items/nodes_items_crafting.md
index 1955783..452fc53 100644
--- a/_en/items/nodes_items_crafting.md
+++ b/_en/items/nodes_items_crafting.md
@@ -18,8 +18,6 @@ basic requirements for many mods.
- [Item Aliases](#item-aliases)
- [Textures](#textures)
- [Registering a basic node](#registering-a-basic-node)
-- [Actions and Callbacks](#actions-and-callbacks)
- - [on_use](#onuse)
- [Crafting](#crafting)
- [Shaped](#shaped)
- [Shapeless](#shapeless)
@@ -29,25 +27,24 @@ basic requirements for many mods.
## What are Nodes and Items?
-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.
+Nodes, craftitems, and tools are all Items. An item is something that could be
+found in an inventory - even if it isn't possible through normal gameplay.
-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.
+A node is an item that 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.
A craftitem can't be placed and is only found in inventories or as a dropped item
in the world.
-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.
+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.
## Registering Items
Item definitions consist of an *item name* and a *definition table*.
-The definition table contains attributes which affect the behaviour of the item.
+The definition table contains attributes that affect the behaviour of the item.
```lua
minetest.register_craftitem("modname:itemname", {
@@ -63,25 +60,26 @@ following format:
modname:itemname
-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.
+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.
+
+Both `modname` and `itemname` should only contain lowercase letters, numbers,
+and underscores.
### Item Aliases
-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:
+Items can also have *aliases* pointing to their name. An *alias* is a
+pseudo-item name that 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:
* 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.
* Adding a shortcut. `/giveme dirt` is easier than `/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.
+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.
```lua
minetest.register_alias("dirt", "default:dirt")
@@ -103,14 +101,16 @@ JPEG textures are supported, but they do not support transparency and are genera
bad quality at low resolutions.
It is often better to use the PNG format.
-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.
+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, especially phones, resulting in degraded performance.
## Registering a basic node
+Registering nodes is similar to registering items, just with a different
+function:
+
```lua
minetest.register_node("mymod:diamond", {
description = "Alien Diamond",
@@ -120,6 +120,9 @@ minetest.register_node("mymod:diamond", {
})
```
+Node definitions can contain any property in an item definition, and also
+contain additional properties specific to nodes.
+
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:
@@ -128,7 +131,7 @@ To give a different texture per-side, supply the names of 6 textures in this ord
(+Y, -Y, +X, -X, +Z, -Z)
Remember that +Y is upwards in Minetest, as is the convention with
-3D computer graphics.
+most 3D computer games.
```lua
minetest.register_node("mymod:diamond", {
@@ -152,49 +155,6 @@ 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.
-## Actions and Callbacks
-
-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.
-
-### 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:
-
-```lua
-minetest.register_craftitem("mymod:mudpie", {
- description = "Alien Mud Pie",
- inventory_image = "myfood_mudpie.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.
-
-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:
-
-```lua
-minetest.register_craftitem("mymod:mudpie", {
- description = "Alien Mud Pie",
- inventory_image = "myfood_mudpie.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.
-
## Crafting
There are several types of crafting recipe available, indicated by the `type`
@@ -327,6 +287,7 @@ minetest.register_craft({
})
```
+
## Tools, Capabilities, and Dig Types
Dig types are groups which are used to define how strong a node is when dug
diff --git a/_layouts/base.html b/_layouts/base.html
index 9b78984..2458bad 100644
--- a/_layouts/base.html
+++ b/_layouts/base.html
@@ -34,7 +34,7 @@ layout: compress
{% endfor %}
-
+