2015-07-03 07:57:09 +03:00
|
|
|
local function create_soil(pos, inv)
|
2015-06-29 20:55:56 +03:00
|
|
|
if pos == nil then
|
|
|
|
return false
|
|
|
|
end
|
2017-01-05 02:28:43 +02:00
|
|
|
local node = minetest.get_node(pos)
|
2015-06-29 20:55:56 +03:00
|
|
|
local name = node.name
|
2017-01-05 02:28:43 +02:00
|
|
|
local above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
2017-01-10 05:01:53 +02:00
|
|
|
if minetest.get_item_group(name, "cultivatable") == 2 then
|
2015-06-29 20:55:56 +03:00
|
|
|
if above.name == "air" then
|
|
|
|
node.name = "farming:soil"
|
2017-01-05 02:28:43 +02:00
|
|
|
minetest.set_node(pos, node)
|
|
|
|
return true
|
|
|
|
end
|
2017-01-10 05:01:53 +02:00
|
|
|
elseif minetest.get_item_group(name, "cultivatable") == 1 then
|
2017-01-05 02:28:43 +02:00
|
|
|
if above.name == "air" then
|
|
|
|
node.name = "default:dirt"
|
|
|
|
minetest.set_node(pos, node)
|
2015-06-29 20:55:56 +03:00
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_tool("farming:hoe_wood", {
|
|
|
|
description = "Wood Hoe",
|
|
|
|
inventory_image = "farming_tool_woodhoe.png",
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2015-07-03 07:57:09 +03:00
|
|
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
2015-06-29 20:55:56 +03:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-01-04 12:05:41 +02:00
|
|
|
itemstack:add_wear(65535/60)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2017-01-17 01:44:37 +02:00
|
|
|
end,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1,
|
|
|
|
damage_groups = { fleshy = 1, }
|
|
|
|
},
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_wood",
|
|
|
|
recipe = {
|
2017-01-05 05:39:36 +02:00
|
|
|
{"group:wood", "group:wood"},
|
2015-06-29 20:55:56 +03:00
|
|
|
{"", "default:stick"},
|
|
|
|
{"", "default:stick"}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 02:59:21 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_wood",
|
|
|
|
recipe = {
|
|
|
|
{"group:wood", "group:wood"},
|
|
|
|
{"default:stick", ""},
|
|
|
|
{"default:stick", ""}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 07:43:07 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "farming:hoe_wood",
|
|
|
|
burntime = 10,
|
|
|
|
})
|
2015-06-29 20:55:56 +03:00
|
|
|
|
|
|
|
minetest.register_tool("farming:hoe_stone", {
|
|
|
|
description = "Stone Hoe",
|
|
|
|
inventory_image = "farming_tool_stonehoe.png",
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2015-07-03 07:57:09 +03:00
|
|
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
2015-06-29 20:55:56 +03:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-01-04 12:05:41 +02:00
|
|
|
itemstack:add_wear(65535/132)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2017-01-17 01:44:37 +02:00
|
|
|
end,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.5,
|
|
|
|
damage_groups = { fleshy = 1, }
|
|
|
|
},
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_stone",
|
|
|
|
recipe = {
|
|
|
|
{"default:cobble", "default:cobble"},
|
|
|
|
{"", "default:stick"},
|
|
|
|
{"", "default:stick"}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 02:59:21 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_stone",
|
|
|
|
recipe = {
|
|
|
|
{"default:cobble", "default:cobble"},
|
|
|
|
{"default:stick", ""},
|
|
|
|
{"default:stick", ""}
|
|
|
|
}
|
|
|
|
})
|
2015-06-29 20:55:56 +03:00
|
|
|
|
|
|
|
minetest.register_tool("farming:hoe_steel", {
|
2017-01-04 06:29:55 +02:00
|
|
|
description = "Iron Hoe",
|
2015-06-29 20:55:56 +03:00
|
|
|
inventory_image = "farming_tool_steelhoe.png",
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2015-07-03 07:57:09 +03:00
|
|
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
2015-06-29 20:55:56 +03:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-01-04 12:05:41 +02:00
|
|
|
itemstack:add_wear(65535/251)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2017-01-17 01:44:37 +02:00
|
|
|
end,
|
|
|
|
tool_capabilities = {
|
|
|
|
-- 1/3
|
|
|
|
full_punch_interval = 0.33333333,
|
|
|
|
damage_groups = { fleshy = 1, }
|
|
|
|
},
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_steel",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "default:steel_ingot"},
|
|
|
|
{"", "default:stick"},
|
|
|
|
{"", "default:stick"}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 02:59:21 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_steel",
|
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "default:steel_ingot"},
|
|
|
|
{"default:stick", ""},
|
|
|
|
{"default:stick", ""}
|
|
|
|
}
|
|
|
|
})
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2017-01-04 11:56:38 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
output = "default:iron_nugget",
|
|
|
|
recipe = "farming:hoe_steel",
|
2017-01-04 12:49:05 +02:00
|
|
|
cooktime = 10,
|
2017-01-04 11:56:38 +02:00
|
|
|
})
|
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
minetest.register_tool("farming:hoe_gold", {
|
2017-01-04 12:05:41 +02:00
|
|
|
description = "Golden Hoe",
|
2015-06-29 20:55:56 +03:00
|
|
|
inventory_image = "farming_tool_goldhoe.png",
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2015-07-03 07:57:09 +03:00
|
|
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
2015-06-29 20:55:56 +03:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-01-04 12:05:41 +02:00
|
|
|
itemstack:add_wear(65535/33)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2017-01-17 01:44:37 +02:00
|
|
|
end,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1,
|
|
|
|
damage_groups = { fleshy = 1, }
|
|
|
|
},
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_gold",
|
|
|
|
recipe = {
|
|
|
|
{"default:gold_ingot", "default:gold_ingot"},
|
|
|
|
{"", "default:stick"},
|
|
|
|
{"", "default:stick"}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 02:59:21 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_gold",
|
|
|
|
recipe = {
|
|
|
|
{"default:gold_ingot", "default:gold_ingot"},
|
|
|
|
{"default:stick", ""},
|
|
|
|
{"default:stick", ""}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
|
2017-01-04 11:56:38 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
type = "cooking",
|
|
|
|
output = "default:gold_nugget",
|
|
|
|
recipe = "farming:hoe_gold",
|
2017-01-04 12:49:05 +02:00
|
|
|
cooktime = 10,
|
2017-01-04 11:56:38 +02:00
|
|
|
})
|
|
|
|
|
2015-06-29 20:55:56 +03:00
|
|
|
minetest.register_tool("farming:hoe_diamond", {
|
|
|
|
description = "Diamond Hoe",
|
|
|
|
inventory_image = "farming_tool_diamondhoe.png",
|
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2015-07-03 07:57:09 +03:00
|
|
|
if create_soil(pointed_thing.under, user:get_inventory()) then
|
2015-06-29 20:55:56 +03:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-01-04 12:05:41 +02:00
|
|
|
itemstack:add_wear(65535/1562)
|
2015-06-29 20:55:56 +03:00
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
2017-01-17 01:44:37 +02:00
|
|
|
end,
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.25,
|
|
|
|
damage_groups = { fleshy = 1, }
|
|
|
|
},
|
2015-06-29 20:55:56 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_diamond",
|
|
|
|
recipe = {
|
|
|
|
{"default:diamond", "default:diamond"},
|
|
|
|
{"", "default:stick"},
|
|
|
|
{"", "default:stick"}
|
|
|
|
}
|
|
|
|
})
|
2017-01-10 02:59:21 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "farming:hoe_diamond",
|
|
|
|
recipe = {
|
|
|
|
{"default:diamond", "default:diamond"},
|
|
|
|
{"default:stick", ""},
|
|
|
|
{"default:stick", ""}
|
|
|
|
}
|
|
|
|
})
|