Added protection checks to barrel
parent
b08ee49275
commit
fa00e85343
|
@ -7,3 +7,8 @@ License: WTFPL
|
|||
Depends: Farming Redo
|
||||
|
||||
This mod adds a wine barrel used to ferment grapes into glasses of wine, 9 of which can then be crafted into a bottle of wine.
|
||||
|
||||
Changelog:
|
||||
|
||||
0.1 - Initial release
|
||||
0.2 - Added protection checks to barrel
|
18
init.lua
18
init.lua
|
@ -79,8 +79,22 @@ minetest.register_node("wine:wine_barrel", {
|
|||
return true
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
return stack:get_count()
|
||||
|
||||
end,
|
||||
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
|
||||
|
@ -93,6 +107,10 @@ minetest.register_node("wine:wine_barrel", {
|
|||
|
||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local stack = inv:get_stack(from_list, from_index)
|
||||
|
|
Loading…
Reference in New Issue