[mods/default/tools.lua] Hoe now checks that the block above is empty.

This commit is contained in:
Quentin Bazin 2020-07-31 15:26:53 +02:00
parent 9ee3a110d7
commit d65d2117a9

View File

@ -46,7 +46,9 @@ function register_tool(name, material, mining_speed, harvest_capability)
if name == "hoe" then
tool_def.on_item_activated = function(pos, block, player, world, client, server)
if block:string_id() == "default:grass" or block:string_id() == "default:dirt" then
world:set_block_from_str(pos.x, pos.y, pos.z, "default:farmland")
if world:get_block(pos.x, pos.y, pos.z + 1) == 0 then
world:set_block_from_str(pos.x, pos.y, pos.z, "default:farmland")
end
end
end
elseif name == "shovel" then