From 77198100f3bfa57de2d616bee3d2dfd3a48c02a9 Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Mon, 12 Mar 2018 16:45:15 +0000 Subject: [PATCH] added food groups to make items more compatible with other mods --- README.txt | 2 +- barley.lua | 1 + beanpole.lua | 1 + blueberry.lua | 1 + carrot.lua | 1 + chili.lua | 1 + cocoa.lua | 1 + coffee.lua | 1 + compatibility.lua | 5 +++-- corn.lua | 1 + cucumber.lua | 1 + garlic.lua | 5 +++-- grapes.lua | 1 + melon.lua | 6 +++++- onion.lua | 3 ++- pepper.lua | 8 ++++++-- pineapple.lua | 3 ++- potato.lua | 1 + pumpkin.lua | 3 ++- raspberry.lua | 1 + rhubarb.lua | 1 + sugar.lua | 4 +++- tomato.lua | 1 + wheat.lua | 6 +++--- 24 files changed, 44 insertions(+), 15 deletions(-) diff --git a/README.txt b/README.txt index 591fca0..96ae88e 100644 --- a/README.txt +++ b/README.txt @@ -13,7 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t Changelog: -1.31 - Added Pineapple which can be found growing in savannah areas (place pineapple in crafting to obtain 5x rings to eat and a top for re-planting), also Salt which is made from cooking a bucket of water +1.31 - Added Pineapple which can be found growing in savannah areas (place pineapple in crafting to obtain 5x rings to eat and a top for re-planting), also Salt which is made from cooking a bucket of water, added food groups so it's more compatible with Ruben's food mods. 1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures 1.29 - Updating functions so requires Minetest 0.4.16 and above to run 1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge diff --git a/barley.lua b/barley.lua index 8611ee5..66ba071 100644 --- a/barley.lua +++ b/barley.lua @@ -23,6 +23,7 @@ minetest.register_node("farming:seed_barley", { minetest.register_craftitem("farming:barley", { description = S("Barley"), inventory_image = "farming_barley.png", + groups = {food_barley = 1, flammable = 2}, }) -- flour diff --git a/beanpole.lua b/beanpole.lua index 7b01af5..1e81dac 100644 --- a/beanpole.lua +++ b/beanpole.lua @@ -64,6 +64,7 @@ end minetest.register_craftitem("farming:beans", { description = S("Green Beans"), inventory_image = "farming_beans.png", + groups = {food_beans = 1, flammable = 2}, on_use = minetest.item_eat(1), on_place = function(itemstack, placer, pointed_thing) diff --git a/blueberry.lua b/blueberry.lua index 82ce7ff..9936c9b 100644 --- a/blueberry.lua +++ b/blueberry.lua @@ -5,6 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:blueberries", { description = S("Blueberries"), inventory_image = "farming_blueberries.png", + groups = {food_blueberries = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1") end, diff --git a/carrot.lua b/carrot.lua index 9cfcee0..1cfedaa 100644 --- a/carrot.lua +++ b/carrot.lua @@ -10,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1") end, diff --git a/chili.lua b/chili.lua index ec2a1a9..f60eee6 100644 --- a/chili.lua +++ b/chili.lua @@ -5,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1") end, diff --git a/cocoa.lua b/cocoa.lua index b394ab2..c387c3d 100644 --- a/cocoa.lua +++ b/cocoa.lua @@ -59,6 +59,7 @@ end minetest.register_craftitem("farming:cocoa_beans", { description = S("Cocoa Beans"), inventory_image = "farming_cocoa_beans.png", + groups = {food_cocoa_beans = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1") end, diff --git a/coffee.lua b/coffee.lua index f9632d2..917fee9 100644 --- a/coffee.lua +++ b/coffee.lua @@ -5,6 +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_beans = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1") end, diff --git a/compatibility.lua b/compatibility.lua index b7c906c..1beb241 100644 --- a/compatibility.lua +++ b/compatibility.lua @@ -20,7 +20,7 @@ else type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2} }, - groups = {fleshy = 3, dig_immediate = 3, flammable = 2}, + groups = {food_banana = 1, fleshy = 3, dig_immediate = 3, flammable = 2}, on_use = minetest.item_eat(2), sounds = default.node_sound_leaves_defaults(), }) @@ -68,7 +68,7 @@ else type = "fixed", fixed = {-0.2, -0.3, -0.2, 0.2, 0.2, 0.2} }, - groups = {fleshy = 3, dig_immediate = 3, flammable = 2}, + groups = {food_orange = 1, fleshy = 3, dig_immediate = 3, flammable = 2}, on_use = minetest.item_eat(4), sounds = default.node_sound_leaves_defaults(), }) @@ -118,6 +118,7 @@ else description = "Strawberry", inventory_image = "strawberry.png", wield_image = "strawberry.png", + groups = {food_strawberry = 1, flammable = 2}, on_use = minetest.item_eat(1), }) diff --git a/corn.lua b/corn.lua index 1149a00..5a6ce75 100644 --- a/corn.lua +++ b/corn.lua @@ -10,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1") end, diff --git a/cucumber.lua b/cucumber.lua index eb29347..4e6981c 100644 --- a/cucumber.lua +++ b/cucumber.lua @@ -10,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1") end, diff --git a/garlic.lua b/garlic.lua index ffbf3ec..6f80f5e 100644 --- a/garlic.lua +++ b/garlic.lua @@ -11,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1") end, @@ -21,7 +22,7 @@ minetest.register_craftitem("farming:garlic", { description = S("Garlic"), inventory_image = "crops_garlic.png", on_use = minetest.item_eat(1), - groups = {garlic = 1}, + groups = {food_garlic = 1, garlic = 1, flammable = 3}, }) minetest.register_craft({ @@ -52,7 +53,7 @@ minetest.register_node("farming:garlic_braid", { "crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png", "crops_garlic_braid.png","crops_garlic_braid.png" }, - groups = {vessel = 1, dig_immediate = 3}, + groups = {vessel = 1, dig_immediate = 3, flammable = 3}, sounds = default.node_sound_leaves_defaults(), node_box = { type = "fixed", diff --git a/grapes.lua b/grapes.lua index f13b4a1..9a6ab9e 100644 --- a/grapes.lua +++ b/grapes.lua @@ -60,6 +60,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}, on_place = function(itemstack, placer, pointed_thing) return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1") diff --git a/melon.lua b/melon.lua index e2f6564..2165558 100644 --- a/melon.lua +++ b/melon.lua @@ -5,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1") end, @@ -77,6 +78,9 @@ crop_def.description = S("Melon") crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"} crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5} crop_def.walkable = true -crop_def.groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1} +crop_def.groups = { + food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1, + flammable = 2, plant = 1 +} crop_def.drop = "farming:melon_slice 9" minetest.register_node("farming:melon_8", table.copy(crop_def)) diff --git a/onion.lua b/onion.lua index bf8737a..21b5c2e 100644 --- a/onion.lua +++ b/onion.lua @@ -11,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1") end, @@ -59,7 +60,7 @@ crop_def.drop = { max_items = 5, items = { {items = {'farming:onion'}, rarity = 1}, {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}, } diff --git a/pepper.lua b/pepper.lua index 630c5b4..a471015 100644 --- a/pepper.lua +++ b/pepper.lua @@ -11,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1") end, @@ -21,7 +22,7 @@ minetest.register_craftitem("farming:pepper", { description = S("Pepper"), inventory_image = "crops_pepper.png", on_use = minetest.item_eat(2), - groups = {pepper = 1}, + groups = {food_pepper = 1, pepper = 1, flammable = 3}, }) minetest.register_craft({ @@ -38,7 +39,10 @@ minetest.register_node("farming:pepper_ground", { drawtype = "plantlike", paramtype = "light", tiles = {"crops_pepper_ground.png"}, - groups = {vessel = 1, pepper_ground = 1, dig_immediate = 3, attached_node = 1}, + groups = { + vessel = 1, food_pepper_ground = 1, pepper_ground = 1, + dig_immediate = 3, attached_node = 1 + }, sounds = default.node_sound_glass_defaults(), selection_box = { type = "fixed", diff --git a/pineapple.lua b/pineapple.lua index 2e7f5b7..77047be 100644 --- a/pineapple.lua +++ b/pineapple.lua @@ -24,13 +24,14 @@ minetest.register_node("farming:pineapple", { type = "fixed", fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27} }, - groups = {fleshy = 3, dig_immediate = 3, flammable = 2}, + groups = {food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2}, }) -- pineapple minetest.register_craftitem("farming:pineapple_ring", { description = S("Pineapple Ring"), inventory_image = "farming_pineapple_ring.png", + groups = {food_pineapple_ring = 1, flammable = 2}, on_use = minetest.item_eat(1), }) diff --git a/potato.lua b/potato.lua index be36905..5e7d431 100644 --- a/potato.lua +++ b/potato.lua @@ -10,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1") end, diff --git a/pumpkin.lua b/pumpkin.lua index 8bff778..488767f 100644 --- a/pumpkin.lua +++ b/pumpkin.lua @@ -14,7 +14,7 @@ minetest.register_node("farming:pumpkin", { "farming_pumpkin_side.png" }, groups = { - choppy = 1, oddly_breakable_by_hand = 1, + food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1, flammable = 2, plant = 1 }, drop = { @@ -29,6 +29,7 @@ minetest.register_node("farming:pumpkin", { minetest.register_craftitem("farming:pumpkin_slice", { description = S("Pumpkin Slice"), inventory_image = "farming_pumpkin_slice.png", + groups = {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, diff --git a/raspberry.lua b/raspberry.lua index 384eb59..969d1e2 100644 --- a/raspberry.lua +++ b/raspberry.lua @@ -5,6 +5,7 @@ local S = farming.intllib minetest.register_craftitem("farming:raspberries", { description = S("Raspberries"), inventory_image = "farming_raspberries.png", + groups = {food_raspberries = 1, flammable = 2}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") end, diff --git a/rhubarb.lua b/rhubarb.lua index 30e9fba..9f9fe58 100644 --- a/rhubarb.lua +++ b/rhubarb.lua @@ -5,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1") end, diff --git a/sugar.lua b/sugar.lua index 012a987..11b6461 100644 --- a/sugar.lua +++ b/sugar.lua @@ -6,6 +6,7 @@ local S = farming.intllib minetest.register_craftitem("farming:sugar", { description = S("Sugar"), inventory_image = "farming_sugar.png", + groups = {food_sugar = 1, flammable = 3}, }) minetest.register_craft({ @@ -25,7 +26,8 @@ minetest.register_node("farming:salt", { drawtype = "plantlike", paramtype = "light", tiles = {"farming_salt.png"}, - groups = {vessel = 1, salt = 1, dig_immediate = 3, attached_node = 1}, + groups = {food_salt = 1, salt = 1, vessel = 1, dig_immediate = 3, + attached_node = 1}, sounds = default.node_sound_glass_defaults(), selection_box = { type = "fixed", diff --git a/tomato.lua b/tomato.lua index 1ed7870..53012a8 100644 --- a/tomato.lua +++ b/tomato.lua @@ -10,6 +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}, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1") end, diff --git a/wheat.lua b/wheat.lua index 79988b6..494b543 100644 --- a/wheat.lua +++ b/wheat.lua @@ -23,7 +23,7 @@ minetest.register_node("farming:seed_wheat", { minetest.register_craftitem("farming:wheat", { description = S("Wheat"), inventory_image = "farming_wheat.png", - groups = {flammable = 4}, + groups = {food_wheat = 1, flammable = 4}, }) -- straw @@ -55,7 +55,7 @@ minetest.register_craft({ minetest.register_craftitem("farming:flour", { description = S("Flour"), inventory_image = "farming_flour.png", - groups = {flammable = 1}, + groups = {food_flour = 1, flammable = 1}, }) minetest.register_craft({ @@ -69,7 +69,7 @@ minetest.register_craftitem("farming:bread", { description = S("Bread"), inventory_image = "farming_bread.png", on_use = minetest.item_eat(5), - groups = {flammable = 2}, + groups = {food_bread = 1, flammable = 2}, }) minetest.register_craft({