1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-12-26 10:40:20 +01:00

tidy code

This commit is contained in:
tenplus1 2024-07-27 08:23:46 +01:00
parent 75e3f9fb42
commit b61998217d
39 changed files with 59 additions and 62 deletions

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:artichoke", {
description = S("Artichoke"),
inventory_image = "farming_artichoke.png",
groups = {
compostability = 48, seed = 2, food_artichoke = 1, flammable = 2
compostability = 48, seed = 2, food_artichoke = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1")

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:asparagus", {
description = S("Asparagus"),
inventory_image = "farming_asparagus.png",
groups = {
compostability = 48, seed = 2, food_asparagus = 1, flammable = 2
compostability = 48, seed = 2, food_asparagus = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1")

View File

@ -72,7 +72,7 @@ end
minetest.register_craftitem("farming:beans", {
description = S("Green Beans"),
inventory_image = "farming_beans.png",
groups = {compostability = 48, seed = 2, food_beans = 1, flammable = 2},
groups = {compostability = 48, seed = 2, food_beans = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:beetroot", {
description = S("Beetroot"),
inventory_image = "farming_beetroot.png",
groups = {
compostability = 48, seed = 2, food_beetroot = 1, flammable = 2
compostability = 48, seed = 2, food_beetroot = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1")
@ -21,7 +21,6 @@ farming.add_eatable("farming:beetroot", 1)
minetest.register_craftitem("farming:beetroot_soup", {
description = S("Beetroot Soup"),
inventory_image = "farming_beetroot_soup.png",
groups = {flammable = 2},
on_use = minetest.item_eat(6, "farming:bowl")
})

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:blackberry", {
inventory_image = "farming_blackberry.png",
groups = {
compostability = 48, seed = 2, food_blackberries = 1, food_blackberry = 1,
food_berry = 1, flammable = 2
food_berry = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1")

View File

@ -8,7 +8,7 @@ minetest.register_craftitem("farming:blueberries", {
inventory_image = "farming_blueberries.png",
groups = {
compostability = 48,seed = 2, food_blueberries = 1, food_blueberry = 1,
food_berry = 1, flammable = 2
food_berry = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:cabbage", {
description = S("Cabbage"),
inventory_image = "farming_cabbage.png",
groups = {
compostability = 48, seed = 2, food_cabbage = 1, flammable = 2
compostability = 48, seed = 2, food_cabbage = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1")

View File

@ -12,7 +12,7 @@ minetest.register_craftitem("farming:carrot", {
description = S("Carrot"),
inventory_image = "farming_carrot.png",
groups = {
compostability = 48, seed = 2, food_carrot = 1, flammable = 2
compostability = 48, seed = 2, food_carrot = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
@ -48,8 +48,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(10),
groups = {flammable = 2}
on_use = minetest.item_eat(10)
})
farming.add_eatable("farming:carrot_gold", 10)

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:chili_pepper", {
description = S("Chili Pepper"),
inventory_image = "farming_chili_pepper.png",
groups = {
compostability = 48, seed = 2, food_chili_pepper = 1, flammable = 4
compostability = 48, seed = 2, food_chili_pepper = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")

View File

@ -96,8 +96,7 @@ minetest.register_craft( {
minetest.register_craftitem("farming:cookie", {
description = S("Cookie"),
inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2),
groups = {flammable = 2}
on_use = minetest.item_eat(2)
})
farming.add_eatable("farming:cookie", 2)
@ -113,8 +112,7 @@ minetest.register_craft( {
minetest.register_craftitem("farming:chocolate_dark", {
description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(3),
groups = {flammable = 2}
on_use = minetest.item_eat(3)
})
farming.add_eatable("farming:chocolate_dark", 3)

View File

@ -12,7 +12,7 @@ minetest.register_craftitem("farming:corn", {
description = S("Corn"),
inventory_image = "farming_corn.png",
groups = {
compostability = 45, seed = 2, food_corn = 1, flammable = 2
compostability = 45, seed = 2, food_corn = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
@ -26,7 +26,7 @@ farming.add_eatable("farming:corn", 3)
minetest.register_craftitem("farming:corn_cob", {
description = S("Corn on the Cob"),
inventory_image = "farming_corn_cob.png",
groups = {compostability = 65, food_corn_cooked = 1, flammable = 2},
groups = {compostability = 65, food_corn_cooked = 1},
on_use = minetest.item_eat(5)
})
@ -43,7 +43,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:popcorn", {
description = S("Popcorn"),
inventory_image = "farming_popcorn.png",
groups = {compostability = 55, food_popcorn = 1, flammable = 2},
groups = {compostability = 55, food_popcorn = 1},
on_use = minetest.item_eat(4)
})

View File

@ -11,7 +11,7 @@ minetest.register_craftitem("farming:cucumber", {
description = S("Cucumber"),
inventory_image = "farming_cucumber.png",
groups = {
compostability = 48, seed = 2, food_cucumber = 1, flammable = 2
compostability = 48, seed = 2, food_cucumber = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:eggplant", {
description = S("Eggplant"),
inventory_image = "farming_eggplant.png",
groups = {
compostability = 48, seed = 2, food_eggplant = 1, flammable = 2
compostability = 48, seed = 2, food_eggplant = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1")

View File

@ -16,7 +16,7 @@ minetest.register_craftitem("farming:garlic", {
description = S("Garlic"),
inventory_image = "crops_garlic.png",
on_use = minetest.item_eat(1),
groups = {food_garlic = 1, flammable = 3, compostability = 55}
groups = {food_garlic = 1, compostability = 55}
})
farming.add_eatable("farming:garlic", 1)

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:ginger", {
description = S("Ginger"),
inventory_image = "farming_ginger.png",
groups = {
compostability = 48, seed = 2, food_ginger = 1, flammable = 2
compostability = 48, seed = 2, food_ginger = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1")

View File

@ -69,7 +69,7 @@ minetest.register_craftitem("farming:grapes", {
inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2),
groups = {
compostability = 48, seed = 2, food_grapes = 1, flammable = 3
compostability = 48, seed = 2, food_grapes = 1
},
on_place = function(itemstack, placer, pointed_thing)
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:lettuce", {
description = S("Lettuce"),
inventory_image = "farming_lettuce.png",
groups = {
compostability = 48, seed = 2, food_lettuce = 1, flammable = 2
compostability = 48, seed = 2, food_lettuce = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1")

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:melon_slice", {
description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png",
groups = {
compostability = 48, seed = 2, food_melon_slice = 1, flammable = 3
compostability = 48, seed = 2, food_melon_slice = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")

View File

@ -40,8 +40,7 @@ minetest.register_craftitem("farming:mint_leaf", {
minetest.register_craftitem("farming:mint_tea", {
description = S("Mint Tea"),
inventory_image = "farming_mint_tea.png",
on_use = minetest.item_eat(2, a.drinking_glass),
groups = {flammable = 4}
on_use = minetest.item_eat(2, a.drinking_glass)
})
farming.add_eatable("farming:mint_tea", 2)

View File

@ -13,7 +13,7 @@ minetest.register_craftitem("farming:onion", {
description = S("Onion"),
inventory_image = "crops_onion.png",
groups = {
compostability = 48, seed = 2, food_onion = 1, flammable = 3
compostability = 48, seed = 2, food_onion = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
@ -27,7 +27,7 @@ farming.add_eatable("farming:onion", 1)
minetest.register_craftitem("farming:onion_soup", {
description = S("Onion Soup"),
inventory_image = "farming_onion_soup.png",
groups = {flammable = 2, compostability = 65},
groups = {compostability = 65},
on_use = minetest.item_eat(6, a.bowl)
})

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:parsley", {
description = S("Parsley"),
inventory_image = "farming_parsley.png",
groups = {
compostability = 48, seed = 2, food_parsley = 1, flammable = 2
compostability = 48, seed = 2, food_parsley = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1")

View File

@ -9,7 +9,7 @@ minetest.register_craftitem("farming:pea_pod", {
description = S("Pea Pod"),
inventory_image = "farming_pea_pod.png",
groups = {
compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1, flammable = 2
compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
@ -26,7 +26,7 @@ minetest.register_alias("farming:peas", "farming:pea_pod")
minetest.register_craftitem("farming:pea_soup", {
description = S("Pea Soup"),
inventory_image = "farming_pea_soup.png",
groups = {flammable = 2, compostability = 65},
groups = {compostability = 65},
on_use = minetest.item_eat(4, a.bowl)
})

View File

@ -23,7 +23,7 @@ minetest.register_craftitem("farming:pepper", {
description = S("Green Pepper"),
inventory_image = "crops_pepper.png",
on_use = minetest.item_eat(2),
groups = {food_pepper = 1, flammable = 3, compostability = 55}
groups = {food_pepper = 1, compostability = 55}
})
farming.add_eatable("farming:pepper", 2)
@ -33,7 +33,7 @@ minetest.register_craftitem("farming:pepper_yellow", {
description = S("Yellow Pepper"),
inventory_image = "crops_pepper_yellow.png",
on_use = minetest.item_eat(3),
groups = {food_pepper = 1, flammable = 3, compostability = 55}
groups = {food_pepper = 1, compostability = 55}
})
farming.add_eatable("farming:pepper_yellow", 3)
@ -43,10 +43,10 @@ minetest.register_craftitem("farming:pepper_red", {
description = S("Red Pepper"),
inventory_image = "crops_pepper_red.png",
on_use = minetest.item_eat(4),
groups = {food_pepper = 1, flammable = 3, compostability = 55}
groups = {food_pepper = 1, compostability = 55}
})
farming.add_eatable("farming:pepper_red", 3)
farming.add_eatable("farming:pepper_red", 4)
minetest.register_craft({
output = "farming:peppercorn",

View File

@ -38,7 +38,7 @@ minetest.register_node("farming:pineapple", {
minetest.register_craftitem("farming:pineapple_ring", {
description = S("Pineapple Ring"),
inventory_image = "farming_pineapple_ring.png",
groups = {food_pineapple_ring = 1, flammable = 2, compostability = 45},
groups = {food_pineapple_ring = 1, compostability = 45},
on_use = minetest.item_eat(1)
})

View File

@ -10,7 +10,7 @@ local S = farming.translate
minetest.register_craftitem("farming:potato", {
description = S("Potato"),
inventory_image = "farming_potato.png",
groups = {compostability = 48, seed = 2, food_potato = 1, flammable = 2},
groups = {compostability = 48, seed = 2, food_potato = 1},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
end,
@ -32,8 +32,7 @@ farming.add_eatable("farming:potato", 1)
minetest.register_craftitem("farming:baked_potato", {
description = S("Baked Potato"),
inventory_image = "farming_baked_potato.png",
on_use = minetest.item_eat(6),
groups = {flammable = 2}
on_use = minetest.item_eat(6)
})
farming.add_eatable("farming:baked_potato", 6)
@ -49,8 +48,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:potato_salad", {
description = S("Cucumber and Potato Salad"),
inventory_image = "farming_potato_salad.png",
on_use = minetest.item_eat(10, "farming:bowl"),
groups = {flammable = 2}
on_use = minetest.item_eat(10, "farming:bowl")
})
farming.add_eatable("farming:potato_salad", 10)

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:pumpkin_slice", {
description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png",
groups = {
compostability = 48, seed = 2, food_pumpkin_slice = 1, flammable = 2
compostability = 48, seed = 2, food_pumpkin_slice = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
@ -130,7 +130,7 @@ minetest.register_craftitem("farming:pumpkin_bread", {
description = S("Pumpkin Bread"),
inventory_image = "farming_pumpkin_bread.png",
on_use = minetest.item_eat(8),
groups = {food_bread = 1, flammable = 2}
groups = {food_bread = 1}
})
farming.add_eatable("farming:pumpkin_bread", 8)

View File

@ -8,7 +8,7 @@ minetest.register_craftitem("farming:raspberries", {
inventory_image = "farming_raspberries.png",
groups = {
compostability = 48, seed = 2, food_raspberries = 1, food_raspberry = 1,
food_berry = 1, flammable = 2
food_berry = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1")

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
groups = {
compostability = 48, seed = 2, food_rhubarb = 1, flammable = 2
compostability = 48, seed = 2, food_rhubarb = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
@ -22,7 +22,7 @@ minetest.register_craftitem("farming:rhubarb_pie", {
description = S("Rhubarb Pie"),
inventory_image = "farming_rhubarb_pie.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65, flammable = 2}
groups = {compostability = 65}
})
farming.add_eatable("farming:rhubarb_pie", 6)

View File

@ -49,7 +49,7 @@ minetest.register_craftitem("farming:rice_bread", {
description = S("Rice Bread"),
inventory_image = "farming_rice_bread.png",
on_use = minetest.item_eat(5),
groups = {food_rice_bread = 1, flammable = 2, compostability = 65}
groups = {food_rice_bread = 1, compostability = 65}
})
farming.add_eatable("farming:rice_bread", 5)

View File

@ -84,7 +84,7 @@ minetest.register_craftitem("farming:bread_multigrain", {
description = S("Multigrain Bread"),
inventory_image = "farming_bread_multigrain.png",
on_use = minetest.item_eat(7),
groups = {food_bread = 1, flammable = 2, compostability = 65}
groups = {food_bread = 1, compostability = 65}
})
farming.add_eatable("farming:bread_multigrain", 7)

View File

@ -90,7 +90,7 @@ minetest.register_craftitem("farming:tofu", {
description = S("Tofu"),
inventory_image = "farming_tofu.png",
groups = {
food_tofu = 1, food_meat_raw = 1, flammable = 2, compostability = 65,
food_tofu = 1, food_meat_raw = 1, compostability = 65,
},
on_use = minetest.item_eat(3)
})
@ -110,7 +110,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:tofu_cooked", {
description = S("Cooked Tofu"),
inventory_image = "farming_tofu_cooked.png",
groups = {food_meat = 1, flammable = 2, compostability = 65},
groups = {food_meat = 1, compostability = 65},
on_use = minetest.item_eat(6)
})

View File

@ -6,7 +6,7 @@ minetest.register_craftitem("farming:spinach", {
description = S("Spinach"),
inventory_image = "farming_spinach.png",
groups = {
compostability = 48, seed = 2, food_spinach = 1, flammable = 2
compostability = 48, seed = 2, food_spinach = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1")

View File

@ -6,7 +6,7 @@ minetest.register_craftitem(":ethereal:strawberry", {
description = S("Strawberry"),
inventory_image = "ethereal_strawberry.png",
groups = {
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1, flammable = 2
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1")

View File

@ -48,7 +48,7 @@ minetest.register_craftitem("farming:sunflower_seeds_toasted", {
description = S("Toasted Sunflower Seeds"),
inventory_image = "farming_sunflower_seeds_toasted.png",
groups = {
food_sunflower_seeds_toasted = 1, flammable = 2, compostability = 65
food_sunflower_seeds_toasted = 1, compostability = 65
},
on_use = minetest.item_eat(1)
})
@ -104,7 +104,7 @@ minetest.register_craftitem("farming:sunflower_bread", {
description = S("Sunflower Seed Bread"),
inventory_image = "farming_sunflower_bread.png",
on_use = minetest.item_eat(8),
groups = {food_bread = 1, flammable = 2}
groups = {food_bread = 1}
})
farming.add_eatable("farming:sunflower_bread", 8)

View File

@ -10,7 +10,7 @@ local S = farming.translate
minetest.register_craftitem("farming:tomato", {
description = S("Tomato"),
inventory_image = "farming_tomato.png",
groups = {compostability = 45, seed = 2, food_tomato = 1, flammable = 2},
groups = {compostability = 45, seed = 2, food_tomato = 1},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
end,
@ -23,7 +23,7 @@ farming.add_eatable("farming:tomato", 4)
minetest.register_craftitem("farming:tomato_soup", {
description = S("Tomato Soup"),
inventory_image = "farming_tomato_soup.png",
groups = {flammable = 2, compostability = 65},
groups = {compostability = 65},
on_use = minetest.item_eat(8, "farming:bowl")
})

View File

@ -7,7 +7,7 @@ minetest.register_craftitem("farming:vanilla", {
description = S("Vanilla"),
inventory_image = "farming_vanilla.png",
groups = {
compostability = 48, seed = 2, food_vanilla = 1, flammable = 2
compostability = 48, seed = 2, food_vanilla = 1
},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:vanilla_1")

View File

@ -102,7 +102,7 @@ minetest.register_craftitem("farming:bread", {
description = S("Bread"),
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(5),
groups = {food_bread = 1, flammable = 2}
groups = {food_bread = 1}
})
farming.add_eatable("farming:bread", 5)

View File

@ -308,6 +308,8 @@ minetest.register_node("farming:mayonnaise", {
sounds = farming.sounds.node_sound_glass_defaults()
})
farming.add_eatable("farming:mayonnaise", 3)
minetest.register_craft({
output = "farming:mayonnaise",
recipe = {

View File

@ -7,7 +7,7 @@
farming = {
mod = "redo",
version = "20240726",
version = "20240727",
path = minetest.get_modpath("farming"),
select = {
type = "fixed",
@ -777,11 +777,13 @@ function farming.add_eatable(item, hp)
if def then
local grps = def.groups or {}
local txt = " (" ; if hp > 0 then txt = txt .. "+" end
txt = txt .. hp .. " HP)"
grps.eatable = hp ; grps.flammable = 2
if mod_tt_base == nil then
def.description = def.description .. " (♥" .. hp .. ")"
def.description = def.description .. txt
end
minetest.override_item(item, {description = def.description, groups = grps})