summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2015-11-25 10:26:19 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2015-11-25 10:26:19 +0000
commitfa00e85343686027d7aafa63c8e0cd37f4efed57 (patch)
treebe6e1a45ee34363aa362e330b1fa8990a7e518b7
parentb08ee49275f84f626058e9680602f712d0993cfc (diff)
Added protection checks to barrel
-rw-r--r--README.md5
-rw-r--r--init.lua18
2 files changed, 23 insertions, 0 deletions
diff --git a/README.md b/README.md
index 54bb6f3..27b9984 100644
--- a/README.md
+++ b/README.md
@@ -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 \ No newline at end of file
diff --git a/init.lua b/init.lua
index 6666fe5..ac1c97e 100644
--- a/init.lua
+++ b/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)