diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua index 398e6f3..e64c467 100644 --- a/mods/default/crafting.lua +++ b/mods/default/crafting.lua @@ -165,6 +165,15 @@ minetest.register_craft( } }) +minetest.register_craft( + { + output = "default:shears", + recipe = { + {"default:ingot_steel", ""}, + {"group:stick", "default:ingot_steel"}, + } + }) + -- Nodes/Items minetest.register_craft( diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua index 71a6564..251dfe4 100644 --- a/mods/default/craftitems.lua +++ b/mods/default/craftitems.lua @@ -122,6 +122,13 @@ minetest.register_tool( end, }) +minetest.register_tool( + "default:shears", + { + description = "Steel Shears (Right-click to shear)", + inventory_image = "default_shears.png", + }) + minetest.register_craftitem( "default:bucket_water", { diff --git a/mods/mobs/textures/mobs_shears.png b/mods/default/textures/default_shears.png similarity index 100% rename from mods/mobs/textures/mobs_shears.png rename to mods/default/textures/default_shears.png diff --git a/mods/mobs/textures/mobs_shears.xcf b/mods/default/textures/default_shears.xcf similarity index 100% rename from mods/mobs/textures/mobs_shears.xcf rename to mods/default/textures/default_shears.xcf diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua index 5598d4e..f51d538 100644 --- a/mods/farming/nodes.lua +++ b/mods/farming/nodes.lua @@ -196,6 +196,44 @@ minetest.register_node( type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -0.5+(4/16), 0.5} }, + on_punch = function(pos, node, player) + local name = player:get_wielded_item():get_name() + + if name == "default:shears" then + minetest.set_node(pos, {name = "farming:cotton_3"}) + + for i = 1, 2 do + if math.random(1, 2) == 1 then + break + end + + local item = "farming:cotton" + if math.random(1, 4) == 1 then + item = item .. " 2" + end + + local rpos = { + x = pos.x + math.random(-0.3, 0.3), + y = pos.y, + z = pos.z + math.random(-0.3, 0.3) + } + + local drop = minetest.add_item(rpos, item) + + if drop ~= nil then + local x = math.random(1, 5) + if math.random(1, 2) == 1 then + x = -x + end + local z = math.random(1, 5) + if math.random(1, 2) == 1 then + z = -z + end + drop:setvelocity({x = 1 / x, y = drop:getvelocity().y, z = 1 / z}) + end + end + end + end, groups = {dig_immediate=2, not_in_craftingguide = 1}, sounds=default.node_sound_leaves_defaults() }) diff --git a/mods/mobs/crafts.lua b/mods/mobs/crafts.lua index 93adb21..4cf7db4 100644 --- a/mods/mobs/crafts.lua +++ b/mods/mobs/crafts.lua @@ -35,38 +35,21 @@ minetest.register_craft( cooktime = 5, }) --- shears (right click to shear animal) -minetest.register_tool( - "mobs:shears", - { - description = "Steel Shears (right-click to shear)", - inventory_image = "mobs_shears.png", - }) - -minetest.register_craft( - { - output = 'mobs:shears', - recipe = { - {'default:ingot_steel', ''}, - {'group:stick', 'default:ingot_steel'}, - } - }) - -- net (right click to capture animal) minetest.register_tool( "mobs:net", { - description = "Net (right-click to capture)", + description = "Net (Right-click to capture)", inventory_image = "mobs_net.png", }) minetest.register_craft( { - output = 'mobs:net', + output = "mobs:net", recipe = { - {'', '', 'default:fiber'}, - {'', 'default:fiber', 'default:fiber'}, - {'group:stick', '', ''}, + {"", "", "default:fiber"}, + {"", "default:fiber", "default:fiber"}, + {"group:stick", "", ""}, } }) @@ -74,16 +57,16 @@ minetest.register_craft( minetest.register_tool( "mobs:lasso", { - description = "Lasso (right-click to capture)", + description = "Lasso (Right-click to capture)", inventory_image = "mobs_lasso.png", }) minetest.register_craft( { - output = 'mobs:lasso', + output = "mobs:lasso", recipe = { - {'', 'default:fiber', ''}, - {'default:fiber', '', 'default:fiber'}, - {'group:stick', 'default:fiber', ''}, + {"", "default:rope", ""}, + {"default:rope", "", "default:rope"}, + {"group:stick", "default:rope", ""}, } }) \ No newline at end of file diff --git a/mods/mobs/sheep.lua b/mods/mobs/sheep.lua index 02998f1..434862c 100644 --- a/mods/mobs/sheep.lua +++ b/mods/mobs/sheep.lua @@ -79,7 +79,7 @@ mobs:register_mob( local itemname = item:get_name() --are we giving a haircut> - if itemname == "mobs:shears" then + if itemname == "default:shears" then if self.gotten == false and self.child == false then self.gotten = true -- shaved local pos = self.object:getpos() @@ -104,8 +104,6 @@ mobs:register_mob( return end - local name = clicker:get_player_name() - --are we capturing? mobs:capture_mob(self, clicker, 0, 5, 60, false, nil) end