From df64f1117f9e1b290e3ce59e19dc0b563d3e60fe Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Thu, 31 Aug 2023 07:53:19 +0100 Subject: [PATCH] add initial MineClone2 support (thx usrib) --- api.txt | 2 +- crops/artichoke.lua | 6 ++--- crops/asparagus.lua | 6 ++--- crops/barley.lua | 6 ++--- crops/beans.lua | 12 +++++----- crops/beetroot.lua | 6 ++--- crops/blackberry.lua | 10 +++++---- crops/blueberry.lua | 12 +++++----- crops/cabbage.lua | 6 ++--- crops/carrot.lua | 6 ++--- crops/chili.lua | 8 +++---- crops/cocoa.lua | 21 ++++++++++-------- crops/coffee.lua | 8 +++---- crops/corn.lua | 8 +++---- crops/cotton.lua | 13 ++++++----- crops/cucumber.lua | 6 ++--- crops/eggplant.lua | 6 ++--- crops/garlic.lua | 8 +++---- crops/ginger.lua | 8 +++---- crops/grapes.lua | 16 +++++++------- crops/hemp.lua | 18 +++++++-------- crops/lettuce.lua | 6 ++--- crops/melon.lua | 10 ++++----- crops/mint.lua | 9 +++++--- crops/onion.lua | 8 +++---- crops/parsley.lua | 6 ++--- crops/peas.lua | 8 ++++--- crops/pepper.lua | 8 +++---- crops/pineapple.lua | 6 ++--- crops/potato.lua | 6 ++--- crops/pumpkin.lua | 20 ++++++++--------- crops/raspberry.lua | 6 ++--- crops/rhubarb.lua | 6 ++--- crops/rice.lua | 9 +++++--- crops/soy.lua | 10 ++++----- crops/spinach.lua | 6 ++--- crops/strawberry.lua | 8 ++++--- crops/sunflower.lua | 12 +++++----- crops/tomato.lua | 6 ++--- crops/vanilla.lua | 8 +++---- crops/wheat.lua | 8 +++---- food.lua | 10 ++++----- init.lua | 52 +++++++++++++++++++++++++++++++++++++------- mcl_grass.lua | 16 ++++++++++++++ mod.conf | 3 +-- 45 files changed, 256 insertions(+), 183 deletions(-) create mode 100644 mcl_grass.lua diff --git a/api.txt b/api.txt index cd8cc76..37cf534 100644 --- a/api.txt +++ b/api.txt @@ -41,7 +41,7 @@ The farming API allows you to easily register plants and hoes. steps = 8, -- How many steps the plant has to grow, until it can be harvested -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) minlight = 13, -- Minimum light to grow - maxlight = default.LIGHT_MAX -- Maximum light to grow + maxlight = minetest.LIGHT_MAX -- Maximum light to grow } Note: Any crops registered with the above function will use the new growing routines, also if crops are manually added with the {growing=1} group they will also grow. diff --git a/crops/artichoke.lua b/crops/artichoke.lua index 0034026..0831eaf 100644 --- a/crops/artichoke.lua +++ b/crops/artichoke.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:artichoke", { description = S("Artichoke"), inventory_image = "farming_artichoke.png", - groups = {seed = 2, food_artichoke = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_artichoke = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1") end, @@ -24,10 +24,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/asparagus.lua b/crops/asparagus.lua index a88b01a..001c723 100644 --- a/crops/asparagus.lua +++ b/crops/asparagus.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:asparagus", { description = S("Asparagus"), inventory_image = "farming_asparagus.png", - groups = {seed = 2, food_asparagus = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_asparagus = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1") end, @@ -26,10 +26,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/barley.lua b/crops/barley.lua index 6c317e0..6ac4cc7 100644 --- a/crops/barley.lua +++ b/crops/barley.lua @@ -8,7 +8,7 @@ minetest.register_node("farming:seed_barley", { inventory_image = "farming_barley_seed.png", wield_image = "farming_barley_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1}, + groups = {compostability = 65, seed = 1, snappy = 3, attached_node = 1, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -53,10 +53,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/beans.lua b/crops/beans.lua index 2c43d1c..8851dc6 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -71,7 +71,7 @@ end minetest.register_craftitem("farming:beans", { description = S("Green Beans"), inventory_image = "farming_beans.png", - groups = {seed = 2, food_beans = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_beans = 1, flammable = 2}, on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1") @@ -97,8 +97,8 @@ minetest.register_node("farming:beanpole", { sunlight_propagates = true, drop = "farming:beanpole", selection_box = farming.select, - groups = {snappy = 3, flammable = 2, attached_node = 1}, - sounds = default.node_sound_leaves_defaults(), + groups = {handy = 1, snappy = 3, flammable = 2, attached_node = 1}, + sounds = farming.sounds.node_sound_leaves_defaults(), on_place = function(itemstack, placer, pointed_thing) @@ -186,10 +186,10 @@ local def = { }, selection_box = farming.select, groups = { - snappy = 3, flammable = 3, not_in_creative_inventory = 1, + handy = 1, snappy = 3, flammable = 3, not_in_creative_inventory = 1, attached_node = 1, growing = 1, plant = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 @@ -252,7 +252,7 @@ minetest.register_node("farming:beanbush", { snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() }) -- mapgen diff --git a/crops/beetroot.lua b/crops/beetroot.lua index ea7fd10..8b7dd8c 100644 --- a/crops/beetroot.lua +++ b/crops/beetroot.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:beetroot", { description = S("Beetroot"), inventory_image = "farming_beetroot.png", - groups = {seed = 2, food_beetroot = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -45,10 +45,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/blackberry.lua b/crops/blackberry.lua index 109ad5b..f9ace9e 100644 --- a/crops/blackberry.lua +++ b/crops/blackberry.lua @@ -5,8 +5,10 @@ local S = farming.translate minetest.register_craftitem("farming:blackberry", { description = S("Blackberries"), inventory_image = "farming_blackberry.png", - groups = {seed = 2, food_blackberries = 1, food_blackberry = 1, - food_berry = 1, flammable = 2}, + groups = { + compostability = 65, seed = 2, food_blackberries = 1, food_blackberry = 1, + food_berry = 1, flammable = 2 + }, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1") end, @@ -23,10 +25,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/blueberry.lua b/crops/blueberry.lua index 280e4dd..1810f77 100644 --- a/crops/blueberry.lua +++ b/crops/blueberry.lua @@ -5,8 +5,10 @@ local S = farming.translate minetest.register_craftitem("farming:blueberries", { description = S("Wild Blueberries"), inventory_image = "farming_blueberries.png", - groups = {seed = 2, food_blueberries = 1, food_blueberry = 1, - food_berry = 1, flammable = 2}, + groups = { + compostability = 65,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, @@ -47,7 +49,7 @@ minetest.register_craft({ -- Blue Dye minetest.register_craft({ - output = "dye:blue", + output = farming.mcl and "mcl_dye:blue" or "dye:blue", recipe = {{"farming:blueberries"}} }) @@ -62,10 +64,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/cabbage.lua b/crops/cabbage.lua index 6829493..dbe7989 100644 --- a/crops/cabbage.lua +++ b/crops/cabbage.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:cabbage", { description = S("Cabbage"), inventory_image = "farming_cabbage.png", - groups = {seed = 2, food_cabbage = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_cabbage = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1") end, @@ -23,10 +23,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/carrot.lua b/crops/carrot.lua index f521f9c..fb61000 100644 --- a/crops/carrot.lua +++ b/crops/carrot.lua @@ -10,7 +10,7 @@ local S = farming.translate minetest.register_craftitem("farming:carrot", { description = S("Carrot"), inventory_image = "farming_carrot.png", - groups = {seed = 2, food_carrot = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -63,10 +63,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } diff --git a/crops/chili.lua b/crops/chili.lua index 13a34a9..2dead5d 100644 --- a/crops/chili.lua +++ b/crops/chili.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:chili_pepper", { description = S("Chili Pepper"), inventory_image = "farming_chili_pepper.png", - groups = {seed = 2, food_chili_pepper = 1, flammable = 4}, + groups = {compostability = 65, 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, @@ -29,7 +29,7 @@ minetest.register_craft({ -- chili can be used for red dye minetest.register_craft({ - output = "dye:red", + output = farming.mcl and "mcl_dye:red" or "dye:red", recipe = {{"farming:chili_pepper"}} }) @@ -63,10 +63,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 4, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 0372252..cbe6454 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -26,7 +26,7 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname) end -- check if pointing at jungletree - if under.name ~= "default:jungletree" + if (under.name ~= "default:jungletree" and under.name ~= "mcl_core:jungletree") or minetest.get_node(pt.above).name ~= "air" then return end @@ -67,7 +67,7 @@ end minetest.register_craftitem("farming:cocoa_beans_raw", { description = S("Raw Cocoa Beans"), inventory_image = "farming_cocoa_beans.png^[brighten", - groups = {seed = 1, flammable = 2}, + groups = {compostability = 65, seed = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") end @@ -87,7 +87,7 @@ minetest.register_craft({ }) minetest.register_craft( { - output = "dye:brown 2", + output = farming.mcl and "mcl_dye:brown 2" or "dye:brown 2", recipe = {{"farming:cocoa_beans"}} }) @@ -125,7 +125,7 @@ minetest.register_node("farming: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() + sounds = farming.sounds.node_sound_stone_defaults() }) minetest.register_craft({ @@ -154,13 +154,14 @@ local def = { }, drop = {}, groups = { - snappy = 3, flammable = 2, plant = 1, growing = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, growing = 1, not_in_creative_inventory = 1, leafdecay = 1, leafdecay_drop = 1 }, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), growth_check = function(pos, node_name) - if minetest.find_node_near(pos, 1, {"default:jungletree"}) then + if minetest.find_node_near(pos, 1, + {"default:jungletree", "mcl_core:jungletree"}) then return false -- can grow end @@ -218,14 +219,16 @@ minetest.register_on_generated(function(minp, maxp) end local pos, dir - local cocoa = minetest.find_nodes_in_area(minp, maxp, "default:jungletree") + local cocoa = minetest.find_nodes_in_area(minp, maxp, + {"default:jungletree", "mcl_core:jungletree"}) for n = 1, #cocoa do pos = cocoa[n] if minetest.find_node_near(pos, 1, - {"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then + {"default:jungleleaves", "moretrees:jungletree_leaves_green", + "mcl_core:jungleleaves"}) then dir = random(80) diff --git a/crops/coffee.lua b/crops/coffee.lua index 8823e9d..002121b 100644 --- a/crops/coffee.lua +++ b/crops/coffee.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:coffee_beans", { description = S("Coffee Beans"), inventory_image = "farming_coffee_beans.png", - groups = {seed = 2, food_coffee = 1, flammable = 2}, + groups = {compostability = 65, 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 @@ -26,7 +26,7 @@ minetest.register_node("farming:coffee_cup", { }, groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1}, on_use = minetest.item_eat(2, "vessels:drinking_glass"), - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup") @@ -57,10 +57,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/corn.lua b/crops/corn.lua index 08fa275..6b1d89b 100644 --- a/crops/corn.lua +++ b/crops/corn.lua @@ -10,7 +10,7 @@ local S = farming.translate minetest.register_craftitem("farming:corn", { description = S("Corn"), inventory_image = "farming_corn.png", - groups = {seed = 2, food_corn = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -90,7 +90,7 @@ minetest.register_node("farming:bottle_ethanol", { fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_craft( { @@ -121,10 +121,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/cotton.lua b/crops/cotton.lua index eb7b289..d1aba32 100644 --- a/crops/cotton.lua +++ b/crops/cotton.lua @@ -13,14 +13,14 @@ minetest.register_node("farming:cotton_wild", { sunlight_propagates = true, walkable = false, buildable_to = true, - groups = {snappy = 3, attached_node = 1, flammable = 4}, + groups = {handy = 1, snappy = 3, attached_node = 1, flammable = 4}, drop = { items = { {items = {"farming:cotton"}, rarity = 2}, {items = {"farming:seed_cotton"}, rarity = 1} } }, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), selection_box = { type = "fixed", fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16} @@ -34,7 +34,10 @@ minetest.register_node("farming:seed_cotton", { inventory_image = "farming_cotton_seed.png", wield_image = "farming_cotton_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1}, + groups = { + compostability = 65, seed = 1, snappy = 3, attached_node = 1, + flammable = 4, growing = 1 + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -103,10 +106,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 4, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/cucumber.lua b/crops/cucumber.lua index 7acd28a..5edd356 100644 --- a/crops/cucumber.lua +++ b/crops/cucumber.lua @@ -10,7 +10,7 @@ local S = farming.translate minetest.register_craftitem("farming:cucumber", { description = S("Cucumber"), inventory_image = "farming_cucumber.png", - groups = {seed = 2, food_cucumber = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -27,10 +27,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/eggplant.lua b/crops/eggplant.lua index 20bdf07..8cdf2e3 100644 --- a/crops/eggplant.lua +++ b/crops/eggplant.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:eggplant", { description = S("Eggplant"), inventory_image = "farming_eggplant.png", - groups = {seed = 2, food_eggplant = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_eggplant = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1") end, @@ -25,10 +25,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/garlic.lua b/crops/garlic.lua index 0e53c14..d750598 100644 --- a/crops/garlic.lua +++ b/crops/garlic.lua @@ -11,7 +11,7 @@ local S = farming.translate minetest.register_craftitem("farming:garlic_clove", { description = S("Garlic clove"), inventory_image = "crops_garlic_clove.png", - groups = {seed = 2, food_garlic_clove = 1, flammable = 3}, + groups = {compostability = 65, 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 @@ -54,7 +54,7 @@ minetest.register_node("farming:garlic_braid", { "crops_garlic_braid.png","crops_garlic_braid.png" }, groups = {vessel = 1, dig_immediate = 3, flammable = 3}, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), node_box = { type = "fixed", fixed = { @@ -92,10 +92,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 3, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/ginger.lua b/crops/ginger.lua index 700c5cf..c7ba67a 100644 --- a/crops/ginger.lua +++ b/crops/ginger.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:ginger", { description = S("Ginger"), inventory_image = "farming_ginger.png", - groups = {seed = 2, food_ginger = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_ginger = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1") end, @@ -24,10 +24,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 @@ -64,7 +64,7 @@ farming.registered_plants["farming:ginger"] = { crop = "farming:ginger", seed = "farming:ginger", minlight = 5, - maxlight = default.LIGHT_MAX, + maxlight = minetest.LIGHT_MAX, steps = 4 } diff --git a/crops/grapes.lua b/crops/grapes.lua index 3d61332..7afa68d 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -67,7 +67,7 @@ minetest.register_craftitem("farming:grapes", { description = S("Grapes"), inventory_image = "farming_grapes.png", on_use = minetest.item_eat(2), - groups = {seed = 2, food_grapes = 1, flammable = 3}, + groups = {compostability = 65, seed = 2, food_grapes = 1, flammable = 3}, on_place = function(itemstack, placer, pointed_thing) return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") end @@ -75,7 +75,7 @@ minetest.register_craftitem("farming:grapes", { -- grapes can be used for violet dye minetest.register_craft({ - output = "dye:violet", + output = farming.mcl and "mcl_dye:violet" or "dye:violet", recipe = {{"farming:grapes"}} }) @@ -92,8 +92,8 @@ minetest.register_node("farming:trellis", { sunlight_propagates = true, drop = "farming:trellis", selection_box = farming.select, - groups = {snappy = 3, flammable = 2, attached_node = 1}, - sounds = default.node_sound_leaves_defaults(), + groups = {handy = 1, snappy = 3, flammable = 2, attached_node = 1}, + sounds = farming.sounds.node_sound_leaves_defaults(), on_place = function(itemstack, placer, pointed_thing) @@ -181,10 +181,10 @@ local def = { }, selection_box = farming.select, groups = { - snappy = 3, flammable = 3, not_in_creative_inventory = 1, + handy = 1, snappy = 3, flammable = 3, not_in_creative_inventory = 1, attached_node = 1, growing = 1, plant = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 @@ -256,10 +256,10 @@ minetest.register_node("farming:grapebush", { }, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() }) -- mapgen diff --git a/crops/hemp.lua b/crops/hemp.lua index c7da66f..b06431e 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -8,7 +8,7 @@ minetest.register_node("farming:seed_hemp", { inventory_image = "farming_hemp_seed.png", wield_image = "farming_hemp_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1}, + groups = {compostability = 65, seed = 1, snappy = 3, attached_node = 1, growing = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -41,7 +41,7 @@ minetest.register_node("farming:hemp_oil", { fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, groups = {food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_craft( { @@ -102,8 +102,8 @@ minetest.register_node("farming:hemp_block", { description = S("Hemp Block"), tiles = {"farming_hemp_block.png"}, paramtype = "light", - groups = {snappy = 2, oddly_breakable_by_hand = 1, flammable = 2}, - sounds = default.node_sound_leaves_defaults() + groups = {handy = 1, snappy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = farming.sounds.node_sound_leaves_defaults() }) minetest.register_craft( { @@ -124,7 +124,7 @@ if minetest.global_exists("stairs") then {snappy = 2, oddly_breakable_by_hand = 1, flammable = 2}, {"farming_hemp_block.png"}, "Hemp Block", - default.node_sound_leaves_defaults()) + farming.sounds.node_sound_leaves_defaults()) else stairs.register_stair_and_slab("hemp_block", "farming:hemp_block", @@ -132,7 +132,7 @@ if minetest.global_exists("stairs") then {"farming_hemp_block.png"}, "Hemp Block Stair", "Hemp Block Slab", - default.node_sound_leaves_defaults()) + farming.sounds.node_sound_leaves_defaults()) end end @@ -166,7 +166,7 @@ minetest.register_node("farming:hemp_rope", { inventory_image = "farming_hemp_rope.png", drawtype = "plantlike", groups = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3}, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), selection_box = { type = "fixed", fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7} @@ -195,10 +195,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/lettuce.lua b/crops/lettuce.lua index 554ea2f..09265d9 100644 --- a/crops/lettuce.lua +++ b/crops/lettuce.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:lettuce", { description = S("Lettuce"), inventory_image = "farming_lettuce.png", - groups = {seed = 2, food_lettuce = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_lettuce = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1") end, @@ -22,10 +22,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/melon.lua b/crops/melon.lua index c373f3d..0fdb328 100644 --- a/crops/melon.lua +++ b/crops/melon.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:melon_slice", { description = S("Melon Slice"), inventory_image = "farming_melon_slice.png", - groups = {seed = 2, food_melon_slice = 1, flammable = 3}, + groups = {compostability = 65, 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, @@ -39,10 +39,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 @@ -81,11 +81,11 @@ minetest.register_node("farming:melon_8", { "farming_melon_side.png" }, groups = { - food_melon = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 2, + food_melon = 1, handy = 1, snappy = 3, choppy = 3, oddly_breakable_by_hand = 2, flammable = 2, plant = 1 }, drop = "farming:melon_8", - sounds = default.node_sound_wood_defaults(), + sounds = farming.sounds.node_sound_wood_defaults(), paramtype2 = "facedir", on_place = minetest.rotate_node }) diff --git a/crops/mint.lua b/crops/mint.lua index 95bd97d..b93b3e7 100644 --- a/crops/mint.lua +++ b/crops/mint.lua @@ -8,7 +8,10 @@ minetest.register_node("farming:seed_mint", { inventory_image = "farming_mint_seeds.png", wield_image = "farming_mint_seeds.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1, flammable = 2}, + groups = { + compostability = 65, seed = 1, snappy = 3, attached_node = 1, growing = 1, + flammable = 2 + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -60,10 +63,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/onion.lua b/crops/onion.lua index cf08545..ae404ea 100644 --- a/crops/onion.lua +++ b/crops/onion.lua @@ -11,7 +11,7 @@ local S = farming.translate minetest.register_craftitem("farming:onion", { description = S("Onion"), inventory_image = "crops_onion.png", - groups = {seed = 2, food_onion = 1, flammable = 3}, + groups = {compostability = 65, 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, @@ -40,7 +40,7 @@ minetest.register_craft({ -- yellow dye minetest.register_craft({ - output = "dye:yellow", + output = farming.mcl and "mcl_dye:yellow" or "dye:yellow", recipe = {{"group:food_onion"}} }) @@ -59,10 +59,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 3, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/parsley.lua b/crops/parsley.lua index 4aabbe8..2b678ee 100644 --- a/crops/parsley.lua +++ b/crops/parsley.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:parsley", { description = S("Parsley"), inventory_image = "farming_parsley.png", - groups = {seed = 2, food_parsley = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_parsley = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1") end @@ -23,10 +23,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/peas.lua b/crops/peas.lua index 6cb212e..5fd3029 100644 --- a/crops/peas.lua +++ b/crops/peas.lua @@ -7,7 +7,9 @@ local S = farming.translate minetest.register_craftitem("farming:pea_pod", { description = S("Pea Pod"), inventory_image = "farming_pea_pod.png", - groups = {seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2}, + groups = { + compostability = 65, seed = 2, food_peas = 1, 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, @@ -47,10 +49,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/pepper.lua b/crops/pepper.lua index 5a5bba5..c6a154a 100644 --- a/crops/pepper.lua +++ b/crops/pepper.lua @@ -11,7 +11,7 @@ local S = farming.translate minetest.register_craftitem("farming:peppercorn", { description = S("Peppercorn"), inventory_image = "crops_peppercorn.png", - groups = {seed = 1, food_peppercorn = 1, flammable = 3}, + groups = {compostability = 65, 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 @@ -59,7 +59,7 @@ minetest.register_node("farming:pepper_ground", { vessel = 1, food_pepper_ground = 1, dig_immediate = 3, attached_node = 1 }, - sounds = default.node_sound_defaults(), + sounds = farming.sounds.node_sound_defaults(), selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} @@ -92,10 +92,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 3, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 3, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/pineapple.lua b/crops/pineapple.lua index f3d962c..ed67b3f 100644 --- a/crops/pineapple.lua +++ b/crops/pineapple.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:pineapple_top", { description = S("Pineapple Top"), inventory_image = "farming_pineapple_top.png", - groups = {seed = 2, flammable = 2}, + groups = {compostability = 65, seed = 2, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1") end @@ -90,10 +90,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/potato.lua b/crops/potato.lua index e87f494..56b6804 100644 --- a/crops/potato.lua +++ b/crops/potato.lua @@ -10,7 +10,7 @@ local S = farming.translate minetest.register_craftitem("farming:potato", { description = S("Potato"), inventory_image = "farming_potato.png", - groups = {seed = 2, food_potato = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -68,10 +68,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/pumpkin.lua b/crops/pumpkin.lua index 1f78e37..714cd8c 100644 --- a/crops/pumpkin.lua +++ b/crops/pumpkin.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:pumpkin_slice", { description = S("Pumpkin Slice"), inventory_image = "farming_pumpkin_slice.png", - groups = {seed = 2, food_pumpkin_slice = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -37,8 +37,8 @@ minetest.register_node("farming:jackolantern", { "farming_pumpkin_side.png", "farming_pumpkin_side.png^farming_pumpkin_face_off.png" }, paramtype2 = "facedir", - groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, - sounds = default.node_sound_wood_defaults(), + groups = {handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = farming.sounds.node_sound_wood_defaults(), on_punch = function(pos, node, puncher) local name = puncher:get_player_name() or "" if minetest.is_protected(pos, name) then return end @@ -53,13 +53,13 @@ minetest.register_node("farming:jackolantern_on", { "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png^farming_pumpkin_face_on.png" }, - light_source = default.LIGHT_MAX - 1, + light_source = minetest.LIGHT_MAX - 1, paramtype2 = "facedir", groups = { - snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, + handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, not_in_creative_inventory = 1 }, - sounds = default.node_sound_wood_defaults(), + sounds = farming.sounds.node_sound_wood_defaults(), drop = "farming:jackolantern", on_punch = function(pos, node, puncher) local name = puncher:get_player_name() or "" @@ -92,7 +92,7 @@ minetest.register_node("farming:scarecrow_bottom", { {-12/16, 4/16, -1/16, 12/16, 2/16, 1/16}, } }, - groups = {snappy = 3, flammable = 2} + groups = {handy = 1, snappy = 3, flammable = 2} }) minetest.register_craft({ @@ -143,10 +143,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 @@ -189,7 +189,7 @@ minetest.register_node("farming:pumpkin_8", { flammable = 2, plant = 1 }, drop = "farming:pumpkin_8", - sounds = default.node_sound_wood_defaults(), + sounds = farming.sounds.node_sound_wood_defaults(), paramtype2 = "facedir", on_place = minetest.rotate_node }) diff --git a/crops/raspberry.lua b/crops/raspberry.lua index a2489f4..20ca7d1 100644 --- a/crops/raspberry.lua +++ b/crops/raspberry.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:raspberries", { description = S("Raspberries"), inventory_image = "farming_raspberries.png", - groups = {seed = 2, food_raspberries = 1, food_raspberry = 1, + groups = {compostability = 65, 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") @@ -41,10 +41,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/rhubarb.lua b/crops/rhubarb.lua index a0d6860..b3b14cd 100644 --- a/crops/rhubarb.lua +++ b/crops/rhubarb.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:rhubarb", { description = S("Rhubarb"), inventory_image = "farming_rhubarb.png", - groups = {seed = 2, food_rhubarb = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -43,10 +43,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), minlight = 10, maxlight = 12 } diff --git a/crops/rice.lua b/crops/rice.lua index 0951347..c222296 100644 --- a/crops/rice.lua +++ b/crops/rice.lua @@ -8,7 +8,10 @@ minetest.register_node("farming:seed_rice", { inventory_image = "farming_rice_seed.png", wield_image = "farming_rice_seed.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4, growing = 1}, + groups = { + compostability = 65, seed = 1, snappy = 3, attached_node = 1, + flammable = 4, growing = 1 + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -81,10 +84,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 4, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 4, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/soy.lua b/crops/soy.lua index c955ea4..107e4e1 100644 --- a/crops/soy.lua +++ b/crops/soy.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:soy_pod", { description = S("Soy Pod"), inventory_image = "farming_soy_pod.png", - groups = {seed = 2, food_soy = 1, food_soy_pod = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_soy = 1, food_soy_pod = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:soy_1") end @@ -30,7 +30,7 @@ minetest.register_node("farming:soy_sauce", { groups = { vessel = 1, food_soy_sauce = 1, dig_immediate = 3, attached_node = 1 }, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) local tmp = farming.use_utensils and "farming:juicer" or "" @@ -66,7 +66,7 @@ minetest.register_node("farming:soy_milk", { vessel = 1, food_milk_glass = 1, dig_immediate = 3, attached_node = 1, drink = 1 }, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_craft( { @@ -130,10 +130,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/spinach.lua b/crops/spinach.lua index 92bf68c..24126b0 100644 --- a/crops/spinach.lua +++ b/crops/spinach.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:spinach", { description = S("Spinach"), inventory_image = "farming_spinach.png", - groups = {seed = 2, food_spinach = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_spinach = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1") end, @@ -24,10 +24,10 @@ local def = { drop = "", selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/strawberry.lua b/crops/strawberry.lua index 1e9ba6c..3c2bfee 100644 --- a/crops/strawberry.lua +++ b/crops/strawberry.lua @@ -5,7 +5,9 @@ local S = farming.translate minetest.register_craftitem(":ethereal:strawberry", { description = S("Strawberry"), inventory_image = "ethereal_strawberry.png", - groups = {seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2}, + groups = { + compostability = 65, seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2 + }, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1") end, @@ -27,10 +29,10 @@ local def = { fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} }, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } --stage 1 diff --git a/crops/sunflower.lua b/crops/sunflower.lua index 403528c..298ea3f 100644 --- a/crops/sunflower.lua +++ b/crops/sunflower.lua @@ -15,8 +15,10 @@ minetest.register_node("farming:seed_sunflower", { inventory_image = "farming_sunflower_seeds.png", wield_image = "farming_sunflower_seeds.png", drawtype = "signlike", - groups = {seed = 1, snappy = 3, attached_node = 1, growing = 1, - food_sunflower_seeds = 1, flammable = 2}, + groups = { + compostability = 65, seed = 1, snappy = 3, attached_node = 1, growing = 1, + food_sunflower_seeds = 1, flammable = 2 + }, paramtype = "light", paramtype2 = "wallmounted", walkable = false, @@ -68,7 +70,7 @@ minetest.register_node("farming:sunflower_oil", { food_oil = 1, vessel = 1, dig_immediate = 3, attached_node = 1, flammable = 2 }, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_craft( { @@ -112,10 +114,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/tomato.lua b/crops/tomato.lua index c78293e..f6a1104 100644 --- a/crops/tomato.lua +++ b/crops/tomato.lua @@ -10,7 +10,7 @@ local S = farming.translate minetest.register_craftitem("farming:tomato", { description = S("Tomato"), inventory_image = "farming_tomato.png", - groups = {seed = 2, food_tomato = 1, flammable = 2}, + groups = {compostability = 65, 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, @@ -46,10 +46,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/crops/vanilla.lua b/crops/vanilla.lua index cb309ac..680f235 100644 --- a/crops/vanilla.lua +++ b/crops/vanilla.lua @@ -5,7 +5,7 @@ local S = farming.translate minetest.register_craftitem("farming:vanilla", { description = S("Vanilla"), inventory_image = "farming_vanilla.png", - groups = {seed = 2, food_vanilla = 1, flammable = 2}, + groups = {compostability = 65, seed = 2, food_vanilla = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:vanilla_1") end, @@ -24,10 +24,10 @@ local def = { waving = 1, selection_box = farming.select, groups = { - snappy = 3, flammable = 2, plant = 1, attached_node = 1, + handy = 1, snappy = 3, flammable = 2, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- vanilla extract @@ -45,7 +45,7 @@ minetest.register_node("farming:vanilla_extract", { fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} }, groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults(), + sounds = farming.sounds.node_sound_glass_defaults(), }) minetest.register_craft( { diff --git a/crops/wheat.lua b/crops/wheat.lua index 99c02a3..9e9b44f 100644 --- a/crops/wheat.lua +++ b/crops/wheat.lua @@ -33,7 +33,7 @@ minetest.register_node("farming:straw", { tiles = {"farming_straw.png"}, is_ground_content = false, groups = {snappy = 3, flammable = 4, fall_damage_add_percent = -30}, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() }) minetest.register_craft({ @@ -59,7 +59,7 @@ if minetest.global_exists("stairs") then {snappy = 3, flammable = 4}, {"farming_straw.png"}, "Straw", - default.node_sound_leaves_defaults()) + farming.sounds.node_sound_leaves_defaults()) else stairs.register_stair_and_slab("straw", "farming:straw", @@ -67,7 +67,7 @@ if minetest.global_exists("stairs") then {"farming_straw.png"}, "Straw Stair", "Straw Slab", - default.node_sound_leaves_defaults()) + farming.sounds.node_sound_leaves_defaults()) end end @@ -169,7 +169,7 @@ local def = { snappy = 3, flammable = 4, plant = 1, attached_node = 1, not_in_creative_inventory = 1, growing = 1 }, - sounds = default.node_sound_leaves_defaults() + sounds = farming.sounds.node_sound_leaves_defaults() } -- stage 1 diff --git a/food.lua b/food.lua index 521c70f..1948b26 100644 --- a/food.lua +++ b/food.lua @@ -74,7 +74,7 @@ minetest.register_node("farming:sugar_cube", { tiles = {"farming_sugar_cube.png"}, groups = {crumbly = 2}, floodable = true, - sounds = default.node_sound_gravel_defaults() + sounds = farming.sounds.node_sound_gravel_defaults() }) minetest.register_craft({ @@ -117,7 +117,7 @@ minetest.register_node("farming:salt", { tiles = {"farming_salt.png"}, groups = {food_salt = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_defaults(), + sounds = farming.sounds.node_sound_defaults(), selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} @@ -185,7 +185,7 @@ minetest.register_node("farming:salt_crystal", { light_source = 1, tiles = {"farming_salt_crystal.png"}, groups = { dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_defaults(), + sounds = farming.sounds.node_sound_defaults(), selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} @@ -228,7 +228,7 @@ minetest.register_node("farming:mayonnaise", { fixed = {-0.25, -0.5, -0.25, 0.25, 0.45, 0.25} }, groups = {food_mayonnaise = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_glass_defaults() + sounds = farming.sounds.node_sound_glass_defaults() }) minetest.register_craft({ @@ -252,7 +252,7 @@ minetest.register_node("farming:rose_water", { tiles = {"farming_rose_water.png"}, groups = {food_rose_water = 1, vessel = 1, dig_immediate = 3, attached_node = 1}, - sounds = default.node_sound_defaults(), + sounds = farming.sounds.node_sound_defaults(), selection_box = { type = "fixed", fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} diff --git a/init.lua b/init.lua index 0260e92..1e1040a 100644 --- a/init.lua +++ b/init.lua @@ -7,7 +7,7 @@ farming = { mod = "redo", - version = "20230814", + version = "20230831", path = minetest.get_modpath("farming"), select = { type = "fixed", @@ -21,10 +21,24 @@ farming = { min_light = 12, max_light = 15, mapgen = minetest.get_mapgen_setting("mg_name"), - use_utensils = minetest.settings:get_bool("farming_use_utensils") ~= false + use_utensils = minetest.settings:get_bool("farming_use_utensils") ~= false, + mtg = minetest.get_modpath("default"), + mcl = minetest.get_modpath("mcl_core"), + sounds = {} } +-- default sound functions just incase +function farming.sounds.node_sound_defaults() end +function farming.sounds.node_sound_leaves_defaults() end +function farming.sounds.node_sound_glass_defaults() end +function farming.sounds.node_sound_wood_defaults() end +function farming.sounds.node_sound_gravel_defaults() end +-- sounds check +if farming.mtg then farming.sounds = default end +if farming.mcl then farming.sounds = mcl_sounds end + +-- check for creative mode or priv local creative_mode_cache = minetest.settings:get_bool("creative_mode") function farming.is_creative(name) @@ -614,7 +628,7 @@ farming.register_plant = function(name, def) drop = drop, selection_box = sel, groups = g, - sounds = default.node_sound_leaves_defaults(), + sounds = farming.sounds.node_sound_leaves_defaults(), minlight = def.minlight, maxlight = def.maxlight, next_plant = next_plant @@ -694,15 +708,34 @@ end -- important items -dofile(farming.path.."/soil.lua") -dofile(farming.path.."/hoes.lua") -dofile(farming.path.."/grass.lua") +if farming.mtg then + dofile(farming.path.."/soil.lua") + dofile(farming.path.."/hoes.lua") + dofile(farming.path.."/grass.lua") +end + +if farming.mcl then + dofile(farming.path.."/mcl_grass.lua") +end + dofile(farming.path.."/utensils.lua") -- default crops -dofile(farming.path.."/crops/wheat.lua") +if farming.mtg then + dofile(farming.path.."/crops/wheat.lua") +end + dofile(farming.path.."/crops/cotton.lua") +-- disable crops Mineclone already has +if farming.mcl then + farming.carrot = nil + farming.potato = nil + farming.melon = nil + farming.cocoa = nil + farming.beetroot = nil + farming.sunflower = nil +end -- helper function local function ddoo(file, check) @@ -754,7 +787,10 @@ ddoo("spinach.lua", farming.eggplant) ddoo("ginger.lua", farming.ginger) dofile(farming.path .. "/food.lua") -dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility + +if farming.mtg then + dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility +end if minetest.get_modpath("lucky_block") then dofile(farming.path .. "/lucky_block.lua") diff --git a/mcl_grass.lua b/mcl_grass.lua new file mode 100644 index 0000000..e80538a --- /dev/null +++ b/mcl_grass.lua @@ -0,0 +1,16 @@ + +-- Override mcl grass and have it drop Wheat and Oat Seeds + +minetest.override_item("mcl_flowers:tallgrass", { + drop = { + max_items = 1, + items = { + {items = {"mcl_farming:wheat_seeds"}, rarity = 5}, + {items = {"farming:seed_oat"},rarity = 5}, + {items = {"farming:seed_barley"}, rarity = 5}, + {items = {"farming:seed_rye"},rarity = 5}, + {items = {"farming:seed_cotton"}, rarity = 8}, + {items = {"farming:seed_rice"},rarity = 8} + } + } +}) diff --git a/mod.conf b/mod.conf index 188dced..c49972b 100644 --- a/mod.conf +++ b/mod.conf @@ -1,5 +1,4 @@ name = farming description = Adds many new plants and food into Minetest. -depends = default -optional_depends = stairs, lucky_block, toolranks +optional_depends = default, mcl_core, mcl_sounds, mcl_farming, mcl_stairs, stairs, lucky_block, toolranks min_minetest_version = 5.0