Inventories: 0 is used to prevent take, not -1
This commit is contained in:
parent
c455aff265
commit
f1f051c3cb
@ -159,7 +159,7 @@ minetest.create_detached_inventory("inventory_name", {
|
||||
end,
|
||||
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
return -1 -- don't allow taking
|
||||
return 0 -- don't allow taking
|
||||
end,
|
||||
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
@ -171,7 +171,7 @@ minetest.create_detached_inventory("inventory_name", {
|
||||
```
|
||||
|
||||
Permission callbacks - ie: those starting with `allow_` - return the number
|
||||
of items to transfer, with -1 being used to prevent transfer completely.
|
||||
of items to transfer, with 0 being used to prevent transfer completely.
|
||||
|
||||
On the contrary, action callbacks - starting with `on_` - don't have a return value.
|
||||
|
||||
|
@ -140,7 +140,7 @@ minetest.create_detached_inventory("inventory_name", {
|
||||
end,
|
||||
|
||||
allow_take = function(inv, listname, index, stack, player)
|
||||
return -1 -- non permette di rimuoverli
|
||||
return 0 -- non permette di rimuoverli
|
||||
end,
|
||||
|
||||
on_put = function(inv, listname, index, stack, player)
|
||||
@ -151,7 +151,7 @@ minetest.create_detached_inventory("inventory_name", {
|
||||
})
|
||||
```
|
||||
|
||||
I callback dei permessi - quelle che iniziano con `allow_` - ritornano il numero degli oggetti da trasferire, e si usa -1 per impedirne del tutto l'azione.
|
||||
I callback dei permessi - quelle che iniziano con `allow_` - ritornano il numero degli oggetti da trasferire, e si usa 0 per impedirne del tutto l'azione.
|
||||
|
||||
I callback delle azioni - quelle che iniziano con `on_` - non ritornano invece alcun valore.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user