diff options
author | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-28 00:37:17 +0200 |
---|---|---|
committer | Gabriel Pérez-Cerezo <gabriel@gpcf.eu> | 2020-06-28 00:37:17 +0200 |
commit | 28abbfc3c6e8c051791e95452bc973e5774f3112 (patch) | |
tree | 6d872ed25dd8f4e852f4422bd2fdb5044a1894b6 | |
parent | b8e18e15ac4c67fe8b8305efd4d2ac2965075107 (diff) | |
download | feedlot-28abbfc3c6e8c051791e95452bc973e5774f3112.tar.gz feedlot-28abbfc3c6e8c051791e95452bc973e5774f3112.tar.bz2 feedlot-28abbfc3c6e8c051791e95452bc973e5774f3112.zip |
Forbid digging milkers with buckets in them
-rw-r--r-- | init.lua | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 |