From 98e3e01610071c9b7f0dbfc6a1c55d62d95b699f Mon Sep 17 00:00:00 2001 From: Joshua Date: Thu, 14 Dec 2017 13:41:11 -0500 Subject: Prevent digging with blocks inside --- init.lua | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 7776484..d0da70e 100644 --- a/init.lua +++ b/init.lua @@ -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}, }) -- cgit v1.2.3