-- vessels/init.lua

-- Minetest 0.4 mod: vessels
-- See README.TXT for licensing and other information.





local function update_vessels_shelf(pos)
	local meta = minetest.get_meta(pos)
	

	-- Inventory slots overlay
	
	
	
	
end

local vessels_shelf_def = {
	description = "Vessels Shelf",
	tiles = {"main_planks_oak.png", "main_planks_oak.png", "main_planks_oak.png",
		"main_planks_oak.png", "vessels_shelf.png", "main_planks_oak.png"},
	paramtype2 = "facedir",
	is_ground_content = false,
	groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3},
	--sounds = default.node_sound_wood_defaults(),

	on_construct = function(pos)
		local meta = minetest.get_meta(pos)
		update_vessels_shelf(pos)
		local inv = meta:get_inventory()
		inv:set_size("vessels", 8 * 2)
	end,
	can_dig = function(pos,player)
		local inv = minetest.get_meta(pos):get_inventory()
		return inv:is_empty("vessels")
	end,
	allow_metadata_inventory_put = function(pos, listname, index, stack, player)
		if minetest.get_item_group(stack:get_name(), "vessel") ~= 0 then
			return stack:get_count()
		end
		return 0
	end,
	on_blast = function(pos)
		local drops = {}
		--default.get_inventory_drops(pos, "vessels", drops)
		drops[#drops + 1] = "vessels:shelf"
		minetest.remove_node(pos)
		return drops
	end,
}
--default.set_inventory_action_loggers(vessels_shelf_def, "vessels shelf")
minetest.register_node("vessels:shelf", vessels_shelf_def)


minetest.register_node("vessels:glass_bottle", {
	description = "Empty Glass Bottle",
	drawtype = "plantlike",
	tiles = {"vessels_glass_bottle.png"},
	inventory_image = "vessels_glass_bottle.png",
	wield_image = "vessels_glass_bottle.png",
	paramtype = "light",
	is_ground_content = false,
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
	},
	groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
	--sounds = default.node_sound_glass_defaults(),
})


minetest.register_node("vessels:drinking_glass", {
	description = "Empty Drinking Glass",
	drawtype = "plantlike",
	tiles = {"vessels_drinking_glass.png"},
	inventory_image = "vessels_drinking_glass_inv.png",
	wield_image = "vessels_drinking_glass.png",
	paramtype = "light",
	is_ground_content = false,
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
	},
	groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
	--sounds = default.node_sound_glass_defaults(),
})


minetest.register_node("vessels:steel_bottle", {
	description = "Empty Heavy Steel Bottle",
	drawtype = "plantlike",
	tiles = {"vessels_steel_bottle.png"},
	inventory_image = "vessels_steel_bottle.png",
	wield_image = "vessels_steel_bottle.png",
	paramtype = "light",
	is_ground_content = false,
	walkable = false,
	selection_box = {
		type = "fixed",
		fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
	},
	groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
	--sounds = default.node_sound_defaults(),
})



-- Glass and steel recycling

minetest.register_craftitem("vessels:glass_fragments", {
	description = "Glass Fragments",
	inventory_image = "vessels_glass_fragments.png",
})
