From 28abbfc3c6e8c051791e95452bc973e5774f3112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Sun, 28 Jun 2020 00:37:17 +0200 Subject: Forbid digging milkers with buckets in them --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index b5426ab..2661bda 100644 --- a/init.lua +++ b/init.lua @@ -67,8 +67,12 @@ local function on_construct(pos) end local function can_dig(pos) + local node = minetest.get_node(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() + if node.name == "feedlot:milker" then + return inv:is_empty("main") and inv:is_empty("bucket") + end return inv:is_empty("main") end @@ -125,7 +129,7 @@ local function feed_animals (pos, elapsed) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - + local fake_player = feedlotFakePlayer.create(pos, "fake_player") local radius = 3 @@ -149,7 +153,7 @@ local function feed_animals (pos, elapsed) if node.name == "feedlot:milker" and not inv:room_for_item("main", "mobs:bucket_milk") then return false end - obj:get_luaentity():on_rightclick(fake_player) + obj:get_luaentity():on_rightclick(fake_player) end end end -- cgit v1.2.3