aboutsummaryrefslogtreecommitdiff
path: root/circular_saw.lua
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-03-24 12:08:53 +0100
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2018-03-24 12:08:53 +0100
commit9ccd07171051737c3c258076f683aa0b95d9c886 (patch)
treee12a577f5ef10faa6d16705860b18bee07c6cba4 /circular_saw.lua
parent1947ed03c2e146607dfa3306eb805f532ac3a413 (diff)
downloadmoreblocks-9ccd07171051737c3c258076f683aa0b95d9c886.tar.gz
moreblocks-9ccd07171051737c3c258076f683aa0b95d9c886.tar.bz2
moreblocks-9ccd07171051737c3c258076f683aa0b95d9c886.zip
more stuff from Och_Noe
Diffstat (limited to 'circular_saw.lua')
-rw-r--r--circular_saw.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/circular_saw.lua b/circular_saw.lua
index 6c3a974..b0a6d64 100644
--- a/circular_saw.lua
+++ b/circular_saw.lua
@@ -299,6 +299,20 @@ function circular_saw.on_metadata_inventory_put(
end
end
+function circular_saw.allow_metadata_inventory_take(pos, listname, index, stack, player)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ local input_stack = inv:get_stack(listname, index)
+ local player_inv = player:get_inventory()
+ if not player_inv:room_for_item("main", input_stack) then
+ return 0
+ else return stack:get_count()
+ end
+end
+
+
+
+
function circular_saw.on_metadata_inventory_take(
pos, listname, index, stack, player)
@@ -417,6 +431,7 @@ minetest.register_node("moreblocks:circular_saw", {
allow_metadata_inventory_move = circular_saw.allow_metadata_inventory_move,
-- Only input- and recycle-slot are intended as input slots:
allow_metadata_inventory_put = circular_saw.allow_metadata_inventory_put,
+ allow_metadata_inventory_take = circular_saw.allow_metadata_inventory_take,
-- Taking is allowed from all slots (even the internal microblock slot). Moving is forbidden.
-- Putting something in is slightly more complicated than taking anything because we have to make sure it is of a suitable material:
on_metadata_inventory_put = circular_saw.on_metadata_inventory_put,