Privileges - Italian translation added

master
Marco 2020-07-03 16:12:23 +02:00 committed by rubenwardy
parent af9e25f026
commit c0ca655327
1 changed files with 49 additions and 63 deletions

View File

@ -1,30 +1,28 @@
--- ---
title: Privileges title: Privilegi
layout: default layout: default
root: ../.. root: ../..
idx: 4.1 idx: 4.1
description: Registering privs. description: Tu, non puoi, passareee! (Tu invece sì)
redirect_from: /en/chapters/privileges.html redirect_from: /it/chapters/privileges.html
--- ---
## Introduction <!-- omit in toc --> ## Introduzione <!-- omit in toc -->
Privileges, often called privs for short, give players the ability to perform I privilegi (*privileges*, solitamente abbreviati in *privs*), danno ai giocatori l'abilità di eseguire certe azioni.
certain actions. Server owners can grant and revoke privileges to control I proprietari dei server possono assegnare e revocare i privilegi per controllare quali cose un giocatore può o non può fare.
which abilities each player has.
- [When to use Privileges](#when-to-use-privileges) - [Privilegi sì e privilegi no](#privilegi-si-e-privilegi-no)
- [Declaring Privileges](#declaring-privileges) - [Dichiarazione](#dichiarazione)
- [Checking for Privileges](#checking-for-privileges) - [Controlli](#controlli)
- [Getting and Setting Privileges](#getting-and-setting-privileges) - [Ottenere e impostare privilegi](#ottenere-e-impostare-privilegi)
- [Adding Privileges to basic_privs](#adding-privileges-to-basicprivs) - [Aggiungere privilegi a basic_privs](#aggiungere-privilegi-a-basicprivs)
## When to use Privileges ## Privilegi sì e privilegi no
A privilege should give a player the ability to do something. I privilegi non sono fatti per indicare classi o status.
Privileges are **not** for indicating class or status.
**Good Privileges:** **Privilegi corretti:**
* interact * interact
* shout * shout
@ -36,103 +34,91 @@ Privileges are **not** for indicating class or status.
* worldedit * worldedit
* area_admin - admin functions of one mod is ok * area_admin - admin functions of one mod is ok
**Bad Privileges:** **Privilegi sbagliati:**
* moderator * moderatore
* admin * amministratore
* elf * elfo
* dwarf * nano
## Declaring Privileges ## Dichiarazione
Use `register_privilege` to declare a new privilege: Usa `register_privilege` per dichiarare un nuovo privilegio:
```lua ```lua
minetest.register_privilege("vote", { minetest.register_privilege("voto", {
description = "Can vote on issues", description = "Può votare nei sondaggi",
give_to_singleplayer = true give_to_singleplayer = false
}) })
``` ```
`give_to_singleplayer` defaults to true when not specified, so it isn't `give_to_singleplayer` è di base true, quindi non c'è bisogno di specificarlo se non lo si vuole mettere false.
actually needed in the above definition.
## Checking for Privileges ## Controlli
To quickly check whether a player has all the required privileges: Per controllare velocemente se un giocatore ha tutti i privilegi necessari o meno:
```lua ```lua
local has, missing = minetest.check_player_privs(player_or_name, { local celo, manca = minetest.check_player_privs(player_or_name, {
interact = true, interact = true,
vote = true }) voto = true })
``` ```
In this example, `has` is true if the player has all the privileges needed. In quest'esempio, `celo` è true se il giocatore ha sia `interact` che `voto`.
If `has` is false, then `missing` will contain a key-value table Se `celo` è false, allora `manca` conterrà una tabella con i privilegi mancanti.
of the missing privileges.
```lua ```lua
local has, missing = minetest.check_player_privs(name, { local celo, manca = minetest.check_player_privs(name, {
interact = true, interact = true,
vote = true }) voto = true })
if has then if celo then
print("Player has all privs!") print("Il giocatore ha tutti i privilegi!")
else else
print("Player is missing privs: " .. dump(missing)) print("Al giocatore mancano i seguenti privilegi: " .. dump(manca))
end end
``` ```
If you don't need to check the missing privileges, you can put Se non hai bisogno di controllare i privilegi mancanti, puoi inserire `check_player_privs` direttamente nel costrutto if:
`check_player_privs` directly into the if statement.
```lua ```lua
if not minetest.check_player_privs(name, { interact=true }) then if not minetest.check_player_privs(name, { interact=true }) then
return false, "You need interact for this!" return false, "Hai bisogno del privilegio 'interact' per eseguire quest'azione!"
end end
``` ```
## Getting and Setting Privileges ## Ottenere e impostare privilegi
Player privileges can be accessed or modified regardless of the player
being online.
Si può accedere o modificare i privilegi di un giocatore anche se quest'ultimo non risulta online.
```lua ```lua
local privs = minetest.get_player_privs(name) local privs = minetest.get_player_privs(name)
print(dump(privs)) print(dump(privs))
privs.vote = true privs.voto = true
minetest.set_player_privs(name, privs) minetest.set_player_privs(name, privs)
``` ```
Privileges are always specified as a key-value table with the key being I privilegi sono sempre specificati come una tabella chiave-valore, con il loro nome come chiave e true/false come valore.
the privilege name and the value being a boolean.
```lua ```lua
{ {
fly = true, fly = true,
interact = true, interact = true,
shout = true shout = true -- per poter scrivere in chat
} }
``` ```
## Adding Privileges to basic_privs ## Aggiungere privilegi a basic_privs
Players with the `basic_privs` privilege are able to grant and revoke a limited I giocatori con il privilegio `basic_privs` sono in grado di assegnare e revocare un set limitato di privilegi.
set of privileges. It's common to give this privilege to moderators so that È cosa comune assegnarlo ai moderatori in modo che possano mettere o togliere `interact` e `shout` agli altri giocatori, ma che al tempo stesso non possano assegnare privilegi (a loro stessi o ad altri giocatori) con maggiori possibilità di abuso - come `give` e `server`.
they can grant and revoke `interact` and `shout`, but can't grant themselves or other
players privileges with greater potential for abuse such as `give` and `server`.
To add a privilege to `basic_privs`, and adjust which privileges your moderators can Per modificare quali sono i privilegi contenuti in `basic_privs`, va cambiata l'omonima opzione.
grant and revoke from other players, you must change the `basic_privs` setting. Se di base si ha infatti:
By default, `basic_privs` has the following value:
basic_privs = interact, shout basic_privs = interact, shout
To add `vote`, update this to: Per aggiungere `vote`, basta fare:
basic_privs = interact, shout, vote basic_privs = interact, shout, vote
This will allow players with `basic_privs` to grant and revoke the `vote` privilege.