mirror of
https://codeberg.org/tenplus1/farming.git
synced 2024-12-26 10:40:20 +01:00
added mithril scythe as special item
This commit is contained in:
parent
a6fe98b5c1
commit
58c236532d
@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
- 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click.
|
||||||
- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread.
|
- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread.
|
||||||
- 1.38 - Pumpkin grows into block, use chopping board to cut into 4x slices, same with melon block, 2x2 slices makes a block, cocoa pods are no longer walkable
|
- 1.38 - Pumpkin grows into block, use chopping board to cut into 4x slices, same with melon block, 2x2 slices makes a block, cocoa pods are no longer walkable
|
||||||
- 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example)
|
- 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example)
|
||||||
@ -60,4 +61,4 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
|
|||||||
- 0.1 - Fixed growing bug
|
- 0.1 - Fixed growing bug
|
||||||
- 0.0 - Initial release
|
- 0.0 - Initial release
|
||||||
|
|
||||||
### Lucky Blocks: 38
|
### Lucky Blocks: 39
|
||||||
|
123
hoes.lua
123
hoes.lua
@ -330,3 +330,126 @@ minetest.register_craftitem("farming:hoe_bomb", {
|
|||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Mithril Scythe (special item)
|
||||||
|
|
||||||
|
minetest.register_tool("farming:scythe_mithril", {
|
||||||
|
description = S("Mithril Scythe (Right-click crop to harvest and replant)"),
|
||||||
|
inventory_image = "farming_scythe_mithril.png",
|
||||||
|
tool_capabilities = {
|
||||||
|
full_punch_interval = 0.8,
|
||||||
|
max_drop_level = 2,
|
||||||
|
groupcaps = {
|
||||||
|
fleshy = {times = {[2] = 0.65, [3] = 0.25}, uses = 150, maxlevel = 2},
|
||||||
|
snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 150, maxlevel = 2},
|
||||||
|
},
|
||||||
|
damage_groups = {fleshy = 8},
|
||||||
|
},
|
||||||
|
sound = {breaks = "default_tool_breaks"},
|
||||||
|
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = pointed_thing.under
|
||||||
|
local name = placer:get_player_name()
|
||||||
|
|
||||||
|
if minetest.is_protected(pos, name) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node_or_nil(pos)
|
||||||
|
|
||||||
|
if not node then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
|
||||||
|
if not def then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not def.drop then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not def.groups
|
||||||
|
or not def.groups.plant then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local drops = minetest.get_node_drops(node.name, "")
|
||||||
|
|
||||||
|
if not drops
|
||||||
|
or #drops == 0
|
||||||
|
or (#drops == 1 and drops[1] == "") then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- get crop name
|
||||||
|
local mname = node.name:split(":")[1]
|
||||||
|
local pname = node.name:split(":")[2]
|
||||||
|
local sname = tonumber(pname:split("_")[2])
|
||||||
|
pname = pname:split("_")[1]
|
||||||
|
|
||||||
|
if not sname then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- add dropped items
|
||||||
|
for _, dropped_item in pairs(drops) do
|
||||||
|
|
||||||
|
local obj = minetest.add_item(pos, dropped_item)
|
||||||
|
|
||||||
|
if obj then
|
||||||
|
|
||||||
|
obj:set_velocity({
|
||||||
|
x = math.random(-10, 10) / 9,
|
||||||
|
y = 3,
|
||||||
|
z = math.random(-10, 10) / 9,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Run script hook
|
||||||
|
for _, callback in pairs(core.registered_on_dignodes) do
|
||||||
|
callback(pos, node.name)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- play sound
|
||||||
|
minetest.sound_play("default_grass_footstep", {pos = pos, gain = 1.0})
|
||||||
|
|
||||||
|
local replace = mname .. ":" .. pname .. "_1"
|
||||||
|
|
||||||
|
if minetest.registered_nodes[replace] then
|
||||||
|
|
||||||
|
local p2 = minetest.registered_nodes[replace].place_param2 or 1
|
||||||
|
|
||||||
|
minetest.set_node(pos, {name = replace, param2 = p2})
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name = "air"})
|
||||||
|
end
|
||||||
|
|
||||||
|
if not farming.is_creative(name) then
|
||||||
|
|
||||||
|
itemstack:add_wear(65535 / 150) -- 150 uses
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("moreores") then
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "farming:scythe_mithril",
|
||||||
|
recipe = {
|
||||||
|
{"", "moreores:mithril_ingot", "moreores:mithril_ingot"},
|
||||||
|
{"moreores:mithril_ingot", "", "group:stick"},
|
||||||
|
{"", "", "group:stick"}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
@ -34,6 +34,7 @@ if minetest.get_modpath("lucky_block") then
|
|||||||
{"dro", {"farming:hoe_bomb"}, 10},
|
{"dro", {"farming:hoe_bomb"}, 10},
|
||||||
{"dro", {"farming:turkish_delight"}, 5},
|
{"dro", {"farming:turkish_delight"}, 5},
|
||||||
{"lig"},
|
{"lig"},
|
||||||
|
{"dro", {"farming:scythe_mithril"}, 1},
|
||||||
{"sch", "instafarm", 0, true, {
|
{"sch", "instafarm", 0, true, {
|
||||||
{"farming:wheat_8", "farming:carrot_8"},
|
{"farming:wheat_8", "farming:carrot_8"},
|
||||||
{"farming:cotton_8", "farming:rhubarb_3"},
|
{"farming:cotton_8", "farming:rhubarb_3"},
|
||||||
|
BIN
textures/farming_scythe_mithril.png
Normal file
BIN
textures/farming_scythe_mithril.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 172 B |
Loading…
Reference in New Issue
Block a user