-- LUALOCALS < ---------------------------------------------------------
local core, nc
    = core, nc
-- LUALOCALS > ---------------------------------------------------------

local modname = core.get_current_modname()

local rakevol = nc.rake_volume(2, 1)
local raketest = nc.rake_index(function(def)
		return def.groups and def.groups.falling_node
		and def.groups.snappy == 1
	end)

core.register_tool(modname .. ":rake", {
		description = "Wooden Rake",
		inventory_image = modname .. "_rake.png",
		tool_capabilities = nc.toolcaps({
				snappy = 1,
				uses = 10
			}),
		groups = {
			flammable = 1,
			rakey = 1,
			nc_doors_pummel_first = 1
		},
		sounds = nc.sounds("nc_tree_sticky"),
		on_rake = function() return rakevol, raketest end
	})

local adze = {name = modname .. ":adze", wear = 0.05}
nc.register_craft({
		label = "assemble rake",
		indexkeys = {modname .. ":adze"},
		nodes = {
			{match = adze, replace = "air"},
			{y = -1, match = modname .. ":staff", replace = "air"},
			{x = -1, match = adze, replace = "air"},
			{x = 1, match = adze, replace = "air"},
		},
		items = {{
				y = -1,
				name = modname .. ":rake"
		}}
	})
