diff --git a/README.md b/README.md index 30e5673..128bf76 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,8 @@ This mod works by adding your new plant to the {growing=1} group and numbering t ### Changelog: -- 1.42 - Soil needs water to be present within 3 blocks horizontally and 2 below to make wet soil, Jack 'o Lanterns now check protection. +- 1.43 - Scythe works on use instead of right-click, added seed=1 groups to actual seeds and seed=2 group for plantable food items. +- 1.42 - Soil needs water to be present within 3 blocks horizontally and 1 below to make wet soil, Jack 'o Lanterns now check protection, add chocolate block. - 1.41 - Each crop has it's own spawn rate (can be changed in farming.conf) - 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click. Added Hoe's for MoreOres with Toolrank support. - 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread. diff --git a/crops/barley.lua b/crops/barley.lua index cc5ca0f..d896031 100644 --- a/crops/barley.lua +++ b/crops/barley.lua @@ -75,8 +75,8 @@ minetest.register_node("farming:barley_4", table.copy(crop_def)) crop_def.tiles = {"farming_barley_5.png"} crop_def.drop = { items = { - {items = {'farming:barley'}, rarity = 2}, - {items = {'farming:seed_barley'}, rarity = 2}, + {items = {"farming:barley"}, rarity = 2}, + {items = {"farming:seed_barley"}, rarity = 2}, } } minetest.register_node("farming:barley_5", table.copy(crop_def)) @@ -85,8 +85,8 @@ minetest.register_node("farming:barley_5", table.copy(crop_def)) crop_def.tiles = {"farming_barley_6.png"} crop_def.drop = { items = { - {items = {'farming:barley'}, rarity = 2}, - {items = {'farming:seed_barley'}, rarity = 1}, + {items = {"farming:barley"}, rarity = 2}, + {items = {"farming:seed_barley"}, rarity = 1}, } } minetest.register_node("farming:barley_6", table.copy(crop_def)) @@ -96,10 +96,10 @@ crop_def.tiles = {"farming_barley_7.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:barley'}, rarity = 1}, - {items = {'farming:barley'}, rarity = 3}, - {items = {'farming:seed_barley'}, rarity = 1}, - {items = {'farming:seed_barley'}, rarity = 3}, + {items = {"farming:barley"}, rarity = 1}, + {items = {"farming:barley"}, rarity = 3}, + {items = {"farming:seed_barley"}, rarity = 1}, + {items = {"farming:seed_barley"}, rarity = 3}, } } minetest.register_node("farming:barley_7", table.copy(crop_def)) diff --git a/crops/beans.lua b/crops/beans.lua index bd3b8ee..c35b2cf 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -27,7 +27,7 @@ local function place_beans(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end @@ -72,7 +72,7 @@ end minetest.register_craftitem("farming:beans", { description = S("Green Beans"), inventory_image = "farming_beans.png", - groups = {food_beans = 1, flammable = 2}, + groups = {seed = 2, food_beans = 1, flammable = 2}, on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) @@ -84,7 +84,7 @@ minetest.register_craftitem("farming:beans", { minetest.register_craft({ output = "dye:green", recipe = { - {'farming:beans'}, + {"farming:beans"}, } }) @@ -162,9 +162,9 @@ minetest.register_node("farming:beanpole", { minetest.register_craft({ output = "farming:beanpole", recipe = { - {'', '', ''}, - {'default:stick', '', 'default:stick'}, - {'default:stick', '', 'default:stick'}, + {"", "", ""}, + {"default:stick", "", "default:stick"}, + {"default:stick", "", "default:stick"}, } }) @@ -185,7 +185,7 @@ local crop_def = { sunlight_propagates = true, drop = { items = { - {items = {'farming:beanpole'}, rarity = 1}, + {items = {"farming:beanpole"}, rarity = 1}, } }, selection_box = farming.select, @@ -216,10 +216,10 @@ crop_def.tiles = {"farming_beanpole_5.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:beanpole'}, rarity = 1}, - {items = {'farming:beans 3'}, rarity = 1}, - {items = {'farming:beans 2'}, rarity = 2}, - {items = {'farming:beans 2'}, rarity = 3}, + {items = {"farming:beanpole"}, rarity = 1}, + {items = {"farming:beans 3"}, rarity = 1}, + {items = {"farming:beans 2"}, rarity = 2}, + {items = {"farming:beans 2"}, rarity = 3}, } } minetest.register_node("farming:beanpole_5", table.copy(crop_def)) @@ -244,9 +244,9 @@ minetest.register_node("farming:beanbush", { sunlight_propagates = true, drop = { items = { - {items = {'farming:beans 1'}, rarity = 1}, - {items = {'farming:beans 1'}, rarity = 2}, - {items = {'farming:beans 1'}, rarity = 3}, + {items = {"farming:beans 1"}, rarity = 1}, + {items = {"farming:beans 1"}, rarity = 2}, + {items = {"farming:beans 1"}, rarity = 3}, } }, selection_box = farming.select, diff --git a/crops/beetroot.lua b/crops/beetroot.lua index 8f7069b..0a20d88 100644 --- a/crops/beetroot.lua +++ b/crops/beetroot.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:beetroot", { description = S("Beetroot"), inventory_image = "farming_beetroot.png", - groups = {food_beetroot = 1, flammable = 2}, + groups = {seed = 2, food_beetroot = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1") end, @@ -76,10 +76,10 @@ crop_def.tiles = {"farming_beetroot_5.png"} crop_def.groups.growing = 0 crop_def.drop = { max_items = 4, items = { - {items = {'farming:beetroot'}, rarity = 1}, - {items = {'farming:beetroot'}, rarity = 2}, - {items = {'farming:beetroot'}, rarity = 3}, - {items = {'farming:beetroot'}, rarity = 4}, + {items = {"farming:beetroot"}, rarity = 1}, + {items = {"farming:beetroot"}, rarity = 2}, + {items = {"farming:beetroot"}, rarity = 3}, + {items = {"farming:beetroot"}, rarity = 4}, } } minetest.register_node("farming:beetroot_5", table.copy(crop_def)) diff --git a/crops/blueberry.lua b/crops/blueberry.lua index 6752e35..fec0c12 100644 --- a/crops/blueberry.lua +++ b/crops/blueberry.lua @@ -5,7 +5,8 @@ local S = farming.intllib minetest.register_craftitem("farming:blueberries", { description = S("Blueberries"), inventory_image = "farming_blueberries.png", - groups = {food_blueberries = 1, food_blueberry = 1, food_berry = 1, flammable = 2}, + groups = {seed = 2, food_blueberries = 1, food_blueberry = 1, + food_berry = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") end, @@ -78,9 +79,9 @@ crop_def.tiles = {"farming_blueberry_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:blueberries 2'}, rarity = 1}, - {items = {'farming:blueberries'}, rarity = 2}, - {items = {'farming:blueberries'}, rarity = 3}, + {items = {"farming:blueberries 2"}, rarity = 1}, + {items = {"farming:blueberries"}, rarity = 2}, + {items = {"farming:blueberries"}, rarity = 3}, } } minetest.register_node("farming:blueberry_4", table.copy(crop_def)) diff --git a/crops/carrot.lua b/crops/carrot.lua index 6ec1994..7df88ac 100644 --- a/crops/carrot.lua +++ b/crops/carrot.lua @@ -10,7 +10,7 @@ local S = farming.intllib minetest.register_craftitem("farming:carrot", { description = S("Carrot"), inventory_image = "farming_carrot.png", - groups = {food_carrot = 1, flammable = 2}, + groups = {seed = 2, food_carrot = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") end, @@ -97,8 +97,8 @@ minetest.register_node("farming:carrot_6", table.copy(crop_def)) crop_def.tiles = {"farming_carrot_7.png"} crop_def.drop = { items = { - {items = {'farming:carrot'}, rarity = 1}, - {items = {'farming:carrot 2'}, rarity = 3}, + {items = {"farming:carrot"}, rarity = 1}, + {items = {"farming:carrot 2"}, rarity = 3}, } } minetest.register_node("farming:carrot_7", table.copy(crop_def)) @@ -108,8 +108,8 @@ crop_def.tiles = {"farming_carrot_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:carrot 2'}, rarity = 1}, - {items = {'farming:carrot 3'}, rarity = 2}, + {items = {"farming:carrot 2"}, rarity = 1}, + {items = {"farming:carrot 3"}, rarity = 2}, } } minetest.register_node("farming:carrot_8", table.copy(crop_def)) diff --git a/crops/chili.lua b/crops/chili.lua index 429d256..cdcfa7e 100644 --- a/crops/chili.lua +++ b/crops/chili.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:chili_pepper", { description = S("Chili Pepper"), inventory_image = "farming_chili_pepper.png", - groups = {food_chili_pepper = 1, flammable = 4}, + groups = {seed = 2, food_chili_pepper = 1, flammable = 4}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1") end, @@ -32,7 +32,7 @@ minetest.register_craft({ minetest.register_craft({ output = "dye:red", recipe = { - {'farming:chili_pepper'}, + {"farming:chili_pepper"}, } }) @@ -85,8 +85,8 @@ crop_def.tiles = {"farming_chili_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:chili_pepper 3'}, rarity = 1}, - {items = {'farming:chili_pepper 2'}, rarity = 2}, + {items = {"farming:chili_pepper 3"}, rarity = 1}, + {items = {"farming:chili_pepper 2"}, rarity = 2}, } } minetest.register_node("farming:chili_8", table.copy(crop_def)) diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 7b5e8d4..243814b 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -21,7 +21,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end @@ -67,7 +67,7 @@ end minetest.register_craftitem("farming:cocoa_beans", { description = S("Cocoa Beans"), inventory_image = "farming_cocoa_beans.png", - groups = {food_cocoa = 1, flammable = 2}, + groups = {seed = 2, food_cocoa = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") end, @@ -108,6 +108,31 @@ minetest.register_craft( { } }) +-- chocolate block +minetest.register_node("farming:chocolate_block", { + description = S("Chocolate Block"), + tiles = {"farming_chocolate_block.png"}, + is_ground_content = false, + groups = {cracky = 2, oddly_breakable_by_hand = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craft({ + output = "farming:chocolate_block", + recipe = { + {"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"}, + {"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"}, + {"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"}, + } +}) + +minetest.register_craft({ + output = "farming:chocolate_dark 9", + recipe = { + {"farming:chocolate_block"}, + } +}) + -- cocoa definition local crop_def = { drawtype = "plantlike", @@ -116,7 +141,7 @@ local crop_def = { walkable = false, drop = { items = { - {items = {'farming:cocoa_beans 1'}, rarity = 2}, + {items = {"farming:cocoa_beans 1"}, rarity = 2}, } }, selection_box = { @@ -147,7 +172,7 @@ minetest.register_node("farming:cocoa_2", table.copy(crop_def)) crop_def.tiles = {"farming_cocoa_3.png"} crop_def.drop = { items = { - {items = {'farming:cocoa_beans 1'}, rarity = 1}, + {items = {"farming:cocoa_beans 1"}, rarity = 1}, } } minetest.register_node("farming:cocoa_3", table.copy(crop_def)) @@ -158,9 +183,9 @@ crop_def.groups.growing = 0 crop_def.growth_check = nil crop_def.drop = { items = { - {items = {'farming:cocoa_beans 2'}, rarity = 1}, - {items = {'farming:cocoa_beans 1'}, rarity = 2}, - {items = {'farming:cocoa_beans 1'}, rarity = 4}, + {items = {"farming:cocoa_beans 2"}, rarity = 1}, + {items = {"farming:cocoa_beans 1"}, rarity = 2}, + {items = {"farming:cocoa_beans 1"}, rarity = 4}, } } minetest.register_node("farming:cocoa_4", table.copy(crop_def)) diff --git a/crops/coffee.lua b/crops/coffee.lua index c4528e2..2e2ed73 100644 --- a/crops/coffee.lua +++ b/crops/coffee.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:coffee_beans", { description = S("Coffee Beans"), inventory_image = "farming_coffee_beans.png", - groups = {food_coffee = 1, flammable = 2}, + groups = {seed = 2, food_coffee = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1") end, @@ -80,9 +80,9 @@ crop_def.tiles = {"farming_coffee_5.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:coffee_beans 2'}, rarity = 1}, - {items = {'farming:coffee_beans 2'}, rarity = 2}, - {items = {'farming:coffee_beans 2'}, rarity = 3}, + {items = {"farming:coffee_beans 2"}, rarity = 1}, + {items = {"farming:coffee_beans 2"}, rarity = 2}, + {items = {"farming:coffee_beans 2"}, rarity = 3}, } } minetest.register_node("farming:coffee_5", table.copy(crop_def)) diff --git a/crops/corn.lua b/crops/corn.lua index 52f8b94..eef547a 100644 --- a/crops/corn.lua +++ b/crops/corn.lua @@ -10,7 +10,7 @@ local S = farming.intllib minetest.register_craftitem("farming:corn", { description = S("Corn"), inventory_image = "farming_corn.png", - groups = {food_corn = 1, flammable = 2}, + groups = {seed = 2, food_corn = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") end, @@ -129,9 +129,9 @@ minetest.register_node("farming:corn_6", table.copy(crop_def)) crop_def.tiles = {"farming_corn_7.png"} crop_def.drop = { items = { - {items = {'farming:corn'}, rarity = 1}, - {items = {'farming:corn'}, rarity = 2}, - {items = {'farming:corn'}, rarity = 3}, + {items = {"farming:corn"}, rarity = 1}, + {items = {"farming:corn"}, rarity = 2}, + {items = {"farming:corn"}, rarity = 3}, } } minetest.register_node("farming:corn_7", table.copy(crop_def)) @@ -141,9 +141,9 @@ crop_def.tiles = {"farming_corn_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:corn 2'}, rarity = 1}, - {items = {'farming:corn 2'}, rarity = 2}, - {items = {'farming:corn 2'}, rarity = 2}, + {items = {"farming:corn 2"}, rarity = 1}, + {items = {"farming:corn 2"}, rarity = 2}, + {items = {"farming:corn 2"}, rarity = 2}, } } minetest.register_node("farming:corn_8", table.copy(crop_def)) diff --git a/crops/cucumber.lua b/crops/cucumber.lua index d7178b8..8bd679a 100644 --- a/crops/cucumber.lua +++ b/crops/cucumber.lua @@ -10,7 +10,7 @@ local S = farming.intllib minetest.register_craftitem("farming:cucumber", { description = S("Cucumber"), inventory_image = "farming_cucumber.png", - groups = {food_cucumber = 1, flammable = 2}, + groups = {seed = 2, food_cucumber = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") end, @@ -49,8 +49,8 @@ crop_def.tiles = {"farming_cucumber_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:cucumber 2'}, rarity = 1}, - {items = {'farming:cucumber 2'}, rarity = 2}, + {items = {"farming:cucumber 2"}, rarity = 1}, + {items = {"farming:cucumber 2"}, rarity = 2}, } } minetest.register_node("farming:cucumber_4", table.copy(crop_def)) diff --git a/crops/garlic.lua b/crops/garlic.lua index 09ab375..ee841e5 100644 --- a/crops/garlic.lua +++ b/crops/garlic.lua @@ -11,7 +11,7 @@ local S = farming.intllib minetest.register_craftitem("farming:garlic_clove", { description = S("Garlic clove"), inventory_image = "crops_garlic_clove.png", - groups = {food_garlic_clove = 1, flammable = 3}, + groups = {seed = 2, food_garlic_clove = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1") end, @@ -65,7 +65,7 @@ minetest.register_node("farming:garlic_braid", { minetest.register_craft({ output = "farming:garlic_braid", - recipe = { + recipe = { {"farming:garlic", "farming:garlic", "farming:garlic"}, {"farming:garlic", "farming:garlic", "farming:garlic"}, {"farming:garlic", "farming:garlic", "farming:garlic"} @@ -118,11 +118,11 @@ crop_def.tiles = {"crops_garlic_plant_5.png"} crop_def.groups.growing = 0 crop_def.drop = { max_items = 5, items = { - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 1}, - {items = {'farming:garlic'}, rarity = 2}, - {items = {'farming:garlic'}, rarity = 5}, + {items = {"farming:garlic"}, rarity = 1}, + {items = {"farming:garlic"}, rarity = 1}, + {items = {"farming:garlic"}, rarity = 1}, + {items = {"farming:garlic"}, rarity = 2}, + {items = {"farming:garlic"}, rarity = 5}, } } minetest.register_node("farming:garlic_5", table.copy(crop_def)) diff --git a/crops/grapes.lua b/crops/grapes.lua index 2b33427..cc9d8aa 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -22,7 +22,7 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end @@ -68,7 +68,7 @@ minetest.register_craftitem("farming:grapes", { description = S("Grapes"), inventory_image = "farming_grapes.png", on_use = minetest.item_eat(2), - groups = {food_grapes = 1, flammable = 3}, + groups = {seed = 2, food_grapes = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") @@ -79,7 +79,7 @@ minetest.register_craftitem("farming:grapes", { minetest.register_craft({ output = "dye:violet", recipe = { - {'farming:grapes'}, + {"farming:grapes"}, } }) @@ -157,9 +157,9 @@ minetest.register_node("farming:trellis", { minetest.register_craft({ output = "farming:trellis", recipe = { - {'default:stick', 'default:stick', 'default:stick'}, - {'default:stick', 'default:stick', 'default:stick'}, - {'default:stick', 'default:stick', 'default:stick'}, + {"default:stick", "default:stick", "default:stick"}, + {"default:stick", "default:stick", "default:stick"}, + {"default:stick", "default:stick", "default:stick"}, } }) @@ -180,7 +180,7 @@ local crop_def = { sunlight_propagates = true, drop = { items = { - {items = {'farming:trellis'}, rarity = 1}, + {items = {"farming:trellis"}, rarity = 1}, } }, selection_box = farming.select, @@ -223,10 +223,10 @@ crop_def.tiles = {"farming_grapes_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:trellis'}, rarity = 1}, - {items = {'farming:grapes 3'}, rarity = 1}, - {items = {'farming:grapes 1'}, rarity = 2}, - {items = {'farming:grapes 1'}, rarity = 3}, + {items = {"farming:trellis"}, rarity = 1}, + {items = {"farming:grapes 3"}, rarity = 1}, + {items = {"farming:grapes 1"}, rarity = 2}, + {items = {"farming:grapes 1"}, rarity = 3}, } } minetest.register_node("farming:grapes_8", table.copy(crop_def)) @@ -251,9 +251,9 @@ minetest.register_node("farming:grapebush", { sunlight_propagates = true, drop = { items = { - {items = {'farming:grapes 1'}, rarity = 1}, - {items = {'farming:grapes 1'}, rarity = 2}, - {items = {'farming:grapes 1'}, rarity = 3}, + {items = {"farming:grapes 1"}, rarity = 1}, + {items = {"farming:grapes 1"}, rarity = 2}, + {items = {"farming:grapes 1"}, rarity = 3}, } }, selection_box = farming.select, diff --git a/crops/hemp.lua b/crops/hemp.lua index 931a586..e08384c 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -69,7 +69,7 @@ minetest.register_craft({ }) -- hemp fibre -minetest.register_craftitem("farming:hemp_fibre", { +minetest.register_craftitem("farming:hemp_fibre", { description = S("Hemp Fibre"), inventory_image = "farming_hemp_fibre.png", }) @@ -219,8 +219,8 @@ minetest.register_node("farming:hemp_5", table.copy(crop_def)) crop_def.tiles = {"farming_hemp_6.png"} crop_def.drop = { items = { - {items = {'farming:hemp_leaf'}, rarity = 2}, - {items = {'farming:seed_hemp'}, rarity = 1}, + {items = {"farming:hemp_leaf"}, rarity = 2}, + {items = {"farming:seed_hemp"}, rarity = 1}, } } minetest.register_node("farming:hemp_6", table.copy(crop_def)) @@ -229,10 +229,10 @@ minetest.register_node("farming:hemp_6", table.copy(crop_def)) crop_def.tiles = {"farming_hemp_7.png"} crop_def.drop = { items = { - {items = {'farming:hemp_leaf'}, rarity = 1}, - {items = {'farming:hemp_leaf'}, rarity = 3}, - {items = {'farming:seed_hemp'}, rarity = 1}, - {items = {'farming:seed_hemp'}, rarity = 3}, + {items = {"farming:hemp_leaf"}, rarity = 1}, + {items = {"farming:hemp_leaf"}, rarity = 3}, + {items = {"farming:seed_hemp"}, rarity = 1}, + {items = {"farming:seed_hemp"}, rarity = 3}, } } minetest.register_node("farming:hemp_7", table.copy(crop_def)) @@ -242,10 +242,10 @@ crop_def.tiles = {"farming_hemp_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:hemp_leaf 2'}, rarity = 1}, - {items = {'farming:hemp_leaf'}, rarity = 2}, - {items = {'farming:seed_hemp'}, rarity = 1}, - {items = {'farming:seed_hemp'}, rarity = 2}, + {items = {"farming:hemp_leaf 2"}, rarity = 1}, + {items = {"farming:hemp_leaf"}, rarity = 2}, + {items = {"farming:seed_hemp"}, rarity = 1}, + {items = {"farming:seed_hemp"}, rarity = 2}, } } minetest.register_node("farming:hemp_8", table.copy(crop_def)) diff --git a/crops/melon.lua b/crops/melon.lua index 06056a0..3fda9f6 100644 --- a/crops/melon.lua +++ b/crops/melon.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:melon_slice", { description = S("Melon Slice"), inventory_image = "farming_melon_slice.png", - groups = {food_melon_slice = 1, flammable = 3}, + groups = {seed = 2, food_melon_slice = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") end, diff --git a/crops/onion.lua b/crops/onion.lua index f4291a5..72a425e 100644 --- a/crops/onion.lua +++ b/crops/onion.lua @@ -11,7 +11,7 @@ local S = farming.intllib minetest.register_craftitem("farming:onion", { description = S("Onion"), inventory_image = "crops_onion.png", - groups = {food_onion = 1, flammable = 3}, + groups = {seed = 2, food_onion = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") end, @@ -58,11 +58,11 @@ crop_def.tiles = {"crops_onion_plant_5.png"} crop_def.groups.growing = 0 crop_def.drop = { max_items = 5, items = { - {items = {'farming:onion'}, rarity = 1}, - {items = {'farming:onion'}, rarity = 1}, - {items = {'farming:onion'}, rarity = 2}, - {items = {'farming:onion'}, rarity = 2}, - {items = {'farming:onion'}, rarity = 5}, + {items = {"farming:onion"}, rarity = 1}, + {items = {"farming:onion"}, rarity = 1}, + {items = {"farming:onion"}, rarity = 2}, + {items = {"farming:onion"}, rarity = 2}, + {items = {"farming:onion"}, rarity = 5}, } } minetest.register_node("farming:onion_5", table.copy(crop_def)) diff --git a/crops/peas.lua b/crops/peas.lua index 93e9232..ffe21b3 100644 --- a/crops/peas.lua +++ b/crops/peas.lua @@ -7,7 +7,7 @@ local S = farming.intllib minetest.register_craftitem("farming:pea_pod", { description = S("Pea Pod"), inventory_image = "farming_pea_pod.png", - groups = {food_pea_pod = 1, flammable = 2}, + groups = {seed = 2, food_pea_pod = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1") end @@ -79,11 +79,10 @@ crop_def.tiles = {"farming_pea_5.png"} crop_def.groups.growing = 0 crop_def.drop = { max_items = 5, items = { - {items = {'farming:pea_pod'}, rarity = 1}, - {items = {'farming:pea_pod'}, rarity = 2}, - {items = {'farming:pea_pod'}, rarity = 3}, - {items = {'farming:pea_pod'}, rarity = 4}, - {items = {'farming:pea_pod'}, rarity = 5}, + {items = {"farming:pea_pod"}, rarity = 1}, + {items = {"farming:pea_pod"}, rarity = 2}, + {items = {"farming:pea_pod"}, rarity = 3}, + {items = {"farming:pea_pod"}, rarity = 5}, } } minetest.register_node("farming:pea_5", table.copy(crop_def)) diff --git a/crops/pepper.lua b/crops/pepper.lua index 8f5e29e..6770888 100644 --- a/crops/pepper.lua +++ b/crops/pepper.lua @@ -11,7 +11,7 @@ local S = farming.intllib minetest.register_craftitem("farming:peppercorn", { description = S("Peppercorn"), inventory_image = "crops_peppercorn.png", - groups = {food_peppercorn = 1, flammable = 3}, + groups = {seed = 1, food_peppercorn = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1") end, @@ -98,9 +98,9 @@ crop_def.tiles = {"crops_pepper_plant_5.png"} crop_def.groups.growing = 0 crop_def.drop = { max_items = 2, items = { - {items = {'farming:pepper 2'}, rarity = 1}, - {items = {'farming:pepper'}, rarity = 2}, - {items = {'farming:pepper'}, rarity = 3}, + {items = {"farming:pepper 2"}, rarity = 1}, + {items = {"farming:pepper"}, rarity = 2}, + {items = {"farming:pepper"}, rarity = 3}, } } minetest.register_node("farming:pepper_5", table.copy(crop_def)) diff --git a/crops/pineapple.lua b/crops/pineapple.lua index f62042e..5f3e078 100644 --- a/crops/pineapple.lua +++ b/crops/pineapple.lua @@ -5,6 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:pineapple_top", { description = S("Pineapple Top"), inventory_image = "farming_pineapple_top.png", + groups = {seed = 2, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") end, @@ -123,8 +124,8 @@ crop_def.tiles = {"farming_pineapple_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:pineapple'}, rarity = 1}, - {items = {'farming:pineapple'}, rarity = 15}, + {items = {"farming:pineapple"}, rarity = 1}, + {items = {"farming:pineapple"}, rarity = 15}, } } minetest.register_node("farming:pineapple_8", table.copy(crop_def)) diff --git a/crops/potato.lua b/crops/potato.lua index 256ce97..d9f3e14 100644 --- a/crops/potato.lua +++ b/crops/potato.lua @@ -10,7 +10,7 @@ local S = farming.intllib minetest.register_craftitem("farming:potato", { description = S("Potato"), inventory_image = "farming_potato.png", - groups = {food_potato = 1, flammable = 2}, + groups = {seed = 2, food_potato = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") end, @@ -85,8 +85,8 @@ minetest.register_node("farming:potato_2", table.copy(crop_def)) crop_def.tiles = {"farming_potato_3.png"} crop_def.drop = { items = { - {items = {'farming:potato'}, rarity = 1}, - {items = {'farming:potato'}, rarity = 3}, + {items = {"farming:potato"}, rarity = 1}, + {items = {"farming:potato"}, rarity = 3}, } } minetest.register_node("farming:potato_3", table.copy(crop_def)) @@ -96,8 +96,8 @@ crop_def.tiles = {"farming_potato_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:potato 2'}, rarity = 1}, - {items = {'farming:potato 3'}, rarity = 2}, + {items = {"farming:potato 2"}, rarity = 1}, + {items = {"farming:potato 3"}, rarity = 2}, } } minetest.register_node("farming:potato_4", table.copy(crop_def)) diff --git a/crops/pumpkin.lua b/crops/pumpkin.lua index 3960a26..1e937db 100644 --- a/crops/pumpkin.lua +++ b/crops/pumpkin.lua @@ -9,7 +9,7 @@ local S = farming.intllib minetest.register_craftitem("farming:pumpkin_slice", { description = S("Pumpkin Slice"), inventory_image = "farming_pumpkin_slice.png", - groups = {food_pumpkin_slice = 1, flammable = 2}, + groups = {seed = 2, food_pumpkin_slice = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1") end, @@ -189,7 +189,7 @@ crop_def.tiles = {"farming_pumpkin_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:pumpkin_slice 9'}, rarity = 1}, + {items = {"farming:pumpkin_slice 9"}, rarity = 1}, } } minetest.register_node("farming:pumpkin_8", table.copy(crop_def)) diff --git a/crops/raspberry.lua b/crops/raspberry.lua index 979bdfb..8c909e4 100644 --- a/crops/raspberry.lua +++ b/crops/raspberry.lua @@ -5,7 +5,8 @@ local S = farming.intllib minetest.register_craftitem("farming:raspberries", { description = S("Raspberries"), inventory_image = "farming_raspberries.png", - groups = {food_raspberries = 1, food_raspberry = 1, food_berry = 1, flammable = 2}, + groups = {seed = 2, food_raspberries = 1, food_raspberry = 1, + food_berry = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") end, @@ -62,9 +63,9 @@ crop_def.tiles = {"farming_raspberry_4.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:raspberries 2'}, rarity = 1}, - {items = {'farming:raspberries'}, rarity = 2}, - {items = {'farming:raspberries'}, rarity = 3}, + {items = {"farming:raspberries 2"}, rarity = 1}, + {items = {"farming:raspberries"}, rarity = 2}, + {items = {"farming:raspberries"}, rarity = 3}, } } minetest.register_node("farming:raspberry_4", table.copy(crop_def)) diff --git a/crops/rhubarb.lua b/crops/rhubarb.lua index 9471733..dafb7e7 100644 --- a/crops/rhubarb.lua +++ b/crops/rhubarb.lua @@ -5,7 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:rhubarb", { description = S("Rhubarb"), inventory_image = "farming_rhubarb.png", - groups = {food_rhubarb = 1, flammable = 2}, + groups = {seed = 2, food_rhubarb = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") end, @@ -58,9 +58,9 @@ crop_def.tiles = {"farming_rhubarb_3.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:rhubarb 2'}, rarity = 1}, - {items = {'farming:rhubarb'}, rarity = 2}, - {items = {'farming:rhubarb'}, rarity = 3}, + {items = {"farming:rhubarb 2"}, rarity = 1}, + {items = {"farming:rhubarb"}, rarity = 2}, + {items = {"farming:rhubarb"}, rarity = 3}, } } minetest.register_node("farming:rhubarb_3", table.copy(crop_def)) diff --git a/crops/tomato.lua b/crops/tomato.lua index bab0e47..c082328 100644 --- a/crops/tomato.lua +++ b/crops/tomato.lua @@ -10,7 +10,7 @@ local S = farming.intllib minetest.register_craftitem("farming:tomato", { description = S("Tomato"), inventory_image = "farming_tomato.png", - groups = {food_tomato = 1, flammable = 2}, + groups = {seed = 2, food_tomato = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") end, @@ -61,8 +61,8 @@ minetest.register_node("farming:tomato_6", table.copy(crop_def)) crop_def.tiles = {"farming_tomato_7.png"} crop_def.drop = { items = { - {items = {'farming:tomato'}, rarity = 1}, - {items = {'farming:tomato'}, rarity = 3}, + {items = {"farming:tomato"}, rarity = 1}, + {items = {"farming:tomato"}, rarity = 3}, } } minetest.register_node("farming:tomato_7", table.copy(crop_def)) @@ -72,8 +72,8 @@ crop_def.tiles = {"farming_tomato_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:tomato 3'}, rarity = 1}, - {items = {'farming:tomato 3'}, rarity = 2}, + {items = {"farming:tomato 3"}, rarity = 1}, + {items = {"farming:tomato 3"}, rarity = 2}, } } minetest.register_node("farming:tomato_8", table.copy(crop_def)) diff --git a/crops/wheat.lua b/crops/wheat.lua index 7c77d11..b047561 100644 --- a/crops/wheat.lua +++ b/crops/wheat.lua @@ -189,8 +189,8 @@ minetest.register_node("farming:wheat_4", table.copy(crop_def)) crop_def.tiles = {"farming_wheat_5.png"} crop_def.drop = { items = { - {items = {'farming:wheat'}, rarity = 2}, - {items = {'farming:seed_wheat'}, rarity = 2}, + {items = {"farming:wheat"}, rarity = 2}, + {items = {"farming:seed_wheat"}, rarity = 2}, } } minetest.register_node("farming:wheat_5", table.copy(crop_def)) @@ -199,8 +199,8 @@ minetest.register_node("farming:wheat_5", table.copy(crop_def)) crop_def.tiles = {"farming_wheat_6.png"} crop_def.drop = { items = { - {items = {'farming:wheat'}, rarity = 2}, - {items = {'farming:seed_wheat'}, rarity = 1}, + {items = {"farming:wheat"}, rarity = 2}, + {items = {"farming:seed_wheat"}, rarity = 1}, } } minetest.register_node("farming:wheat_6", table.copy(crop_def)) @@ -209,10 +209,10 @@ minetest.register_node("farming:wheat_6", table.copy(crop_def)) crop_def.tiles = {"farming_wheat_7.png"} crop_def.drop = { items = { - {items = {'farming:wheat'}, rarity = 1}, - {items = {'farming:wheat'}, rarity = 3}, - {items = {'farming:seed_wheat'}, rarity = 1}, - {items = {'farming:seed_wheat'}, rarity = 3}, + {items = {"farming:wheat"}, rarity = 1}, + {items = {"farming:wheat"}, rarity = 3}, + {items = {"farming:seed_wheat"}, rarity = 1}, + {items = {"farming:seed_wheat"}, rarity = 3}, } } minetest.register_node("farming:wheat_7", table.copy(crop_def)) @@ -222,10 +222,10 @@ crop_def.tiles = {"farming_wheat_8.png"} crop_def.groups.growing = 0 crop_def.drop = { items = { - {items = {'farming:wheat'}, rarity = 1}, - {items = {'farming:wheat'}, rarity = 3}, - {items = {'farming:seed_wheat'}, rarity = 1}, - {items = {'farming:seed_wheat'}, rarity = 3}, + {items = {"farming:wheat"}, rarity = 1}, + {items = {"farming:wheat"}, rarity = 3}, + {items = {"farming:seed_wheat"}, rarity = 1}, + {items = {"farming:seed_wheat"}, rarity = 3}, } } minetest.register_node("farming:wheat_8", table.copy(crop_def)) diff --git a/farming.conf_example b/farming.conf_example index d108bb5..c2c5de0 100644 --- a/farming.conf_example +++ b/farming.conf_example @@ -21,8 +21,8 @@ farming.rhubarb = 0.001 farming.beans = 0.001 farming.grapes = 0.001 farming.barley = true -- true or false only -farming.chili = 0.002 -farming.hemp = 0.002 +farming.chili = 0.003 +farming.hemp = 0.003 farming.garlic = 0.001 farming.onion = 0.001 farming.pepper = 0.002 @@ -30,7 +30,6 @@ farming.pineapple = 0.001 farming.peas = 0.001 farming.beetroot = 0.001 farming.grains = true -- true or false only -farming.rarety = 0.002 -- default rarety of crops on map (higher number = more crops) farming.rarety = 0.002 diff --git a/food.lua b/food.lua index 1670f1f..00f3267 100644 --- a/food.lua +++ b/food.lua @@ -139,8 +139,8 @@ minetest.register_craftitem("farming:donut_chocolate", { minetest.register_craft({ output = "farming:donut_chocolate", recipe = { - {'group:food_cocoa'}, - {'farming:donut'}, + {"group:food_cocoa"}, + {"farming:donut"}, } }) @@ -153,8 +153,8 @@ minetest.register_craftitem("farming:donut_apple", { minetest.register_craft({ output = "farming:donut_apple", recipe = { - {'default:apple'}, - {'farming:donut'}, + {"default:apple"}, + {"farming:donut"}, } }) diff --git a/grass.lua b/grass.lua index 53ea606..6a9e94f 100644 --- a/grass.lua +++ b/grass.lua @@ -7,9 +7,9 @@ for i = 4, 5 do drop = { max_items = 1, items = { - {items = {'farming:seed_wheat'}, rarity = 5}, - {items = {'farming:seed_oat'},rarity = 5}, - {items = {'default:grass_1'}}, + {items = {"farming:seed_wheat"}, rarity = 5}, + {items = {"farming:seed_oat"},rarity = 5}, + {items = {"default:grass_1"}}, } }, }) @@ -22,9 +22,9 @@ for i = 4, 5 do drop = { max_items = 1, items = { - {items = {'farming:seed_barley'}, rarity = 5}, - {items = {'farming:seed_rye'},rarity = 5}, - {items = {'default:dry_grass_1'}}, + {items = {"farming:seed_barley"}, rarity = 5}, + {items = {"farming:seed_rye"},rarity = 5}, + {items = {"default:dry_grass_1"}}, } }, }) @@ -38,9 +38,9 @@ minetest.override_item("default:junglegrass", { drop = { max_items = 1, items = { - {items = {'farming:seed_cotton'}, rarity = 8}, - {items = {'farming:seed_rice'},rarity = 8}, - {items = {'default:junglegrass'}}, + {items = {"farming:seed_cotton"}, rarity = 8}, + {items = {"farming:seed_rice"},rarity = 8}, + {items = {"default:junglegrass"}}, } }, }) diff --git a/hoes.lua b/hoes.lua index ed833e5..5716128 100644 --- a/hoes.lua +++ b/hoes.lua @@ -24,6 +24,10 @@ farming.register_hoe = function(name, def) def.max_uses = 30 end + -- add hoe group + def.groups = def.groups or {} + def.groups.hoe = 1 + -- Register the tool minetest.register_tool(name, { description = def.description, @@ -304,7 +308,6 @@ local function throw_potion(itemstack, player) z = dir.z * -3 }) - obj:setyaw(player:get_look_yaw() + math.pi) obj:get_luaentity().player = player end @@ -340,20 +343,11 @@ farming.add_to_scythe_not_drops = function(item) end minetest.register_tool("farming:scythe_mithril", { - description = S("Mithril Scythe (Right-click crop to harvest and replant)"), + description = S("Mithril Scythe (Use to harvest and replant crops)"), 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) + on_use = function(itemstack, placer, pointed_thing) if pointed_thing.type ~= "node" then return diff --git a/init.lua b/init.lua index 2686dbd..3a5f5eb 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,7 @@ farming = { mod = "redo", - version = "20190427", + version = "20191202", path = minetest.get_modpath("farming"), select = { type = "fixed", @@ -269,7 +269,7 @@ end minetest.after(0, function() - for _, node_def in ipairs(minetest.registered_nodes) do + for _, node_def in pairs(minetest.registered_nodes) do register_plant_node(node_def) end end) @@ -278,7 +278,7 @@ end) -- Just in case a growing type or added node is missed (also catches existing -- nodes added to map before timers were incorporated). minetest.register_abm({ - nodenames = { "group:growing" }, + nodenames = {"group:growing"}, interval = 300, chance = 1, catch_up = false, @@ -421,7 +421,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] - if placer and def and def.on_rightclick then + if placer and itemstack and def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end @@ -461,7 +461,8 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) - if placer and not farming.is_creative(placer:get_player_name()) then + if placer and itemstack + and not farming.is_creative(placer:get_player_name()) then local name = itemstack:get_name() @@ -614,8 +615,8 @@ farming.rhubarb = 0.001 farming.beans = 0.001 farming.grapes = 0.001 farming.barley = true -farming.chili = 0.002 -farming.hemp = 0.002 +farming.chili = 0.003 +farming.hemp = 0.003 farming.garlic = 0.001 farming.onion = 0.001 farming.pepper = 0.002 diff --git a/soil.lua b/soil.lua index 6e27d47..d379f5d 100644 --- a/soil.lua +++ b/soil.lua @@ -54,9 +54,9 @@ minetest.register_abm({ -- check if there is water nearby and change soil accordingly -- if minetest.find_node_near(pos, 3, {"group:water"}) then - -- check if water is within 3 nodes horizontally and 2 below + -- check if water is within 3 nodes horizontally and 1 below if #minetest.find_nodes_in_area( - {x = pos.x + 3, y = pos.y + 2, z = pos.z + 3}, + {x = pos.x + 3, y = pos.y - 1, z = pos.z + 3}, {x = pos.x - 3, y = pos.y , z = pos.z - 3}, {"group:water"}) > 0 then diff --git a/textures/farming_chocolate_block.png b/textures/farming_chocolate_block.png new file mode 100644 index 0000000..20e5a79 Binary files /dev/null and b/textures/farming_chocolate_block.png differ