Prevent digging with blocks inside

master
Joshua 2017-12-14 13:41:11 -05:00 committed by GitHub
parent 92553776cd
commit 98e3e01610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -22,6 +22,18 @@ minetest.register_node("ehlphabet:machine", {
paramtype = "light",
groups = {cracky=2},
can_dig = function(pos, player) -- "Can you dig it?" -Cyrus
local meta = minetest.env:get_meta(pos)
local inv = meta:get_inventory()
if not inv:is_empty("input") or not inv:is_empty("output") then
if player then
minetest.chat_send_player(player:get_player_name(), "You cannot dig the Letter Machine with blocks inside")
end -- end if player
return false
end -- end if not empty
return true
end, -- end can_dig function
after_place_node = function(pos, placer)
local meta = minetest.env:get_meta(pos)
end,
@ -59,7 +71,7 @@ minetest.register_node("ehlphabet:machine", {
})
minetest.register_node("ehlphabet:block", {
description = "Blank Ehlphabet Block",
description = "Ehlphabet Block (blank)",
tiles = {"ehlphabet_000.png"},
groups = {cracky=3},
})