put shears in default and made cotton harvestable
This commit is contained in:
parent
d6b0331e44
commit
625cb7fefc
@ -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(
|
||||
|
@ -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",
|
||||
{
|
||||
|
Before Width: | Height: | Size: 461 B After Width: | Height: | Size: 461 B |
@ -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()
|
||||
})
|
||||
|
@ -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", ""},
|
||||
}
|
||||
})
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user