local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("main")
+ end,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
minetest.log("action", player:get_player_name()..
local inv = meta:get_inventory()
inv:set_size("main", 8*4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ return inv:is_empty("main")
+ end,
on_metadata_inventory_move = function(pos, from_list, from_index,
to_list, to_index, count, player)
local meta = minetest.env:get_meta(pos)
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
})
minetest.register_node("default:furnace_active", {
inv:set_size("src", 1)
inv:set_size("dst", 4)
end,
+ can_dig = function(pos,player)
+ local meta = minetest.env:get_meta(pos);
+ local inv = meta:get_inventory()
+ if not inv:is_empty("fuel") then
+ return false
+ elseif not inv:is_empty("dst") then
+ return false
+ elseif not inv:is_empty("src") then
+ return false
+ end
+ return true
+ end,
})
function hacky_swap_node(pos,name)
return 0;
}
+ // is_empty(self, listname) -> true/false
+ static int l_is_empty(lua_State *L)
+ {
+ InvRef *ref = checkobject(L, 1);
+ const char *listname = luaL_checkstring(L, 2);
+ InventoryList *list = getlist(L, ref, listname);
+ if(list && list->getUsedSlots() > 0){
+ lua_pushboolean(L, false);
+ } else {
+ lua_pushboolean(L, true);
+ }
+ return 1;
+ }
+
// get_size(self, listname)
static int l_get_size(lua_State *L)
{
};
const char InvRef::className[] = "InvRef";
const luaL_reg InvRef::methods[] = {
+ method(InvRef, is_empty),
method(InvRef, get_size),
method(InvRef, set_size),
method(InvRef, get_stack),