1
0
mirror of https://codeberg.org/tenplus1/farming.git synced 2024-11-10 20:30:31 +01:00

separate food /non-food items from crop files, tidy code

This commit is contained in:
tenplus1 2024-08-11 15:38:55 +01:00
parent cdac09a8f4
commit a9a1b720a3
57 changed files with 3691 additions and 3271 deletions

View File

@ -1,5 +1,5 @@
local S = farming.translate
local S = minetest.get_translator("farming")
--= Helpers
@ -18,6 +18,7 @@ farming.add_eatable("flowers:mushroom_red", -5)
--= Aliases
-- Banana
if eth then
alias("farming_plus:banana_sapling", "ethereal:banana_tree_sapling")
alias("farming_plus:banana_leaves", "ethereal:bananaleaves")
@ -64,6 +65,7 @@ else
end
-- Carrot
alias("farming_plus:carrot_seed", "farming:carrot")
alias("farming_plus:carrot_1", "farming:carrot_1")
alias("farming_plus:carrot_2", "farming:carrot_4")
@ -72,12 +74,14 @@ alias("farming_plus:carrot", "farming:carrot_8")
alias("farming_plus:carrot_item", "farming:carrot")
-- Cocoa
alias("farming_plus:cocoa_sapling", "farming:cocoa_beans")
alias("farming_plus:cocoa_leaves", "default:leaves")
alias("farming_plus:cocoa", "default:apple")
alias("farming_plus:cocoa_bean", "farming:cocoa_beans")
-- Orange
alias("farming_plus:orange_1", "farming:tomato_1")
alias("farming_plus:orange_2", "farming:tomato_4")
alias("farming_plus:orange_3", "farming:tomato_6")
@ -116,6 +120,7 @@ else
end
-- Potato
alias("farming_plus:potato_item", "farming:potato")
alias("farming_plus:potato_1", "farming:potato_1")
alias("farming_plus:potato_2", "farming:potato_2")
@ -123,6 +128,7 @@ alias("farming_plus:potato", "farming:potato_3")
alias("farming_plus:potato_seed", "farming:potato")
-- Pumpkin
alias("farming:pumpkin_seed", "farming:pumpkin_slice")
alias("farming:pumpkin_face", "farming:jackolantern")
alias("farming:pumpkin_face_light", "farming:jackolantern_on")
@ -135,6 +141,7 @@ alias("farming:scarecrow_light", "farming:jackolantern_on")
alias("farming:pumpkin_flour", "farming:pumpkin_dough")
-- Rhubarb
alias("farming_plus:rhubarb_seed", "farming:rhubarb")
alias("farming_plus:rhubarb_1", "farming:rhubarb_1")
alias("farming_plus:rhubarb_2", "farming:rhubarb_2")
@ -142,6 +149,7 @@ alias("farming_plus:rhubarb", "farming:rhubarb_3")
alias("farming_plus:rhubarb_item", "farming:rhubarb")
-- Strawberry
alias("farming_plus:strawberry_item", "ethereal:strawberry")
alias("farming_plus:strawberry_seed", "ethereal:strawberry")
alias("farming_plus:strawberry_1", "ethereal:strawberry_1")
@ -150,6 +158,7 @@ alias("farming_plus:strawberry_3", "ethereal:strawberry_5")
alias("farming_plus:strawberry", "ethereal:strawberry_7")
-- Tomato
alias("farming_plus:tomato_seed", "farming:tomato")
alias("farming_plus:tomato_item", "farming:tomato")
alias("farming_plus:tomato_1", "farming:tomato_2")
@ -157,5 +166,6 @@ alias("farming_plus:tomato_2", "farming:tomato_4")
alias("farming_plus:tomato_3", "farming:tomato_6")
alias("farming_plus:tomato", "farming:tomato_8")
-- Weed
-- Weeds
alias("farming:weed", "default:grass_2")

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- item definition
minetest.register_craftitem("farming:artichoke", {
description = S("Artichoke"),
inventory_image = "farming_artichoke.png",
groups = {
compostability = 48, seed = 2, food_artichoke = 1
},
groups = {compostability = 48, seed = 2, food_artichoke = 1},
on_use = minetest.item_eat(4),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:artichoke_1")
end,
on_use = minetest.item_eat(4)
end
})
farming.add_eatable("farming:artichoke", 4)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_artichoke_1.png"},
@ -37,21 +38,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:artichoke_1", table.copy(def))
-- stage 2
def.tiles = {"farming_artichoke_2.png"}
minetest.register_node("farming:artichoke_2", table.copy(def))
-- stage 3
def.tiles = {"farming_artichoke_3.png"}
minetest.register_node("farming:artichoke_3", table.copy(def))
-- stage 4
def.tiles = {"farming_artichoke_4.png"}
minetest.register_node("farming:artichoke_4", table.copy(def))
-- stage 5 (final)
def.tiles = {"farming_artichoke_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -64,6 +70,7 @@ def.drop = {
minetest.register_node("farming:artichoke_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:artichoke"] = {
crop = "farming:artichoke",
seed = "farming:artichoke",
@ -73,6 +80,7 @@ farming.registered_plants["farming:artichoke"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- asparagus
minetest.register_craftitem("farming:asparagus", {
description = S("Asparagus"),
inventory_image = "farming_asparagus.png",
groups = {
compostability = 48, seed = 2, food_asparagus = 1
},
groups = {compostability = 48, seed = 2, food_asparagus = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:asparagus_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:asparagus", 1)
-- asparagus definition
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_asparagus_1.png"},
@ -39,17 +40,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:asparagus_1", table.copy(def))
-- stage 2
def.tiles = {"farming_asparagus_2.png"}
minetest.register_node("farming:asparagus_2", table.copy(def))
-- stage 3
def.tiles = {"farming_asparagus_3.png"}
minetest.register_node("farming:asparagus_3", table.copy(def))
-- stage 4
def.tiles = {"farming_asparagus_4.png"}
def.drop = {
items = {
@ -58,7 +63,8 @@ def.drop = {
}
minetest.register_node("farming:asparagus_4", table.copy(def))
-- stage 5
-- stage 5 (final)
def.tiles = {"farming_asparagus_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -71,6 +77,7 @@ def.drop = {
minetest.register_node("farming:asparagus_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:asparagus"] = {
crop = "farming:asparagus",
seed = "farming:asparagus",
@ -80,6 +87,7 @@ farming.registered_plants["farming:asparagus"] = {
}
-- mapgen
minetest.register_decoration({
name = "farming:asparagus_5",
deco_type = "simple",

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- barley seeds
minetest.register_node("farming:seed_barley", {
description = S("Barley Seed"),
tiles = {"farming_barley_seed.png"},
@ -21,32 +21,26 @@ minetest.register_node("farming:seed_barley", {
sunlight_propagates = true,
next_plant = "farming:barley_1",
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_barley")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:barley_1", param2 = 3})
end
})
-- harvested barley
-- item
minetest.register_craftitem("farming:barley", {
description = S("Barley"),
inventory_image = "farming_barley.png",
groups = {food_barley = 1, flammable = 2, compostability = 65}
})
-- flour
minetest.register_craft({
output = "farming:flour",
recipe = {
{"farming:barley", "farming:barley", "farming:barley"},
{"farming:barley", a.mortar_pestle, ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- crop definition
-- barley definition
local def = {
drawtype = "plantlike",
tiles = {"farming_barley_1.png"},
@ -69,25 +63,31 @@ local def = {
}
-- stage 1
minetest.register_node("farming:barley_1", table.copy(def))
-- stage 2
def.tiles = {"farming_barley_2.png"}
minetest.register_node("farming:barley_2", table.copy(def))
-- stage 3
def.tiles = {"farming_barley_3.png"}
minetest.register_node("farming:barley_3", table.copy(def))
-- stage 4
def.tiles = {"farming_barley_4.png"}
minetest.register_node("farming:barley_4", table.copy(def))
-- stage 5
def.tiles = {"farming_barley_5.png"}
minetest.register_node("farming:barley_5", table.copy(def))
-- stage 6
def.tiles = {"farming_barley_6.png"}
def.drop = {
items = {
@ -98,6 +98,7 @@ def.drop = {
minetest.register_node("farming:barley_6", table.copy(def))
-- stage 7
def.tiles = {"farming_barley_7.png"}
def.drop = {
items = {
@ -108,6 +109,7 @@ def.drop = {
minetest.register_node("farming:barley_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_barley_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -122,6 +124,7 @@ def.drop = {
minetest.register_node("farming:barley_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:barley"] = {
crop = "farming:barley",
seed = "farming:seed_barley",
@ -129,10 +132,3 @@ farming.registered_plants["farming:barley"] = {
maxlight = farming.max_light,
steps = 8
}
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "farming:barley",
burntime = 1
})

View File

@ -1,32 +1,27 @@
--[[
All textures by
(C) Auke Kok <sofar@foo-projects.org>
CC-BY-SA-3.0
]]
local S = farming.translate
-- All textures by (C) Auke Kok <sofar@foo-projects.org> CC-BY-SA-3.0
local S = minetest.get_translator("farming")
local a = farming.recipe_items
-- place beans
-- place beans helper
local function place_beans(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
if not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[under.name] then return end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and itemstack and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -35,19 +30,15 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
return
end
if minetest.is_protected(pt.under, name) then return end
-- check if pointing at bean pole
if under.name ~= "farming:beanpole" then
return
end
if under.name ~= "farming:beanpole" then return end
-- add the node and remove 1 item from the itemstack
minetest.set_node(pt.under, {name = plantname})
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}, true)
if placer or not farming.is_creative(placer:get_player_name()) then
@ -57,23 +48,21 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:beans",
placer:get_wield_index()
)
farming.refill_plant, placer, "farming:beans", placer:get_wield_index())
end
end
return itemstack
end
-- beans
-- item/seed
minetest.register_craftitem("farming:beans", {
description = S("Green Beans"),
inventory_image = "farming_beans.png",
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")
end
@ -81,13 +70,8 @@ minetest.register_craftitem("farming:beans", {
farming.add_eatable("farming:beans", 1)
-- beans can be used for green dye
minetest.register_craft({
output = a.dye_green,
recipe = {{"farming:beans"}}
})
-- beanpole
minetest.register_node("farming:beanpole", {
description = S("Bean Pole (place on soil before planting beans)"),
drawtype = "plantlike",
@ -109,20 +93,17 @@ minetest.register_node("farming:beanpole", {
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
if not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[under.name] then return end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -133,9 +114,7 @@ minetest.register_node("farming:beanpole", {
local nodename = under.name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
if minetest.get_item_group(nodename, "soil") < 2 then return end
local top = {
x = pointed_thing.above.x,
@ -145,9 +124,7 @@ minetest.register_node("farming:beanpole", {
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
if nodename ~= "air" then return end
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
@ -159,22 +136,8 @@ minetest.register_node("farming:beanpole", {
end
})
minetest.register_craft({
output = "farming:beanpole",
recipe = {
{"", "", ""},
{"group:stick", "", "group:stick"},
{"group:stick", "", "group:stick"}
}
})
-- crop definition
minetest.register_craft({
type = "fuel",
recipe = "farming:beanpole",
burntime = 10
})
-- green bean definition
local def = {
drawtype = "plantlike",
tiles = {"farming_beanpole_1.png"},
@ -199,21 +162,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:beanpole_1", table.copy(def))
-- stage2
def.tiles = {"farming_beanpole_2.png"}
minetest.register_node("farming:beanpole_2", table.copy(def))
-- stage 3
def.tiles = {"farming_beanpole_3.png"}
minetest.register_node("farming:beanpole_3", table.copy(def))
-- stage 4
def.tiles = {"farming_beanpole_4.png"}
minetest.register_node("farming:beanpole_4", table.copy(def))
-- stage 5 (final)
def.tiles = {"farming_beanpole_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -228,6 +196,7 @@ def.drop = {
minetest.register_node("farming:beanpole_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:beans"] = {
trellis = "farming:beanpole",
crop = "farming:beanpole",
@ -238,6 +207,7 @@ farming.registered_plants["farming:beans"] = {
}
-- wild green bean bush (this is what you find on the map)
minetest.register_node("farming:beanbush", {
drawtype = "plantlike",
tiles = {"farming_beanbush.png"},
@ -263,6 +233,7 @@ minetest.register_node("farming:beanbush", {
})
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,44 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
local a = farming.recipe_items
-- beetroot
-- item/seed
minetest.register_craftitem("farming:beetroot", {
description = S("Beetroot"),
inventory_image = "farming_beetroot.png",
groups = {
compostability = 48, seed = 2, food_beetroot = 1
},
groups = {compostability = 48, seed = 2, food_beetroot = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:beetroot_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:beetroot", 1)
-- beetroot soup
minetest.register_craftitem("farming:beetroot_soup", {
description = S("Beetroot Soup"),
inventory_image = "farming_beetroot_soup.png",
on_use = minetest.item_eat(6, "farming:bowl")
})
farming.add_eatable("farming:beetroot_soup", 6)
minetest.register_craft({
output = "farming:beetroot_soup",
recipe = {
{"group:food_beetroot", "group:food_beetroot", "group:food_beetroot"},
{"group:food_beetroot", "group:food_bowl", "group:food_beetroot"}
}
})
-- red dye
minetest.register_craft({
output = a.dye_red,
recipe = {{"group:food_beetroot"}}
})
-- crop definition
local def = {
drawtype = "plantlike",
@ -60,21 +39,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:beetroot_1", table.copy(def))
-- stage 2
def.tiles = {"farming_beetroot_2.png"}
minetest.register_node("farming:beetroot_2", table.copy(def))
-- stage 3
def.tiles = {"farming_beetroot_3.png"}
minetest.register_node("farming:beetroot_3", table.copy(def))
-- stage 4
def.tiles = {"farming_beetroot_4.png"}
minetest.register_node("farming:beetroot_4", table.copy(def))
-- stage 5
-- stage 5 (final)
def.tiles = {"farming_beetroot_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -89,6 +73,7 @@ def.drop = {
minetest.register_node("farming:beetroot_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:beetroot"] = {
crop = "farming:beetroot",
seed = "farming:beetroot",
@ -98,6 +83,7 @@ farming.registered_plants["farming:beetroot"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,7 +1,8 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- blackberries
minetest.register_craftitem("farming:blackberry", {
description = S("Blackberries"),
inventory_image = "farming_blackberry.png",
@ -9,14 +10,17 @@ minetest.register_craftitem("farming:blackberry", {
compostability = 48, seed = 2, food_blackberries = 1, food_blackberry = 1,
food_berry = 1
},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blackberry_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:blackberry", 1)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_blackberry_1.png"},
@ -36,17 +40,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:blackberry_1", table.copy(def))
-- stage 2
def.tiles = {"farming_blackberry_2.png"}
minetest.register_node("farming:blackberry_2", table.copy(def))
-- stage 3
def.tiles = {"farming_blackberry_3.png"}
minetest.register_node("farming:blackberry_3", table.copy(def))
-- stage 4
-- stage 4 (final)
def.tiles = {"farming_blackberry_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -60,6 +68,7 @@ def.drop = {
minetest.register_node("farming:blackberry_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:blackberry"] = {
crop = "farming:blackberry",
seed = "farming:blackberry",
@ -69,6 +78,7 @@ farming.registered_plants["farming:blackberry"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- blueberries
minetest.register_craftitem("farming:blueberries", {
description = S("Wild Blueberries"),
inventory_image = "farming_blueberries.png",
@ -10,57 +10,16 @@ minetest.register_craftitem("farming:blueberries", {
compostability = 48,seed = 2, food_blueberries = 1, food_blueberry = 1,
food_berry = 1
},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:blueberry_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:blueberries", 1)
-- blueberry muffin (thanks to sosogirl123 @ deviantart.com for muffin image)
minetest.register_craftitem("farming:muffin_blueberry", {
description = S("Blueberry Muffin"),
inventory_image = "farming_blueberry_muffin.png",
on_use = minetest.item_eat(2),
groups = {compostability = 65}
})
farming.add_eatable("farming:muffin_blueberry", 2)
minetest.register_craft({
output = "farming:muffin_blueberry 2",
recipe = {
{"group:food_blueberries", "group:food_bread", "group:food_blueberries"}
}
})
-- Blueberry Pie
minetest.register_craftitem("farming:blueberry_pie", {
description = S("Blueberry Pie"),
inventory_image = "farming_blueberry_pie.png",
on_use = minetest.item_eat(6),
groups = {compostability = 75}
})
farming.add_eatable("farming:blueberry_pie", 6)
minetest.register_craft({
output = "farming:blueberry_pie",
recipe = {
{"group:food_flour", "group:food_sugar", "group:food_blueberries"},
{"", a.baking_tray, ""}
},
replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
})
-- Blue Dye
minetest.register_craft({
output = a.dye_blue,
recipe = {{"farming:blueberries"}}
})
-- blueberry definition
-- ctop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_blueberry_1.png"},
@ -80,17 +39,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:blueberry_1", table.copy(def))
-- stage 2
def.tiles = {"farming_blueberry_2.png"}
minetest.register_node("farming:blueberry_2", table.copy(def))
-- stage 3
def.tiles = {"farming_blueberry_3.png"}
minetest.register_node("farming:blueberry_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_blueberry_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -104,6 +67,7 @@ def.drop = {
minetest.register_node("farming:blueberry_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:blueberries"] = {
crop = "farming:blueberry",
seed = "farming:blueberries",
@ -113,6 +77,7 @@ farming.registered_plants["farming:blueberries"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,21 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- cabbage
minetest.register_craftitem("farming:cabbage", {
description = S("Cabbage"),
inventory_image = "farming_cabbage.png",
groups = {
compostability = 48, seed = 2, food_cabbage = 1
},
groups = {compostability = 48, seed = 2, food_cabbage = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:cabbage", 1)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_cabbage_1.png"},
@ -36,25 +38,31 @@ local def = {
}
-- stage 1
minetest.register_node("farming:cabbage_1", table.copy(def))
-- stage 2
def.tiles = {"farming_cabbage_2.png"}
minetest.register_node("farming:cabbage_2", table.copy(def))
-- stage 3
def.tiles = {"farming_cabbage_3.png"}
minetest.register_node("farming:cabbage_3", table.copy(def))
-- stage 4
def.tiles = {"farming_cabbage_4.png"}
minetest.register_node("farming:cabbage_4", table.copy(def))
-- stage 5
def.tiles = {"farming_cabbage_5.png"}
minetest.register_node("farming:cabbage_5", table.copy(def))
-- stage 6
-- stage 6 (final)
def.tiles = {"farming_cabbage_6.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -67,6 +75,7 @@ def.drop = {
minetest.register_node("farming:cabbage_6", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cabbage"] = {
crop = "farming:cabbage",
seed = "farming:cabbage",
@ -76,6 +85,7 @@ farming.registered_plants["farming:cabbage"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,64 +1,27 @@
--[[
Original textures from PixelBox texture pack
https://forum.minetest.net/viewtopic.php?id=4990
]]
-- Original textures from PixelBox texture pack
-- https://forum.minetest.net/viewtopic.php?id=4990
local S = farming.translate
local S = minetest.get_translator("farming")
local a = farming.recipe_items
-- carrot
-- item/seed
minetest.register_craftitem("farming:carrot", {
description = S("Carrot"),
inventory_image = "farming_carrot.png",
groups = {
compostability = 48, seed = 2, food_carrot = 1
},
groups = {compostability = 48, seed = 2, food_carrot = 1},
on_use = minetest.item_eat(4),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
end,
on_use = minetest.item_eat(4)
end
})
farming.add_eatable("farming:carrot", 4)
-- carrot juice
minetest.register_craftitem("farming:carrot_juice", {
description = S("Carrot Juice"),
inventory_image = "farming_carrot_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1}
})
-- crop definition
farming.add_eatable("farming:carrot_juice", 4)
minetest.register_craft({
output = "farming:carrot_juice",
recipe = {
{a.juicer},
{"group:food_carrot"},
{"vessels:drinking_glass"}
},
replacements = {
{"group:food_juicer", "farming:juicer"}
}
})
-- golden carrot
minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(10)
})
farming.add_eatable("farming:carrot_gold", 10)
minetest.register_craft({
output = "farming:carrot_gold",
recipe = {{"group:food_carrot", "default:gold_lump"}}
})
-- carrot definition
local def = {
drawtype = "plantlike",
tiles = {"farming_carrot_1.png"},
@ -78,31 +41,37 @@ local def = {
sounds = farming.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:carrot_1", table.copy(def))
-- stage 2
def.tiles = {"farming_carrot_2.png"}
minetest.register_node("farming:carrot_2", table.copy(def))
-- stage 3
def.tiles = {"farming_carrot_3.png"}
minetest.register_node("farming:carrot_3", table.copy(def))
-- stage 4
def.tiles = {"farming_carrot_4.png"}
minetest.register_node("farming:carrot_4", table.copy(def))
-- stage 5
def.tiles = {"farming_carrot_5.png"}
minetest.register_node("farming:carrot_5", table.copy(def))
-- stage 6
def.tiles = {"farming_carrot_6.png"}
minetest.register_node("farming:carrot_6", table.copy(def))
-- stage 7
def.tiles = {"farming_carrot_7.png"}
def.drop = {
items = {
@ -113,6 +82,7 @@ def.drop = {
minetest.register_node("farming:carrot_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_carrot_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -125,6 +95,7 @@ def.drop = {
minetest.register_node("farming:carrot_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:carrot"] = {
crop = "farming:carrot",
seed = "farming:carrot",
@ -134,6 +105,7 @@ farming.registered_plants["farming:carrot"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,64 +1,24 @@
local S = farming.translate
local S = minetest.get_translator("farming")
local a = farming.recipe_items
-- chili pepper
-- item/seed
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
},
groups = {compostability = 48, seed = 2, food_chili_pepper = 1},
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")
end,
on_use = minetest.item_eat(2)
end
})
farming.add_eatable("farming:chili_pepper", 2)
-- bowl of chili
minetest.register_craftitem("farming:chili_bowl", {
description = S("Bowl of Chili"),
inventory_image = "farming_chili_bowl.png",
on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65}
})
-- crop definition
farming.add_eatable("farming:chili_bowl", 8)
minetest.register_craft({
output = "farming:chili_bowl",
recipe = {
{"group:food_chili_pepper", "group:food_rice", "group:food_tomato"},
{"group:food_beans", "group:food_bowl", ""}
}
})
-- chili can be used for red dye
minetest.register_craft({
output = a.dye_red,
recipe = {{"farming:chili_pepper"}}
})
-- chili powder
minetest.register_craftitem("farming:chili_powder", {
description = S("Chili Powder"),
on_use = minetest.item_eat(-1),
inventory_image = "farming_chili_powder.png",
groups = {compostability = 45}
})
minetest.register_craft({
output = "farming:chili_powder",
recipe = {
{"farming:chili_pepper", a.mortar_pestle}
},
replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}
})
-- chili definition
local def = {
drawtype = "plantlike",
tiles = {"farming_chili_1.png"},
@ -79,33 +39,41 @@ local def = {
}
-- stage 1
minetest.register_node("farming:chili_1", table.copy(def))
-- stage 2
def.tiles = {"farming_chili_2.png"}
minetest.register_node("farming:chili_2", table.copy(def))
-- stage 3
def.tiles = {"farming_chili_3.png"}
minetest.register_node("farming:chili_3", table.copy(def))
-- stage 4
def.tiles = {"farming_chili_4.png"}
minetest.register_node("farming:chili_4", table.copy(def))
-- stage 5
def.tiles = {"farming_chili_5.png"}
minetest.register_node("farming:chili_5", table.copy(def))
-- stage 6
def.tiles = {"farming_chili_6.png"}
minetest.register_node("farming:chili_6", table.copy(def))
-- stage 7
def.tiles = {"farming_chili_7.png"}
minetest.register_node("farming:chili_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_chili_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -118,6 +86,7 @@ def.drop = {
minetest.register_node("farming:chili_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:chili_pepper"] = {
crop = "farming:chili",
seed = "farming:chili_pepper",
@ -127,6 +96,7 @@ farming.registered_plants["farming:chili_pepper"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {

View File

@ -1,6 +1,5 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- place cocoa
local function place_cocoa(itemstack, placer, pointed_thing, plantname)
@ -8,20 +7,17 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
if not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[under.name] then return end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and itemstack and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -36,14 +32,12 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.above, name) then
return
end
if minetest.is_protected(pt.above, name) then return end
-- add the node and remove 1 item from the itemstack
minetest.set_node(pt.above, {name = plantname})
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}, true)
if placer and not farming.is_creative(placer:get_player_name()) then
@ -52,102 +46,28 @@ local function place_cocoa(itemstack, placer, pointed_thing, plantname)
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:cocoa_beans_raw",
placer:get_wield_index()
)
minetest.after(0.20, farming.refill_plant, placer,
"farming:cocoa_beans_raw", placer:get_wield_index())
end
end
return itemstack
end
-- cocoa beans
-- item/seed
minetest.register_craftitem("farming:cocoa_beans_raw", {
description = S("Raw Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png^[brighten",
groups = {compostability = 48, seed = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
end
})
minetest.register_craftitem("farming:cocoa_beans", {
description = S("Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png",
groups = {compostability = 65, food_cocoa = 1, flammable = 2}
})
-- crop definition
minetest.register_craft({
type = "cooking",
cooktime = 5,
output = "farming:cocoa_beans",
recipe = "farming:cocoa_beans_raw"
})
minetest.register_craft( {
output = a.dye_brown,
recipe = {{"farming:cocoa_beans"}}
})
-- chocolate cookie
minetest.register_craftitem("farming:cookie", {
description = S("Cookie"),
inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2)
})
farming.add_eatable("farming:cookie", 2)
minetest.register_craft( {
output = "farming:cookie 8",
recipe = {
{"group:food_wheat", "group:food_cocoa", "group:food_wheat" }
}
})
-- bar of dark chocolate (thanks to Ice Pandora for her deviantart.com chocolate tutorial)
minetest.register_craftitem("farming:chocolate_dark", {
description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(3)
})
farming.add_eatable("farming:chocolate_dark", 3)
minetest.register_craft( {
output = "farming:chocolate_dark",
recipe = {
{"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"}
}
})
-- chocolate block
minetest.register_node("farming:chocolate_block", {
description = S("Chocolate Block"),
tiles = {"farming_chocolate_block.png"},
is_ground_content = false,
groups = {cracky = 2, oddly_breakable_by_hand = 2},
sounds = farming.node_sound_stone_defaults()
})
minetest.register_craft({
output = "farming:chocolate_block",
recipe = {
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"},
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"},
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"}
}
})
minetest.register_craft({
output = "farming:chocolate_dark 9",
recipe = {{"farming:chocolate_block"}}
})
-- cocoa definition
local def = {
drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"},
@ -166,7 +86,7 @@ local def = {
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
-- custom function to check for growing conditions, returning True when found
-- custom function that returns True when conditions are met
growth_check = function(pos, node_name)
if minetest.find_node_near(pos, 1,
@ -179,13 +99,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:cocoa_1", table.copy(def))
-- stage 2
def.tiles = {"farming_cocoa_2.png"}
minetest.register_node("farming:cocoa_2", table.copy(def))
-- stage3
def.tiles = {"farming_cocoa_3.png"}
def.drop = {
items = {
@ -195,6 +118,7 @@ def.drop = {
minetest.register_node("farming:cocoa_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_cocoa_4.png"}
def.groups.growing = nil
def.growth_check = nil
@ -208,6 +132,7 @@ def.drop = {
minetest.register_node("farming:cocoa_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cocoa_beans"] = {
trellis = "default:jungletree",
crop = "farming:cocoa",
@ -218,6 +143,7 @@ farming.registered_plants["farming:cocoa_beans"] = {
}
-- register async mapgen script
if minetest.register_mapgen_script then
minetest.register_mapgen_script(farming.path .. "/crops/cocoa_mapgen.lua")
else

View File

@ -1,15 +1,16 @@
-- Localize things for speed
local random = math.random
local jungletree_nodes = {"default:jungletree", "mcl_core:jungletree"}
local jungletree_leaves = {
"default:jungleleaves", "moretrees:jungletree_leaves_green", "mcl_core:jungleleaves"}
-- Add random cocoa pods to jungle tree's
-- check area to place cocoa pods near jungle trees
local function generate(vmanip, minp, maxp)
if maxp.y < 0 then
return
end
if maxp.y < 0 then return end
local min, max = vmanip:get_emerged_area()
local area = VoxelArea:new({MinEdge = min, MaxEdge = max})
@ -44,6 +45,8 @@ local function generate(vmanip, minp, maxp)
end
end
-- mapgen
if minetest.save_gen_notify then -- async env (5.9+)
minetest.register_on_generated(function(vmanip, minp, maxp, blockseed)
generate(vmanip, minp, maxp)

View File

@ -1,53 +1,20 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- coffee
minetest.register_craftitem("farming:coffee_beans", {
description = S("Coffee Beans"),
inventory_image = "farming_coffee_beans.png",
groups = {compostability = 48, 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
})
-- cup of coffee
minetest.register_node("farming:coffee_cup", {
description = S("Cup of Coffee"),
drawtype = "torchlike",
tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png",
wield_image = "farming_coffee_cup.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1},
is_ground_content = false,
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = farming.node_sound_glass_defaults()
})
-- crop definition
farming.add_eatable("farming:coffee_cup", 2)
minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup")
minetest.register_alias("farming:drinking_cup", "vessels:drinking_glass")
minetest.register_craft( {
output = "farming:coffee_cup",
recipe = {
{"group:food_coffee", "group:food_glass_water", a.saucepan}
},
replacements = {
{"group:food_saucepan", "farming:saucepan"}
}
})
-- coffee definition
local def = {
drawtype = "plantlike",
tiles = {"farming_coffee_1.png"},
@ -68,21 +35,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:coffee_1", table.copy(def))
-- stage 2
def.tiles = {"farming_coffee_2.png"}
minetest.register_node("farming:coffee_2", table.copy(def))
-- stage 3
def.tiles = {"farming_coffee_3.png"}
minetest.register_node("farming:coffee_3", table.copy(def))
-- stage 4
def.tiles = {"farming_coffee_4.png"}
minetest.register_node("farming:coffee_4", table.copy(def))
-- stage 5 (final)
def.tiles = {"farming_coffee_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -96,6 +68,7 @@ def.drop = {
minetest.register_node("farming:coffee_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:coffee"] = {
crop = "farming:coffee",
seed = "farming:coffee_beans",
@ -105,6 +78,7 @@ farming.registered_plants["farming:coffee"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -4,116 +4,25 @@
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/1440575-1-2-5-generation-minecraft-beta-1-2-farming-and
]]
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- corn
minetest.register_craftitem("farming:corn", {
description = S("Corn"),
inventory_image = "farming_corn.png",
groups = {
compostability = 45, seed = 2, food_corn = 1
},
groups = {compostability = 45, seed = 2, food_corn = 1},
on_use = minetest.item_eat(3),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
end,
on_use = minetest.item_eat(3)
end
})
farming.add_eatable("farming:corn", 3)
-- corn on the cob (texture by TenPlus1)
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},
on_use = minetest.item_eat(5)
})
-- crop definition
farming.add_eatable("farming:corn_cob", 5)
minetest.register_craft({
type = "cooking",
cooktime = 10,
output = "farming:corn_cob",
recipe = "group:food_corn"
})
-- popcorn
minetest.register_craftitem("farming:popcorn", {
description = S("Popcorn"),
inventory_image = "farming_popcorn.png",
groups = {compostability = 55, food_popcorn = 1},
on_use = minetest.item_eat(4)
})
farming.add_eatable("farming:popcorn", 4)
minetest.register_craft({
output = "farming:popcorn",
recipe = {
{"group:food_oil", "group:food_corn", a.pot}
},
replacements = {
{"group:food_pot", "farming:pot"},
{"group:food_oil", "vessels:glass_bottle"}
}
})
-- cornstarch
minetest.register_craftitem("farming:cornstarch", {
description = S("Cornstarch"),
inventory_image = "farming_cornstarch.png",
groups = {food_cornstarch = 1, food_gelatin = 1, flammable = 2, compostability = 65}
})
minetest.register_craft({
output = "farming:cornstarch",
recipe = {
{a.mortar_pestle, "group:food_corn_cooked", a.baking_tray},
{"", "group:food_bowl", ""},
},
replacements = {
{"group:food_mortar_pestle", "farming:mortar_pestle"},
{"group:food_baking_tray", "farming:baking_tray"}
}
})
-- ethanol (thanks to JKMurray for this idea)
minetest.register_node("farming:bottle_ethanol", {
description = S("Bottle of Ethanol"),
drawtype = "plantlike",
tiles = {"farming_bottle_ethanol.png"},
inventory_image = "farming_bottle_ethanol.png",
wield_image = "farming_bottle_ethanol.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = farming.node_sound_glass_defaults()
})
minetest.register_craft( {
output = "farming:bottle_ethanol",
recipe = {
{"group:food_corn", "group:food_corn", "group:food_corn"},
{"group:food_corn", a.glass_bottle, "group:food_corn"},
{"group:food_corn", "group:food_corn", "group:food_corn"}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:bottle_ethanol",
burntime = 80,
replacements = {{"farming:bottle_ethanol", a.glass_bottle}}
})
-- corn definition
local def = {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
@ -134,30 +43,37 @@ local def = {
}
-- stage 1
minetest.register_node("farming:corn_1", table.copy(def))
-- stage 2
def.tiles = {"farming_corn_2.png"}
minetest.register_node("farming:corn_2", table.copy(def))
-- stage 3
def.tiles = {"farming_corn_3.png"}
minetest.register_node("farming:corn_3", table.copy(def))
-- stage 4
def.tiles = {"farming_corn_4.png"}
minetest.register_node("farming:corn_4", table.copy(def))
-- stage 5
def.tiles = {"farming_corn_5.png"}
minetest.register_node("farming:corn_5", table.copy(def))
-- stage 6
def.tiles = {"farming_corn_6.png"}
def.visual_scale = 1.9
minetest.register_node("farming:corn_6", table.copy(def))
-- stage 7
def.tiles = {"farming_corn_7.png"}
def.drop = {
items = {
@ -169,6 +85,7 @@ def.drop = {
minetest.register_node("farming:corn_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_corn_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -182,6 +99,7 @@ def.drop = {
minetest.register_node("farming:corn_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:corn"] = {
crop = "farming:corn",
seed = "farming:corn",
@ -191,6 +109,7 @@ farming.registered_plants["farming:corn"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,38 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- wild cotton as a source of cotton seed and a chance of cotton itself
minetest.register_node("farming:cotton_wild", {
description = S("Wild Cotton"),
drawtype = "plantlike",
waving = 1,
tiles = {"farming_cotton_wild.png"},
inventory_image = "farming_cotton_wild.png",
wield_image = "farming_cotton_wild.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {
handy = 1, snappy = 3, attached_node = 1, flammable = 4, compostability = 60
},
_mcl_hardness = farming.mcl_hardness,
is_ground_content = false,
drop = {
items = {
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1}
}
},
sounds = farming.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16}
}
})
-- seed
-- cotton seeds
minetest.register_node("farming:seed_cotton", {
description = S("Cotton Seed"),
tiles = {"farming_cotton_seed.png"},
@ -51,63 +21,26 @@ minetest.register_node("farming:seed_cotton", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:cotton_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_cotton")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:cotton_1", param2 = 1})
end
})
-- cotton
-- item
minetest.register_craftitem("farming:cotton", {
description = S("Cotton"),
inventory_image = "farming_cotton.png",
groups = {flammable = 4, compostability = 50}
})
-- string
if not farming.mcl then
-- crop definition
minetest.register_craftitem("farming:string", {
description = S("String"),
inventory_image = "farming_string.png",
groups = {flammable = 2}
})
end
-- cotton to wool
minetest.register_craft({
output = a.wool,
recipe = {
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"}
}
})
-- cotton to string
minetest.register_craft({
output = a.string .. " 2",
recipe = {
{"farming:cotton"},
{"farming:cotton"}
}
})
-- can be used as fuel
minetest.register_craft({
type = "fuel",
recipe = "farming:string",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:cotton",
burntime = 1
})
-- cotton definition
local def = {
drawtype = "plantlike",
tiles = {"farming_cotton_1.png"},
@ -128,21 +61,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:cotton_1", table.copy(def))
-- stage 2
def.tiles = {"farming_cotton_2.png"}
minetest.register_node("farming:cotton_2", table.copy(def))
-- stage 3
def.tiles = {"farming_cotton_3.png"}
minetest.register_node("farming:cotton_3", table.copy(def))
-- stage 4
def.tiles = {"farming_cotton_4.png"}
minetest.register_node("farming:cotton_4", table.copy(def))
-- stage 5
def.tiles = {"farming_cotton_5.png"}
def.drop = {
items = {
@ -152,6 +90,7 @@ def.drop = {
minetest.register_node("farming:cotton_5", table.copy(def))
-- stage 6
def.tiles = {"farming_cotton_6.png"}
def.drop = {
items = {
@ -162,6 +101,7 @@ def.drop = {
minetest.register_node("farming:cotton_6", table.copy(def))
-- stage 7
def.tiles = {"farming_cotton_7.png"}
def.drop = {
items = {
@ -174,6 +114,7 @@ def.drop = {
minetest.register_node("farming:cotton_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_cotton_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -190,6 +131,7 @@ def.drop = {
minetest.register_node("farming:cotton_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cotton"] = {
crop = "farming:cotton",
seed = "farming:seed_cotton",
@ -198,15 +140,37 @@ farming.registered_plants["farming:cotton"] = {
steps = 8
}
--[[ Cotton using api
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
groups = {flammable = 2},
steps = 8,
})]]
-- wild cotton (this is what you find on the map)
minetest.register_node("farming:cotton_wild", {
description = S("Wild Cotton"),
drawtype = "plantlike",
waving = 1,
tiles = {"farming_cotton_wild.png"},
inventory_image = "farming_cotton_wild.png",
wield_image = "farming_cotton_wild.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
groups = {handy = 1, snappy = 3, attached_node = 1, flammable = 4, compostability = 60},
_mcl_hardness = farming.mcl_hardness,
is_ground_content = false,
drop = {
items = {
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1}
}
},
sounds = farming.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16}
}
})
-- mapgen
local mg = farming.mapgen == "v6"
def = {
@ -233,3 +197,12 @@ minetest.register_decoration({
y_min = 1,
decoration = "farming:cotton_wild"
})
--[[ Cotton using api
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
groups = {flammable = 2},
steps = 8,
})]]

View File

@ -4,24 +4,25 @@
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- cucumber
minetest.register_craftitem("farming:cucumber", {
description = S("Cucumber"),
inventory_image = "farming_cucumber.png",
groups = {
compostability = 48, seed = 2, food_cucumber = 1
},
groups = {compostability = 48, seed = 2, food_cucumber = 1},
on_use = minetest.item_eat(4),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
end,
on_use = minetest.item_eat(4)
end
})
farming.add_eatable("farming:cucumber", 4)
-- cucumber definition
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"},
@ -40,17 +41,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:cucumber_1", table.copy(def))
-- stage 2
def.tiles = {"farming_cucumber_2.png"}
minetest.register_node("farming:cucumber_2", table.copy(def))
-- stage 3
def.tiles = {"farming_cucumber_3.png"}
minetest.register_node("farming:cucumber_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_cucumber_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -63,6 +68,7 @@ def.drop = {
minetest.register_node("farming:cucumber_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cucumber"] = {
crop = "farming:cucumber",
seed = "farming:cucumber",
@ -72,6 +78,7 @@ farming.registered_plants["farming:cucumber"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- eggplant
minetest.register_craftitem("farming:eggplant", {
description = S("Eggplant"),
inventory_image = "farming_eggplant.png",
groups = {
compostability = 48, seed = 2, food_eggplant = 1
},
groups = {compostability = 48, seed = 2, food_eggplant = 1},
on_use = minetest.item_eat(3),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:eggplant_1")
end,
on_use = minetest.item_eat(3)
end
})
farming.add_eatable("farming:eggplant", 3)
-- definition
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_eggplant_1.png"},
@ -38,13 +39,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:eggplant_1", table.copy(def))
-- stage 2
def.tiles = {"farming_eggplant_2.png"}
minetest.register_node("farming:eggplant_2", table.copy(def))
-- stage 3
def.tiles = {"farming_eggplant_3.png"}
def.drop = {
items = {
@ -54,7 +58,8 @@ def.drop = {
}
minetest.register_node("farming:eggplant_3", table.copy(def))
-- stage 4
-- stage 4 (final)
def.tiles = {"farming_eggplant_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -67,6 +72,7 @@ def.drop = {
minetest.register_node("farming:eggplant_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:eggplant"] = {
crop = "farming:eggplant",
seed = "farming:eggplant",
@ -76,6 +82,7 @@ farming.registered_plants["farming:eggplant"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,84 +1,20 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- garlic clove
minetest.register_craftitem("farming:garlic_clove", {
description = S("Garlic clove"),
inventory_image = "crops_garlic_clove.png",
groups = {compostability = 35, 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
})
-- garlic bulb
minetest.register_craftitem("farming:garlic", {
description = S("Garlic"),
inventory_image = "crops_garlic.png",
on_use = minetest.item_eat(1),
groups = {food_garlic = 1, compostability = 55}
})
farming.add_eatable("farming:garlic", 1)
minetest.register_craft({
output = "farming:garlic_clove 8",
recipe = {{"farming:garlic"}}
})
minetest.register_craft({
output = "farming:garlic",
recipe = {
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
{"farming:garlic_clove", "", "farming:garlic_clove"},
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}
}
})
-- garlic braid
minetest.register_node("farming:garlic_braid", {
description = S("Garlic Braid"),
inventory_image = "crops_garlic_braid.png",
wield_image = "crops_garlic_braid.png",
drawtype = "nodebox",
use_texture_alpha = "clip",
paramtype = "light",
paramtype2 = "facedir",
tiles = {
"crops_garlic_braid_top.png",
"crops_garlic_braid.png",
"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, flammable = 3, compostability = 65},
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.1875, -0.5, 0.5, 0.1875, 0.5, 0.125}
}
}
})
minetest.register_craft({
output = "farming:garlic_braid",
recipe = {
{"farming:garlic", "farming:garlic", "farming:garlic"},
{"farming:garlic", "farming:garlic", "farming:garlic"},
{"farming:garlic", "farming:garlic", "farming:garlic"}
}
})
minetest.register_craft({
type = "shapeless",
output = "farming:garlic 9",
recipe = {"farming:garlic_braid"}
})
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"crops_garlic_plant_1.png"},
@ -101,21 +37,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:garlic_1", table.copy(def))
-- stage 2
def.tiles = {"crops_garlic_plant_2.png"}
minetest.register_node("farming:garlic_2", table.copy(def))
-- stage 3
def.tiles = {"crops_garlic_plant_3.png"}
minetest.register_node("farming:garlic_3", table.copy(def))
-- stage 4
def.tiles = {"crops_garlic_plant_4.png"}
minetest.register_node("farming:garlic_4", table.copy(def))
-- stage 5
def.tiles = {"crops_garlic_plant_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -129,6 +70,7 @@ def.drop = {
minetest.register_node("farming:garlic_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:garlic"] = {
crop = "farming:garlic",
seed = "farming:garlic_clove",
@ -138,6 +80,7 @@ farming.registered_plants["farming:garlic"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- ginger
minetest.register_craftitem("farming:ginger", {
description = S("Ginger"),
inventory_image = "farming_ginger.png",
groups = {
compostability = 48, seed = 2, food_ginger = 1
},
groups = {compostability = 48, seed = 2, food_ginger = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:ginger_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:ginger", 1)
-- ginger definition
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_ginger_1.png"},
@ -37,13 +38,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:ginger_1", table.copy(def))
-- stage 2
def.tiles = {"farming_ginger_2.png"}
minetest.register_node("farming:ginger_2", table.copy(def))
-- stage 3
def.tiles = {"farming_ginger_3.png"}
def.drop = {
items = {
@ -54,6 +58,7 @@ def.drop = {
minetest.register_node("farming:ginger_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_ginger_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -66,6 +71,7 @@ def.drop = {
minetest.register_node("farming:ginger_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:ginger"] = {
crop = "farming:ginger",
seed = "farming:ginger",
@ -75,6 +81,7 @@ farming.registered_plants["farming:ginger"] = {
}
-- mapgen
minetest.register_decoration({
name = "farming:ginger_4",
deco_type = "simple",

View File

@ -1,27 +1,24 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- place trellis helper
-- place trellis
local function place_grapes(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
if not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[under.name] then return end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and itemstack and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -30,19 +27,15 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
return
end
if minetest.is_protected(pt.under, name) then return end
-- check if pointing at trellis
if under.name ~= "farming:trellis" then
return
end
if under.name ~= "farming:trellis" then return end
-- add the node and remove 1 item from the itemstack
minetest.set_node(pt.under, {name = plantname})
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0})
minetest.sound_play("default_place_node", {pos = pt.under, gain = 1.0}, true)
if placer and not farming.is_creative(placer:get_player_name()) then
@ -51,11 +44,8 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:grapes",
placer:get_wield_index()
minetest.after(0.20, farming.refill_plant, placer,
"farming:grapes", placer:get_wield_index()
)
end
end
@ -63,14 +53,14 @@ local function place_grapes(itemstack, placer, pointed_thing, plantname)
return itemstack
end
-- grapes
-- item/seed
minetest.register_craftitem("farming:grapes", {
description = S("Grapes"),
inventory_image = "farming_grapes.png",
groups = {compostability = 48, seed = 2, food_grapes = 1},
on_use = minetest.item_eat(2),
groups = {
compostability = 48, seed = 2, food_grapes = 1
},
on_place = function(itemstack, placer, pointed_thing)
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")
end
@ -78,13 +68,8 @@ minetest.register_craftitem("farming:grapes", {
farming.add_eatable("farming:grapes", 2)
-- grapes can be used for violet dye
minetest.register_craft({
output = a.dye_violet,
recipe = {{"farming:grapes"}}
})
-- trellis
minetest.register_node("farming:trellis", {
description = S("Trellis (place on soil before planting grapes)"),
drawtype = "plantlike",
@ -106,20 +91,17 @@ minetest.register_node("farming:trellis", {
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
if not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- return if any of the nodes are not registered
if not minetest.registered_nodes[under.name] then
return
end
if not minetest.registered_nodes[under.name] then return end
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -130,9 +112,7 @@ minetest.register_node("farming:trellis", {
local nodename = under.name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
if minetest.get_item_group(nodename, "soil") < 2 then return end
local top = {
x = pointed_thing.above.x,
@ -142,9 +122,7 @@ minetest.register_node("farming:trellis", {
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
if nodename ~= "air" then return end
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
@ -156,22 +134,8 @@ minetest.register_node("farming:trellis", {
end
})
minetest.register_craft({
output = "farming:trellis",
recipe = {
{"group:stick", "group:stick", "group:stick"},
{"group:stick", "group:stick", "group:stick"},
{"group:stick", "group:stick", "group:stick"}
}
})
-- crop definition
minetest.register_craft({
type = "fuel",
recipe = "farming:trellis",
burntime = 15
})
-- grapes definition
local def = {
drawtype = "plantlike",
tiles = {"farming_grapes_1.png"},
@ -196,33 +160,41 @@ local def = {
}
-- stage 1
minetest.register_node("farming:grapes_1", table.copy(def))
-- stage2
def.tiles = {"farming_grapes_2.png"}
minetest.register_node("farming:grapes_2", table.copy(def))
-- stage 3
def.tiles = {"farming_grapes_3.png"}
minetest.register_node("farming:grapes_3", table.copy(def))
-- stage 4
def.tiles = {"farming_grapes_4.png"}
minetest.register_node("farming:grapes_4", table.copy(def))
-- stage 5
def.tiles = {"farming_grapes_5.png"}
minetest.register_node("farming:grapes_5", table.copy(def))
-- stage 6
def.tiles = {"farming_grapes_6.png"}
minetest.register_node("farming:grapes_6", table.copy(def))
-- stage 7
def.tiles = {"farming_grapes_7.png"}
minetest.register_node("farming:grapes_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_grapes_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -237,6 +209,7 @@ def.drop = {
minetest.register_node("farming:grapes_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:grapes"] = {
trellis = "farming:trellis",
crop = "farming:grapes",
@ -247,6 +220,7 @@ farming.registered_plants["farming:grapes"] = {
}
-- wild grape vine (this is what you find on the map)
minetest.register_node("farming:grapebush", {
drawtype = "plantlike",
tiles = {"farming_grapebush.png"},
@ -272,6 +246,7 @@ minetest.register_node("farming:grapebush", {
})
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- hemp seeds
minetest.register_node("farming:seed_hemp", {
description = S("Hemp Seed"),
tiles = {"farming_hemp_seed.png"},
@ -21,195 +21,26 @@ minetest.register_node("farming:seed_hemp", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:hemp_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_hemp")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:hemp_1", param2 = 1})
end
})
-- harvested hemp
-- item
minetest.register_craftitem("farming:hemp_leaf", {
description = S("Hemp Leaf"),
inventory_image = "farming_hemp_leaf.png",
groups = {compostability = 35}
})
-- hemp oil
minetest.register_node("farming:hemp_oil", {
description = S("Bottle of Hemp Oil"),
drawtype = "plantlike",
tiles = {"farming_hemp_oil.png"},
inventory_image = "farming_hemp_oil.png",
wield_image = "farming_hemp_oil.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
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,
compostability = 45
},
sounds = farming.node_sound_glass_defaults()
})
-- crop definition
minetest.register_craft( {
output = "farming:hemp_oil",
recipe = {
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"", a.glass_bottle, ""}
}
})
minetest.register_craft( {
output = "farming:hemp_oil",
recipe = {
{"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
{"farming:seed_hemp", "farming:seed_hemp", "farming:seed_hemp"},
{"farming:seed_hemp", a.glass_bottle, "farming:seed_hemp"}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:hemp_oil",
burntime = 20,
replacements = {{"farming:hemp_oil", a.glass_bottle}}
})
-- hemp fibre
minetest.register_craftitem("farming:hemp_fibre", {
description = S("Hemp Fibre"),
inventory_image = "farming_hemp_fibre.png",
groups = {compostability = 55}
})
minetest.register_craft( {
output = "farming:hemp_fibre 8",
recipe = {
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"farming:hemp_leaf", "group:water_bucket", "farming:hemp_leaf"},
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
},
replacements = {{"group:water_bucket", a.bucket_empty}}
})
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft( {
output = "farming:hemp_fibre 8",
recipe = {
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"farming:hemp_leaf", "group:water_bucket_wooden", "farming:hemp_leaf"},
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
},
replacements = {{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}}
})
end
-- hemp block
minetest.register_node("farming:hemp_block", {
description = S("Hemp Block"),
tiles = {"farming_hemp_block.png"},
paramtype = "light",
groups = {
axey = 1, handy = 1, snappy = 2, oddly_breakable_by_hand = 1, flammable = 2,
compostability = 85
},
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_craft( {
output = "farming:hemp_block",
recipe = {
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}
}
})
-- check and register stairs
if minetest.global_exists("stairs") then
if stairs.mod and stairs.mod == "redo" then
stairs.register_all("hemp_block", "farming:hemp_block",
{snappy = 2, oddly_breakable_by_hand = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block",
farming.node_sound_leaves_defaults())
else
stairs.register_stair_and_slab("hemp_block", "farming:hemp_block",
{snappy = 2, oddly_breakable_by_hand = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block Stair",
"Hemp Block Slab",
farming.node_sound_leaves_defaults())
end
end
-- paper
minetest.register_craft( {
output = a.paper .. " 3",
recipe = {
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}
}
})
-- string
minetest.register_craft( {
output = "farming:cotton 3",
recipe = {
{"farming:hemp_fibre"},
{"farming:hemp_fibre"},
{"farming:hemp_fibre"}
}
})
-- hemp rope
minetest.register_node("farming:hemp_rope", {
description = S("Hemp Rope"),
walkable = false,
climbable = true,
sunlight_propagates = true,
paramtype = "light",
tiles = {"farming_hemp_rope.png"},
wield_image = "farming_hemp_rope.png",
inventory_image = "farming_hemp_rope.png",
drawtype = "plantlike",
groups = {
handy = 1, axey = 1, swordy = 1, flammable = 2, choppy = 3,
oddly_breakable_by_hand = 3, compostability = 55
},
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}
},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
-- string
minetest.register_craft( {
output = "farming:hemp_rope 6",
recipe = {
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
{"farming:cotton", "farming:cotton", "farming:cotton"},
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"}
}
})
-- hemp definition
local def = {
drawtype = "plantlike",
tiles = {"farming_hemp_1.png"},
@ -230,25 +61,31 @@ local def = {
}
-- stage 1
minetest.register_node("farming:hemp_1", table.copy(def))
-- stage 2
def.tiles = {"farming_hemp_2.png"}
minetest.register_node("farming:hemp_2", table.copy(def))
-- stage 3
def.tiles = {"farming_hemp_3.png"}
minetest.register_node("farming:hemp_3", table.copy(def))
-- stage 4
def.tiles = {"farming_hemp_4.png"}
minetest.register_node("farming:hemp_4", table.copy(def))
-- stage 5
def.tiles = {"farming_hemp_5.png"}
minetest.register_node("farming:hemp_5", table.copy(def))
-- stage 6
def.tiles = {"farming_hemp_6.png"}
def.drop = {
items = {
@ -259,6 +96,7 @@ def.drop = {
minetest.register_node("farming:hemp_6", table.copy(def))
-- stage 7
def.tiles = {"farming_hemp_7.png"}
def.drop = {
items = {
@ -271,6 +109,7 @@ def.drop = {
minetest.register_node("farming:hemp_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_hemp_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -285,6 +124,7 @@ def.drop = {
minetest.register_node("farming:hemp_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:hemp"] = {
crop = "farming:hemp",
seed = "farming:seed_hemp",
@ -294,6 +134,7 @@ farming.registered_plants["farming:hemp"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {

View File

@ -1,21 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- lettuce
minetest.register_craftitem("farming:lettuce", {
description = S("Lettuce"),
inventory_image = "farming_lettuce.png",
groups = {
compostability = 48, seed = 2, food_lettuce = 1
},
groups = {compostability = 48, seed = 2, food_lettuce = 1},
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1")
end,
on_use = minetest.item_eat(2)
end
})
farming.add_eatable("farming:lettuce", 2)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_lettuce_1.png"},
@ -35,21 +37,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:lettuce_1", table.copy(def))
-- stage 2
def.tiles = {"farming_lettuce_2.png"}
minetest.register_node("farming:lettuce_2", table.copy(def))
-- stage 3
def.tiles = {"farming_lettuce_3.png"}
minetest.register_node("farming:lettuce_3", table.copy(def))
-- stage 4
def.tiles = {"farming_lettuce_4.png"}
minetest.register_node("farming:lettuce_4", table.copy(def))
-- stage 5
def.tiles = {"farming_lettuce_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -62,6 +69,7 @@ def.drop = {
minetest.register_node("farming:lettuce_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:lettuce"] = {
crop = "farming:lettuce",
seed = "farming:lettuce",
@ -71,6 +79,7 @@ farming.registered_plants["farming:lettuce"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,37 +1,23 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- melon
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
},
groups = {compostability = 48, seed = 2, food_melon_slice = 1},
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
end,
on_use = minetest.item_eat(2)
end
})
farming.add_eatable("farming:melon_slice", 2)
minetest.register_craft({
output = "farming:melon_8",
recipe = {
{"farming:melon_slice", "farming:melon_slice"},
{"farming:melon_slice", "farming:melon_slice"}
}
})
-- crop definition
minetest.register_craft({
output = "farming:melon_slice 4",
recipe = {{"farming:melon_8", a.cutting_board}},
replacements = {{"farming:cutting_board", "farming:cutting_board"}}
})
-- melon definition
local def = {
drawtype = "plantlike",
tiles = {"farming_melon_1.png"},
@ -51,33 +37,41 @@ local def = {
}
-- stage 1
minetest.register_node("farming:melon_1", table.copy(def))
-- stage 2
def.tiles = {"farming_melon_2.png"}
minetest.register_node("farming:melon_2", table.copy(def))
-- stage 3
def.tiles = {"farming_melon_3.png"}
minetest.register_node("farming:melon_3", table.copy(def))
-- stage 4
def.tiles = {"farming_melon_4.png"}
minetest.register_node("farming:melon_4", table.copy(def))
-- stage 5
def.tiles = {"farming_melon_5.png"}
minetest.register_node("farming:melon_5", table.copy(def))
-- stage 6
def.tiles = {"farming_melon_6.png"}
minetest.register_node("farming:melon_6", table.copy(def))
-- stage 7
def.tiles = {"farming_melon_7.png"}
minetest.register_node("farming:melon_7", table.copy(def))
-- stage 8 (final)
minetest.register_node("farming:melon_8", {
description = S("Melon"),
tiles = {
@ -99,6 +93,7 @@ minetest.register_node("farming:melon_8", {
})
-- add to registered_plants
farming.registered_plants["farming:melon"] = {
crop = "farming:melon",
seed = "farming:melon_slice",
@ -108,6 +103,7 @@ farming.registered_plants["farming:melon"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- mint seed
minetest.register_node("farming:seed_mint", {
description = S("Mint Seeds"),
tiles = {"farming_mint_seeds.png"},
@ -21,43 +21,26 @@ minetest.register_node("farming:seed_mint", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:mint_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_mint")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:mint_1", param2 = 1})
end
})
-- mint leaf
-- item
minetest.register_craftitem("farming:mint_leaf", {
description = S("Mint Leaf"),
inventory_image = "farming_mint_leaf.png",
groups = {food_mint = 1, flammable = 4, compostability = 48}
})
-- mint tea
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)
})
-- crop definition
farming.add_eatable("farming:mint_tea", 2)
minetest.register_craft({
output = "farming:mint_tea",
recipe = {
{"group:food_mint", "group:food_mint", "group:food_mint"},
{"group:food_glass_water", a.juicer, ""}
},
replacements = {
{"group:food_juicer", "farming:juicer"}
}
})
-- mint definition
local def = {
drawtype = "plantlike",
tiles = {"farming_mint_1.png"},
@ -77,17 +60,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:mint_1", table.copy(def))
-- stage 2
def.tiles = {"farming_mint_2.png"}
minetest.register_node("farming:mint_2", table.copy(def))
-- stage 3
def.tiles = {"farming_mint_3.png"}
minetest.register_node("farming:mint_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_mint_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -102,6 +89,7 @@ def.drop = {
minetest.register_node("farming:mint_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:mint"] = {
crop = "farming:mint",
seed = "farming:seed_mint",
@ -111,6 +99,7 @@ farming.registered_plants["farming:mint"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {

View File

@ -5,51 +5,25 @@
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- onion
minetest.register_craftitem("farming:onion", {
description = S("Onion"),
inventory_image = "crops_onion.png",
groups = {
compostability = 48, seed = 2, food_onion = 1
},
groups = {compostability = 48, seed = 2, food_onion = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:onion", 1)
-- onion soup
minetest.register_craftitem("farming:onion_soup", {
description = S("Onion Soup"),
inventory_image = "farming_onion_soup.png",
groups = {compostability = 65},
on_use = minetest.item_eat(6, a.bowl)
})
farming.add_eatable("farming:onion_soup", 6)
minetest.register_craft({
output = "farming:onion_soup",
recipe = {
{"group:food_onion", "group:food_onion", "group:food_onion"},
{"group:food_onion", "group:food_bowl", "group:food_onion"},
{"", a.pot, ""}
},
replacements = {{"farming:pot", "farming:pot"}}
})
-- yellow dye
minetest.register_craft({
output = a.dye_yellow,
recipe = {{"group:food_onion"}}
})
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"crops_onion_plant_1.png"},
@ -73,21 +47,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:onion_1", table.copy(def))
-- stage 2
def.tiles = {"crops_onion_plant_2.png"}
minetest.register_node("farming:onion_2", table.copy(def))
-- stage 3
def.tiles = {"crops_onion_plant_3.png"}
minetest.register_node("farming:onion_3", table.copy(def))
-- stage 4
def.tiles = {"crops_onion_plant_4.png"}
minetest.register_node("farming:onion_4", table.copy(def))
-- stage 5
def.tiles = {"crops_onion_plant_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -103,6 +82,7 @@ def.drop = {
minetest.register_node("farming:onion_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:onion"] = {
crop = "farming:onion",
seed = "farming:onion",
@ -112,6 +92,7 @@ farming.registered_plants["farming:onion"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- item definition
minetest.register_craftitem("farming:parsley", {
description = S("Parsley"),
inventory_image = "farming_parsley.png",
groups = {
compostability = 48, seed = 2, food_parsley = 1
},
groups = {compostability = 48, seed = 2, food_parsley = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:parsley_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:parsley", 1)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_parsley_1.png"},
@ -37,13 +38,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:parsley_1", table.copy(def))
-- stage 2
def.tiles = {"farming_parsley_2.png"}
minetest.register_node("farming:parsley_2", table.copy(def))
-- stage 3 (final)
def.tiles = {"farming_parsley_3.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -57,6 +61,7 @@ def.drop = {
minetest.register_node("farming:parsley_3", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:parsley"] = {
crop = "farming:parsley",
seed = "farming:parsley",
@ -66,6 +71,7 @@ farming.registered_plants["farming:parsley"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,45 +1,28 @@
local S = farming.translate
local a = farming.recipe_items
-- Textures for peas and their crop were done by Andrey01
-- Textures for Pea crop and Peas were done by Andrey01
local S = minetest.get_translator("farming")
-- item/seed
-- pea pod
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
},
groups = {compostability = 48, seed = 2, food_peas = 1, food_pea_pod = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:pea_pod", 1)
-- replacement for separate peas item that was removed
minetest.register_alias("farming:peas", "farming:pea_pod")
-- pea soup
minetest.register_craftitem("farming:pea_soup", {
description = S("Pea Soup"),
inventory_image = "farming_pea_soup.png",
groups = {compostability = 65},
on_use = minetest.item_eat(4, a.bowl)
})
farming.add_eatable("farming:pea_soup", 4)
minetest.register_craft({
output = "farming:pea_soup",
recipe = {
{"group:food_peas"},
{"group:food_peas"},
{"group:food_bowl"}
}
})
-- crop definition
local def = {
drawtype = "plantlike",
@ -63,21 +46,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:pea_1", table.copy(def))
-- stage 2
def.tiles = {"farming_pea_2.png"}
minetest.register_node("farming:pea_2", table.copy(def))
-- stage 3
def.tiles = {"farming_pea_3.png"}
minetest.register_node("farming:pea_3", table.copy(def))
-- stage 4
def.tiles = {"farming_pea_4.png"}
minetest.register_node("farming:pea_4", table.copy(def))
-- stage 5
-- stage 5 (final)
def.tiles = {"farming_pea_5.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -92,6 +80,7 @@ def.drop = {
minetest.register_node("farming:pea_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:pea_pod"] = {
crop = "farming:pea",
seed = "farming:pea_pod",
@ -101,6 +90,7 @@ farming.registered_plants["farming:pea_pod"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -5,20 +5,22 @@
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- peppercorn (seed)
minetest.register_craftitem("farming:peppercorn", {
description = S("Peppercorn"),
inventory_image = "crops_peppercorn.png",
groups = {compostability = 48, 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
})
-- green pepper
minetest.register_craftitem("farming:pepper", {
description = S("Green Pepper"),
inventory_image = "crops_pepper.png",
@ -29,6 +31,7 @@ minetest.register_craftitem("farming:pepper", {
farming.add_eatable("farming:pepper", 2)
-- yellow pepper
minetest.register_craftitem("farming:pepper_yellow", {
description = S("Yellow Pepper"),
inventory_image = "crops_pepper_yellow.png",
@ -39,6 +42,7 @@ minetest.register_craftitem("farming:pepper_yellow", {
farming.add_eatable("farming:pepper_yellow", 3)
-- red pepper
minetest.register_craftitem("farming:pepper_red", {
description = S("Red Pepper"),
inventory_image = "crops_pepper_red.png",
@ -48,43 +52,15 @@ minetest.register_craftitem("farming:pepper_red", {
farming.add_eatable("farming:pepper_red", 4)
-- pepper to peppercorn recipe
minetest.register_craft({
output = "farming:peppercorn",
recipe = {{"group:food_pepper"}}
})
-- ground pepper
minetest.register_node("farming:pepper_ground", {
description = S("Ground Pepper"),
inventory_image = "crops_pepper_ground.png",
wield_image = "crops_pepper_ground.png",
drawtype = "plantlike",
visual_scale = 0.8,
paramtype = "light",
tiles = {"crops_pepper_ground.png"},
groups = {
vessel = 1, food_pepper_ground = 1,
dig_immediate = 3, attached_node = 1, compostability = 30
},
is_ground_content = false,
sounds = farming.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
}
})
minetest.register_craft( {
output = "farming:pepper_ground",
recipe = {
{"group:food_peppercorn"},
{a.glass_bottle},
{a.mortar_pestle}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"crops_pepper_plant_1.png"},
@ -107,21 +83,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:pepper_1", table.copy(def))
-- stage 2
def.tiles = {"crops_pepper_plant_2.png"}
minetest.register_node("farming:pepper_2", table.copy(def))
-- stage 3
def.tiles = {"crops_pepper_plant_3.png"}
minetest.register_node("farming:pepper_3", table.copy(def))
-- stage 4
def.tiles = {"crops_pepper_plant_4.png"}
minetest.register_node("farming:pepper_4", table.copy(def))
-- stage 5 (green pepper)
def.tiles = {"crops_pepper_plant_5.png"}
def.selection_box = farming.select_final
def.drop = {
@ -134,6 +115,7 @@ def.drop = {
minetest.register_node("farming:pepper_5", table.copy(def))
-- stage 6 (yellow pepper)
def.tiles = {"crops_pepper_plant_6.png"}
def.drop = {
max_items = 2, items = {
@ -144,7 +126,8 @@ def.drop = {
}
minetest.register_node("farming:pepper_6", table.copy(def))
-- stage 7 (red pepper)
-- stage 7 (red pepper - final)
def.tiles = {"crops_pepper_plant_7.png"}
def.groups.growing = nil
def.drop = {
@ -157,6 +140,7 @@ def.drop = {
minetest.register_node("farming:pepper_7", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:pepper"] = {
crop = "farming:pepper",
seed = "farming:peppercorn",
@ -166,6 +150,7 @@ farming.registered_plants["farming:pepper"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,18 +1,20 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- pineapple top
minetest.register_craftitem("farming:pineapple_top", {
description = S("Pineapple Top"),
inventory_image = "farming_pineapple_top.png",
groups = {compostability = 48, seed = 2, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1")
end
})
-- pineapple
-- item
minetest.register_node("farming:pineapple", {
description = S("Pineapple"),
drawtype = "plantlike",
@ -23,8 +25,7 @@ minetest.register_node("farming:pineapple", {
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27}
type = "fixed", fixed = {-0.27, -0.37, -0.27, 0.27, 0.44, 0.27}
},
groups = {
food_pineapple = 1, fleshy = 3, dig_immediate = 3, flammable = 2,
@ -34,57 +35,8 @@ minetest.register_node("farming:pineapple", {
is_ground_content = false
})
-- pineapple
minetest.register_craftitem("farming:pineapple_ring", {
description = S("Pineapple Ring"),
inventory_image = "farming_pineapple_ring.png",
groups = {food_pineapple_ring = 1, compostability = 45},
on_use = minetest.item_eat(1)
})
farming.add_eatable("farming:pineapple_ring", 1)
minetest.register_craft( {
output = "farming:pineapple_ring 5",
recipe = {{"group:food_pineapple"}},
replacements = {{"farming:pineapple", "farming:pineapple_top"}}
})
-- pineapple juice
minetest.register_craftitem("farming:pineapple_juice", {
description = S("Pineapple Juice"),
inventory_image = "farming_pineapple_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 35}
})
farming.add_eatable("farming:pineapple_juice", 4)
minetest.register_craft({
output = "farming:pineapple_juice",
recipe = {
{"group:food_pineapple_ring", "group:food_pineapple_ring",
"group:food_pineapple_ring"},
{"", a.drinking_glass, ""},
{"", a.juicer, ""}
},
replacements = {
{"group:food_juicer", "farming:juicer"}
}
})
minetest.register_craft({
output = "farming:pineapple_juice 2",
recipe = {
{a.drinking_glass, "group:food_pineapple", a.drinking_glass},
{"", a.juicer, ""}
},
replacements = {
{"group:food_juicer", "farming:juicer"}
}
})
-- crop definition
local def = {
drawtype = "plantlike",
visual_scale = 1.5,
@ -106,33 +58,41 @@ local def = {
}
-- stage 1
minetest.register_node("farming:pineapple_1", table.copy(def))
-- stage 2
def.tiles = {"farming_pineapple_2.png"}
minetest.register_node("farming:pineapple_2", table.copy(def))
-- stage 3
def.tiles = {"farming_pineapple_3.png"}
minetest.register_node("farming:pineapple_3", table.copy(def))
-- stage 4
def.tiles = {"farming_pineapple_4.png"}
minetest.register_node("farming:pineapple_4", table.copy(def))
-- stage 5
def.tiles = {"farming_pineapple_5.png"}
minetest.register_node("farming:pineapple_5", table.copy(def))
-- stage 6
def.tiles = {"farming_pineapple_6.png"}
minetest.register_node("farming:pineapple_6", table.copy(def))
-- stage 7
def.tiles = {"farming_pineapple_7.png"}
minetest.register_node("farming:pineapple_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_pineapple_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -145,6 +105,7 @@ def.drop = {
minetest.register_node("farming:pineapple_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:pineapple"] = {
crop = "farming:pineapple",
seed = "farming:pineapple_top",
@ -154,6 +115,7 @@ farming.registered_plants["farming:pineapple"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -4,19 +4,24 @@
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- potato
minetest.register_craftitem("farming:potato", {
description = S("Potato"),
inventory_image = "farming_potato.png",
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,
-- 1 in 3 chance of being poisoned
on_use = function(itemstack, user, pointed_thing)
if user then
if math.random(3) == 1 then
return minetest.do_item_eat(-1, nil, itemstack, user, pointed_thing)
else
@ -28,41 +33,8 @@ minetest.register_craftitem("farming:potato", {
farming.add_eatable("farming:potato", 1)
-- baked potato
minetest.register_craftitem("farming:baked_potato", {
description = S("Baked Potato"),
inventory_image = "farming_baked_potato.png",
on_use = minetest.item_eat(6)
})
-- crop definition
farming.add_eatable("farming:baked_potato", 6)
minetest.register_craft({
type = "cooking",
cooktime = 10,
output = "farming:baked_potato",
recipe = "group:food_potato"
})
-- Potato and cucumber Salad
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")
})
farming.add_eatable("farming:potato_salad", 10)
minetest.register_craft({
output = "farming:potato_salad",
recipe = {
{"group:food_cucumber"},
{"farming:baked_potato"},
{"group:food_bowl"}
}
})
-- potato definition
local def = {
drawtype = "plantlike",
tiles = {"farming_potato_1.png"},
@ -83,13 +55,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:potato_1", table.copy(def))
-- stage 2
def.tiles = {"farming_potato_2.png"}
minetest.register_node("farming:potato_2", table.copy(def))
-- stage 3
def.tiles = {"farming_potato_3.png"}
def.drop = {
items = {
@ -99,7 +74,8 @@ def.drop = {
}
minetest.register_node("farming:potato_3", table.copy(def))
-- stage 4
-- stage 4 (final)
def.tiles = {"farming_potato_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -112,6 +88,7 @@ def.drop = {
minetest.register_node("farming:potato_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:potato"] = {
crop = "farming:potato",
seed = "farming:potato",
@ -121,6 +98,7 @@ farming.registered_plants["farming:potato"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,160 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- seed
-- pumpkin slice
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
},
groups = {compostability = 48, seed = 2, food_pumpkin_slice = 1},
on_use = minetest.item_eat(2),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
end,
on_use = minetest.item_eat(2)
end
})
farming.add_eatable("farming:pumpkin_slice", 2)
minetest.register_craft({
output = "farming:pumpkin",
recipe = {
{"farming:pumpkin_slice", "farming:pumpkin_slice"},
{"farming:pumpkin_slice", "farming:pumpkin_slice"}
}
})
-- crop definition
local tmp = farming.use_utensils and "farming:cutting_board" or ""
minetest.register_craft({
output = "farming:pumpkin_slice 4",
recipe = {{"farming:pumpkin", tmp}},
replacements = {{"farming:cutting_board", "farming:cutting_board"}}
})
-- jack 'o lantern
minetest.register_node("farming:jackolantern", {
description = S("Jack 'O Lantern (punch to turn on and off)"),
tiles = {
"farming_pumpkin_bottom.png^farming_pumpkin_top.png",
"farming_pumpkin_bottom.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png^farming_pumpkin_face_off.png"
},
paramtype2 = "facedir",
groups = {
handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2
},
is_ground_content = false,
sounds = farming.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
node.name = "farming:jackolantern_on"
minetest.swap_node(pos, node)
end,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_node("farming:jackolantern_on", {
tiles = {
"farming_pumpkin_bottom.png^farming_pumpkin_top.png",
"farming_pumpkin_bottom.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png^farming_pumpkin_face_on.png"
},
light_source = minetest.LIGHT_MAX - 1,
paramtype2 = "facedir",
groups = {
handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2,
not_in_creative_inventory = 1
},
is_ground_content = false,
sounds = farming.node_sound_wood_defaults(),
drop = "farming:jackolantern",
on_punch = function(pos, node, puncher)
local name = puncher:get_player_name() or ""
if minetest.is_protected(pos, name) then return end
node.name = "farming:jackolantern"
minetest.swap_node(pos, node)
end,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_craft({
output = "farming:jackolantern",
recipe = {
{"default:torch"},
{"group:food_pumpkin"}
}
})
--- wooden scarecrow base
minetest.register_node("farming:scarecrow_bottom", {
description = S("Scarecrow Bottom"),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"default_wood.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -8/16, -1/16, 1/16, 8/16, 1/16},
{-12/16, 4/16, -1/16, 12/16, 2/16, 1/16},
}
},
groups = {axey = 1, handy = 1, snappy = 3, flammable = 2},
is_ground_content = false,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_craft({
output = "farming:scarecrow_bottom",
recipe = {
{"", "group:stick", ""},
{"group:stick", "group:stick", "group:stick"},
{"", "group:stick", ""}
}
})
-- pumpkin bread
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}
})
farming.add_eatable("farming:pumpkin_bread", 8)
minetest.register_craftitem("farming:pumpkin_dough", {
description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png"
})
minetest.register_craft({
output = "farming:pumpkin_dough",
recipe = {
{"group:food_pumpkin_slice", "group:food_flour", "group:food_pumpkin_slice"}
}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_dough",
cooktime = 10
})
-- pumpkin definition
local def = {
drawtype = "plantlike",
tiles = {"farming_pumpkin_1.png"},
@ -175,33 +38,41 @@ local def = {
}
-- stage 1
minetest.register_node("farming:pumpkin_1", table.copy(def))
-- stage 2
def.tiles = {"farming_pumpkin_2.png"}
minetest.register_node("farming:pumpkin_2", table.copy(def))
-- stage 3
def.tiles = {"farming_pumpkin_3.png"}
minetest.register_node("farming:pumpkin_3", table.copy(def))
-- stage 4
def.tiles = {"farming_pumpkin_4.png"}
minetest.register_node("farming:pumpkin_4", table.copy(def))
-- stage 5
def.tiles = {"farming_pumpkin_5.png"}
minetest.register_node("farming:pumpkin_5", table.copy(def))
-- stage 6
def.tiles = {"farming_pumpkin_6.png"}
minetest.register_node("farming:pumpkin_6", table.copy(def))
-- stage 7
def.tiles = {"farming_pumpkin_7.png"}
minetest.register_node("farming:pumpkin_7", table.copy(def))
-- stage 8 (final)
minetest.register_node("farming:pumpkin_8", {
description = S("Pumpkin"),
tiles = {
@ -225,6 +96,7 @@ minetest.register_node("farming:pumpkin_8", {
minetest.register_alias("farming:pumpkin", "farming:pumpkin_8")
-- add to registered_plants
farming.registered_plants["farming:pumpkin"] = {
crop = "farming:pumpkin",
seed = "farming:pumpkin_slice",
@ -234,6 +106,7 @@ farming.registered_plants["farming:pumpkin"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- raspberries
minetest.register_craftitem("farming:raspberries", {
description = S("Raspberries"),
inventory_image = "farming_raspberries.png",
@ -10,34 +10,17 @@ minetest.register_craftitem("farming:raspberries", {
compostability = 48, seed = 2, food_raspberries = 1, food_raspberry = 1,
food_berry = 1
},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:raspberries", 1)
-- raspberry smoothie
minetest.register_craftitem("farming:smoothie_raspberry", {
description = S("Raspberry Smoothie"),
inventory_image = "farming_raspberry_smoothie.png",
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 65}
})
-- crop definition
farming.add_eatable("farming:smoothie_raspberry", 2)
minetest.register_craft({
output = "farming:smoothie_raspberry",
recipe = {
{a.snow},
{"group:food_raspberries"},
{a.drinking_glass}
}
})
-- raspberries definition
local def = {
drawtype = "plantlike",
tiles = {"farming_raspberry_1.png"},
@ -57,17 +40,21 @@ local def = {
}
-- stage 1
minetest.register_node("farming:raspberry_1", table.copy(def))
-- stage 2
def.tiles = {"farming_raspberry_2.png"}
minetest.register_node("farming:raspberry_2", table.copy(def))
-- stage 3
def.tiles = {"farming_raspberry_3.png"}
minetest.register_node("farming:raspberry_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_raspberry_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -81,6 +68,7 @@ def.drop = {
minetest.register_node("farming:raspberry_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:raspberries"] = {
crop = "farming:raspberry",
seed = "farming:raspberries",
@ -90,6 +78,7 @@ farming.registered_plants["farming:raspberries"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,43 +1,23 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- rhubarb
minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
groups = {
compostability = 48, seed = 2, food_rhubarb = 1
},
groups = {compostability = 48, seed = 2, food_rhubarb = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:rhubarb", 1)
-- rhubarb pie
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}
})
-- crop definition
farming.add_eatable("farming:rhubarb_pie", 6)
minetest.register_craft({
output = "farming:rhubarb_pie",
recipe = {
{a.baking_tray, "group:food_sugar", ""},
{"group:food_rhubarb", "group:food_rhubarb", "group:food_rhubarb"},
{"group:food_wheat", "group:food_wheat", "group:food_wheat"}
},
replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
})
-- rhubarb definition
local def = {
drawtype = "plantlike",
tiles = {"farming_rhubarb_1.png"},
@ -60,13 +40,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:rhubarb_1", table.copy(def))
-- stage2
def.tiles = {"farming_rhubarb_2.png"}
minetest.register_node("farming:rhubarb_2", table.copy(def))
-- stage3
def.tiles = {"farming_rhubarb_3.png"}
def.drop = {
items = {
@ -76,6 +59,7 @@ def.drop = {
minetest.register_node("farming:rhubarb_3", table.copy(def))
-- stage 4 (final)
def.tiles = {"farming_rhubarb_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -89,6 +73,7 @@ def.drop = {
minetest.register_node("farming:rhubarb_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:rhubarb"] = {
crop = "farming:rhubarb",
seed = "farming:rhubarb",
@ -98,6 +83,7 @@ farming.registered_plants["farming:rhubarb"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- rice seed
minetest.register_node("farming:seed_rice", {
description = S("Rice Seed"),
tiles = {"farming_rice_seed.png"},
@ -21,15 +21,18 @@ minetest.register_node("farming:seed_rice", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:rice_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_rice")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:rice_1", param2 = 3})
end
})
-- rice
-- rice item
minetest.register_craftitem("farming:rice", {
description = S("Rice"),
inventory_image = "farming_rice.png",
@ -37,6 +40,7 @@ minetest.register_craftitem("farming:rice", {
})
-- dry rice seed to give edible rice
minetest.register_craft({
type = "cooking",
cooktime = 1,
@ -44,39 +48,8 @@ minetest.register_craft({
recipe = "farming:seed_rice"
})
-- rice flour and bread
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, compostability = 65}
})
-- crop definition
farming.add_eatable("farming:rice_bread", 5)
minetest.register_craftitem("farming:rice_flour", {
description = S("Rice Flour"),
inventory_image = "farming_rice_flour.png",
groups = {food_rice_flour = 1, flammable = 1, compostability = 65}
})
minetest.register_craft({
output = "farming:rice_flour",
recipe = {
{"farming:rice", "farming:rice", "farming:rice"},
{"farming:rice", a.mortar_pestle, ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:rice_bread",
recipe = "farming:rice_flour"
})
-- rice definition
local def = {
drawtype = "plantlike",
tiles = {"farming_rice_1.png"},
@ -99,21 +72,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:rice_1", table.copy(def))
-- stage 2
def.tiles = {"farming_rice_2.png"}
minetest.register_node("farming:rice_2", table.copy(def))
-- stage 3
def.tiles = {"farming_rice_3.png"}
minetest.register_node("farming:rice_3", table.copy(def))
-- stage 4
def.tiles = {"farming_rice_4.png"}
minetest.register_node("farming:rice_4", table.copy(def))
-- stage 5
def.tiles = {"farming_rice_5.png"}
def.drop = {
items = {
@ -123,6 +101,7 @@ def.drop = {
minetest.register_node("farming:rice_5", table.copy(def))
-- stage 6
def.tiles = {"farming_rice_6.png"}
def.drop = {
items = {
@ -132,6 +111,7 @@ def.drop = {
minetest.register_node("farming:rice_6", table.copy(def))
-- stage 7
def.tiles = {"farming_rice_7.png"}
def.drop = {
items = {
@ -143,6 +123,7 @@ def.drop = {
minetest.register_node("farming:rice_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_rice_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -156,6 +137,7 @@ def.drop = {
minetest.register_node("farming:rice_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:rice"] = {
crop = "farming:rice",
seed = "farming:seed_rice",
@ -163,16 +145,3 @@ farming.registered_plants["farming:rice"] = {
maxlight = farming.max_light,
steps = 8
}
-- fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:rice",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:rice_bread",
burntime = 1
})

50
crops/rye_oat.lua Normal file
View File

@ -0,0 +1,50 @@
local S = minetest.get_translator("farming")
--= A nice addition from Ademant's grain mod :)
-- Rye
farming.register_plant("farming:rye", {
description = S("Rye seed"),
paramtype2 = "meshoptions",
inventory_image = "farming_rye_seed.png",
steps = 8,
place_param2 = 3
})
-- override rye item
minetest.override_item("farming:rye", {
description = S("Rye"),
groups = {food_rye = 1, flammable = 4, compostability = 65}
})
-- override rye crop
minetest.override_item("farming:rye_1", {drop = {}})
minetest.override_item("farming:rye_2", {drop = {}})
minetest.override_item("farming:rye_3", {drop = {}})
-- Oats
farming.register_plant("farming:oat", {
description = S("Oat seed"),
paramtype2 = "meshoptions",
inventory_image = "farming_oat_seed.png",
steps = 8,
place_param2 = 3
})
-- override oat item
minetest.override_item("farming:oat", {
description = S("Oats"),
groups = {food_oats = 1, flammable = 4, compostability = 65}
})
-- override oat crop
minetest.override_item("farming:oat_1", {drop = {}})
minetest.override_item("farming:oat_2", {drop = {}})
minetest.override_item("farming:oat_3", {drop = {}})

View File

@ -1,117 +0,0 @@
local S = farming.translate
local a = farming.recipe_items
--= A nice addition from Ademant's grain mod :)
-- Rye
farming.register_plant("farming:rye", {
description = S("Rye seed"),
paramtype2 = "meshoptions",
inventory_image = "farming_rye_seed.png",
steps = 8,
place_param2 = 3
})
minetest.override_item("farming:rye", {
description = S("Rye"),
groups = {food_rye = 1, flammable = 4, compostability = 65}
})
minetest.override_item("farming:rye_1", {drop = {}})
minetest.override_item("farming:rye_2", {drop = {}})
minetest.override_item("farming:rye_3", {drop = {}})
minetest.register_craft({
output = "farming:flour",
recipe = {
{"farming:rye", "farming:rye", "farming:rye"},
{"farming:rye", a.mortar_pestle, ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- Oats
farming.register_plant("farming:oat", {
description = S("Oat seed"),
paramtype2 = "meshoptions",
inventory_image = "farming_oat_seed.png",
steps = 8,
place_param2 = 3
})
minetest.override_item("farming:oat", {
description = S("Oats"),
groups = {food_oats = 1, flammable = 4, compostability = 65}
})
minetest.override_item("farming:oat_1", {drop = {}})
minetest.override_item("farming:oat_2", {drop = {}})
minetest.override_item("farming:oat_3", {drop = {}})
minetest.register_craft({
output = "farming:flour",
recipe = {
{"farming:oat", "farming:oat", "farming:oat"},
{"farming:oat", a.mortar_pestle, ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- Multigrain flour
minetest.register_craftitem("farming:flour_multigrain", {
description = S("Multigrain Flour"),
inventory_image = "farming_flour_multigrain.png",
groups = {food_flour = 1, flammable = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour_multigrain",
recipe = {
"group:food_wheat", "group:food_barley", "group:food_oats",
"group:food_rye", a.mortar_pestle
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- Multigrain bread
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, compostability = 65}
})
farming.add_eatable("farming:bread_multigrain", 7)
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread_multigrain",
recipe = "farming:flour_multigrain"
})
-- Fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:bread_multigrain",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:rye",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:oat",
burntime = 1
})

View File

@ -1,128 +1,22 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- soy pod
minetest.register_craftitem("farming:soy_pod", {
description = S("Soy Pod"),
inventory_image = "farming_soy_pod.png",
groups = {compostability = 48, 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
})
-- replacement for soy beans that was removed
minetest.register_alias("farming:soy_beans", "farming:soy_pod")
-- soy sauce
minetest.register_node("farming:soy_sauce", {
description = S("Soy Sauce"),
drawtype = "plantlike",
tiles = {"farming_soy_sauce.png"},
inventory_image = "farming_soy_sauce.png",
wield_image = "farming_soy_sauce.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
vessel = 1, food_soy_sauce = 1, dig_immediate = 3, attached_node = 1,
compostability = 65
},
is_ground_content = false,
sounds = farming.node_sound_glass_defaults()
})
-- soy sauce recipe
minetest.register_craft( {
output = "farming:soy_sauce",
recipe = {
{"group:food_soy", "group:food_salt", "group:food_soy"},
{a.juicer, a.bucket_water, a.glass_bottle}
},
replacements = {
{a.bucket_water, a.bucket_empty},
{"group:food_juicer", "farming:juicer"}
}
})
-- soy milk
minetest.register_node("farming:soy_milk", {
description = S("Soy Milk"),
drawtype = "plantlike",
tiles = {"farming_soy_milk_glass.png"},
inventory_image = "farming_soy_milk_glass.png",
wield_image = "farming_soy_milk_glass.png",
paramtype = "light",
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
groups = {
vessel = 1, food_milk_glass = 1, dig_immediate = 3,
attached_node = 1, drink = 1, compostability = 65
},
is_ground_content = false,
sounds = farming.node_sound_glass_defaults()
})
farming.add_eatable("farming:soy_milk", 2)
minetest.register_craft( {
output = "farming:soy_milk",
recipe = {
{"group:food_soy", "group:food_soy", "group:food_soy"},
{"farming:vanilla_extract", "bucket:bucket_water", a.drinking_glass}
},
replacements = {
{a.bucket_water, a.bucket_empty},
{"farming:vanilla_extract", a.glass_bottle}
}
})
-- tofu
minetest.register_craftitem("farming:tofu", {
description = S("Tofu"),
inventory_image = "farming_tofu.png",
groups = {
food_tofu = 1, food_meat_raw = 1, compostability = 65,
},
on_use = minetest.item_eat(3)
})
farming.add_eatable("farming:tofu", 3)
minetest.register_craft({
output = "farming:tofu",
recipe = {
{"group:food_soy", "group:food_soy", "group:food_soy"},
{"group:food_soy", "group:food_soy", a.baking_tray}
},
replacements = {{"farming:baking_tray", "farming:baking_tray"}}
})
-- cooked tofu
minetest.register_craftitem("farming:tofu_cooked", {
description = S("Cooked Tofu"),
inventory_image = "farming_tofu_cooked.png",
groups = {food_meat = 1, compostability = 65},
on_use = minetest.item_eat(6)
})
farming.add_eatable("farming:tofu_cooked", 6)
minetest.register_craft({
type = "cooking",
output = "farming:tofu_cooked",
recipe = "farming:tofu",
cooktime = 5
})
-- crop definition
local def = {
@ -147,21 +41,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:soy_1", table.copy(def))
-- stage 2
def.tiles = {"farming_soy_2.png"}
minetest.register_node("farming:soy_2", table.copy(def))
-- stage 3
def.tiles = {"farming_soy_3.png"}
minetest.register_node("farming:soy_3", table.copy(def))
-- stage 4
def.tiles = {"farming_soy_4.png"}
minetest.register_node("farming:soy_4", table.copy(def))
-- stage 5
def.tiles = {"farming_soy_5.png"}
def.drop = {
max_items = 1, items = {
@ -171,6 +70,7 @@ def.drop = {
minetest.register_node("farming:soy_5", table.copy(def))
-- stage 6
def.tiles = {"farming_soy_6.png"}
def.drop = {
max_items = 3, items = {
@ -181,7 +81,8 @@ def.drop = {
}
minetest.register_node("farming:soy_6", table.copy(def))
-- stage 7
-- stage 7 (final)
def.tiles = {"farming_soy_7.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -197,6 +98,7 @@ def.drop = {
minetest.register_node("farming:soy_7", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:soy_pod"] = {
crop = "farming:soy",
seed = "farming:soy_pod",
@ -206,6 +108,7 @@ farming.registered_plants["farming:soy_pod"] = {
}
-- mapgen
local mg = farming.mapgen == "v6"
def = {

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- spinach
minetest.register_craftitem("farming:spinach", {
description = S("Spinach"),
inventory_image = "farming_spinach.png",
groups = {
compostability = 48, seed = 2, food_spinach = 1
},
groups = {compostability = 48, seed = 2, food_spinach = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:spinach_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:spinach", 1)
-- definition
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_spinach_1.png"},
@ -37,13 +38,16 @@ local def = {
}
-- stage 1
minetest.register_node("farming:spinach_1", table.copy(def))
-- stage 2
def.tiles = {"farming_spinach_2.png"}
minetest.register_node("farming:spinach_2", table.copy(def))
-- stage 3
def.tiles = {"farming_spinach_3.png"}
def.drop = {
items = {
@ -54,6 +58,7 @@ def.drop = {
minetest.register_node("farming:spinach_3", table.copy(def))
-- stage 4
def.tiles = {"farming_spinach_4.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -67,6 +72,7 @@ def.drop = {
minetest.register_node("farming:spinach_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:spinach"] = {
crop = "farming:spinach",
seed = "farming:spinach",
@ -76,6 +82,7 @@ farming.registered_plants["farming:spinach"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,22 +1,23 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- Strawberry (can also be planted as seed)
minetest.register_craftitem(":ethereal:strawberry", {
description = S("Strawberry"),
inventory_image = "ethereal_strawberry.png",
groups = {
compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1
},
groups = {compostability = 48, seed = 2, food_strawberry = 1, food_berry = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "ethereal:strawberry_1")
end,
on_use = minetest.item_eat(1)
})
farming.add_eatable("ethereal:strawberry", 1)
-- Define Strawberry Bush growth stages
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"ethereal_strawberry_1.png"},
@ -40,25 +41,31 @@ local def = {
}
--stage 1
minetest.register_node(":ethereal:strawberry_1", table.copy(def))
-- stage 2
def.tiles = {"ethereal_strawberry_2.png"}
minetest.register_node(":ethereal:strawberry_2", table.copy(def))
-- stage 3
def.tiles = {"ethereal_strawberry_3.png"}
minetest.register_node(":ethereal:strawberry_3", table.copy(def))
-- stage 4
def.tiles = {"ethereal_strawberry_4.png"}
minetest.register_node(":ethereal:strawberry_4", table.copy(def))
-- stage 5
def.tiles = {"ethereal_strawberry_5.png"}
minetest.register_node(":ethereal:strawberry_5", table.copy(def))
-- stage 6
def.tiles = {"ethereal_strawberry_6.png"}
def.drop = {
items = {
@ -69,6 +76,7 @@ def.drop = {
minetest.register_node(":ethereal:strawberry_6", table.copy(def))
-- stage 7
def.tiles = {"ethereal_strawberry_7.png"}
def.drop = {
items = {
@ -78,7 +86,8 @@ def.drop = {
}
minetest.register_node(":ethereal:strawberry_7", table.copy(def))
-- stage 8
-- stage 8 (final)
def.tiles = {"ethereal_strawberry_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -91,6 +100,7 @@ def.drop = {
minetest.register_node(":ethereal:strawberry_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["ethereal:strawberry"] = {
crop = "ethereal:strawberry",
seed = "ethereal:strawberry",
@ -100,6 +110,7 @@ farming.registered_plants["ethereal:strawberry"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,15 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- sunflower
minetest.register_craftitem("farming:sunflower", {
description = S("Sunflower"),
inventory_image = "farming_sunflower.png",
groups = {flammable = 2}
})
-- seed
-- sunflower seeds
minetest.register_node("farming:seed_sunflower", {
description = S("Sunflower Seeds"),
tiles = {"farming_sunflower_seeds.png"},
@ -28,9 +21,11 @@ minetest.register_node("farming:seed_sunflower", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:sunflower_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_sunflower")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:sunflower_1", param2 = 1})
end
@ -38,89 +33,23 @@ minetest.register_node("farming:seed_sunflower", {
minetest.register_alias("farming:sunflower_seeds", "farming:seed_sunflower")
-- item
minetest.register_craftitem("farming:sunflower", {
description = S("Sunflower"),
inventory_image = "farming_sunflower.png",
groups = {flammable = 2}
})
-- turn item into seeds
minetest.register_craft({
output = "farming:seed_sunflower 5",
recipe = {{"farming:sunflower"}}
})
-- sunflower seeds (toasted)
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, compostability = 65
},
on_use = minetest.item_eat(1)
})
-- crop definition
farming.add_eatable("farming:sunflower_seeds_toasted", 1)
minetest.register_craft({
type = "cooking",
cooktime = 10,
output = "farming:sunflower_seeds_toasted",
recipe = "farming:seed_sunflower"
})
-- sunflower oil
minetest.register_node("farming:sunflower_oil", {
description = S("Bottle of Sunflower Oil"),
drawtype = "plantlike",
tiles = {"farming_sunflower_oil.png"},
inventory_image = "farming_sunflower_oil.png",
wield_image = "farming_sunflower_oil.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
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,
flammable = 2, compostability = 65
},
sounds = farming.node_sound_glass_defaults()
})
minetest.register_craft( {
output = "farming:sunflower_oil",
recipe = {
{"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
{"group:food_sunflower_seeds", "group:food_sunflower_seeds", "group:food_sunflower_seeds"},
{"group:food_sunflower_seeds", a.glass_bottle, "group:food_sunflower_seeds"}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:sunflower_oil",
burntime = 30,
replacements = {{"farming:sunflower_oil", a.glass_bottle}}
})
-- sunflower seed bread
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}
})
farming.add_eatable("farming:sunflower_bread", 8)
minetest.register_craft({
output = "farming:sunflower_bread",
recipe = {
{
"group:food_sunflower_seeds_toasted",
"group:food_bread",
"group:food_sunflower_seeds_toasted"
}
}
})
-- sunflower definition
local def = {
drawtype = "plantlike",
tiles = {"farming_sunflower_1.png"},
@ -141,34 +70,42 @@ local def = {
}
-- stage 1
minetest.register_node("farming:sunflower_1", table.copy(def))
-- stage 2
def.tiles = {"farming_sunflower_2.png"}
minetest.register_node("farming:sunflower_2", table.copy(def))
-- stage 3
def.tiles = {"farming_sunflower_3.png"}
minetest.register_node("farming:sunflower_3", table.copy(def))
-- stage 4
def.tiles = {"farming_sunflower_4.png"}
minetest.register_node("farming:sunflower_4", table.copy(def))
-- stage 5
def.tiles = {"farming_sunflower_5.png"}
minetest.register_node("farming:sunflower_5", table.copy(def))
-- stage 6
def.tiles = {"farming_sunflower_6.png"}
def.visual_scale = 1.9
minetest.register_node("farming:sunflower_6", table.copy(def))
-- stage 7
def.tiles = {"farming_sunflower_7.png"}
minetest.register_node("farming:sunflower_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_sunflower_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -181,6 +118,7 @@ def.drop = {
minetest.register_node("farming:sunflower_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:sunflower"] = {
crop = "farming:sunflower",
seed = "farming:seed_sunflower",
@ -190,6 +128,7 @@ farming.registered_plants["farming:sunflower"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -4,41 +4,25 @@
http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1288375-food-plus-mod-more-food-than-you-can-imagine-v2-9)
]]
local S = farming.translate
local S = minetest.get_translator("farming")
-- item/seed
-- tomato
minetest.register_craftitem("farming:tomato", {
description = S("Tomato"),
inventory_image = "farming_tomato.png",
groups = {compostability = 45, seed = 2, food_tomato = 1},
on_use = minetest.item_eat(4),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
end,
on_use = minetest.item_eat(4)
end
})
farming.add_eatable("farming:tomato", 4)
-- tomato soup
minetest.register_craftitem("farming:tomato_soup", {
description = S("Tomato Soup"),
inventory_image = "farming_tomato_soup.png",
groups = {compostability = 65},
on_use = minetest.item_eat(8, "farming:bowl")
})
-- crop definition
farming.add_eatable("farming:tomato_soup", 8)
minetest.register_craft({
output = "farming:tomato_soup",
recipe = {
{"group:food_tomato"},
{"group:food_tomato"},
{"group:food_bowl"}
}
})
-- tomato definition
local def = {
drawtype = "plantlike",
tiles = {"farming_tomato_1.png"},
@ -59,29 +43,36 @@ local def = {
}
-- stage 1
minetest.register_node("farming:tomato_1", table.copy(def))
-- stage2
def.tiles = {"farming_tomato_2.png"}
minetest.register_node("farming:tomato_2", table.copy(def))
-- stage 3
def.tiles = {"farming_tomato_3.png"}
minetest.register_node("farming:tomato_3", table.copy(def))
-- stage 4
def.tiles = {"farming_tomato_4.png"}
minetest.register_node("farming:tomato_4", table.copy(def))
-- stage 5
def.tiles = {"farming_tomato_5.png"}
minetest.register_node("farming:tomato_5", table.copy(def))
-- stage 6
def.tiles = {"farming_tomato_6.png"}
minetest.register_node("farming:tomato_6", table.copy(def))
-- stage 7
def.tiles = {"farming_tomato_7.png"}
def.drop = {
items = {
@ -92,6 +83,7 @@ def.drop = {
minetest.register_node("farming:tomato_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_tomato_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -105,6 +97,7 @@ def.drop = {
minetest.register_node("farming:tomato_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:tomato"] = {
crop = "farming:tomato",
seed = "farming:tomato",
@ -114,6 +107,7 @@ farming.registered_plants["farming:tomato"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,23 +1,23 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- item/seed
-- vanilla
minetest.register_craftitem("farming:vanilla", {
description = S("Vanilla"),
inventory_image = "farming_vanilla.png",
groups = {
compostability = 48, seed = 2, food_vanilla = 1
},
groups = {compostability = 48, seed = 2, food_vanilla = 1},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:vanilla_1")
end,
on_use = minetest.item_eat(1)
end
})
farming.add_eatable("farming:vanilla", 1)
-- crop definition
local def = {
drawtype = "plantlike",
tiles = {"farming_vanilla_1.png"},
@ -37,67 +37,38 @@ local def = {
sounds = farming.node_sound_leaves_defaults()
}
-- vanilla extract
minetest.register_node("farming:vanilla_extract", {
description = S("Vanilla Extract"),
drawtype = "plantlike",
tiles = {"farming_vanilla_extract.png"},
inventory_image = "farming_vanilla_extract.png",
wield_image = "farming_vanilla_extract.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = farming.node_sound_glass_defaults(),
})
minetest.register_craft( {
output = "farming:vanilla_extract",
recipe = {
{"group:food_vanilla", "group:food_vanilla", "group:food_vanilla"},
{"group:food_vanilla", "farming:bottle_ethanol", "group:food_glass_water"},
},
replacements = {
{"group:food_glass_water", a.drinking_glass}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:vanilla_extract",
burntime = 25,
replacements = {{"farming:vanilla_extract", a.glass_bottle}}
})
-- stage 1
minetest.register_node("farming:vanilla_1", table.copy(def))
-- stage 2
def.tiles = {"farming_vanilla_2.png"}
minetest.register_node("farming:vanilla_2", table.copy(def))
-- stage 3
def.tiles = {"farming_vanilla_3.png"}
minetest.register_node("farming:vanilla_3", table.copy(def))
-- stage 4
def.tiles = {"farming_vanilla_4.png"}
minetest.register_node("farming:vanilla_4", table.copy(def))
-- stage 5
def.tiles = {"farming_vanilla_5.png"}
minetest.register_node("farming:vanilla_5", table.copy(def))
-- stage 6
def.tiles = {"farming_vanilla_6.png"}
def.visual_scale = 1.9
minetest.register_node("farming:vanilla_6", table.copy(def))
-- stage 7
def.tiles = {"farming_vanilla_7.png"}
def.drop = {
items = {
@ -109,6 +80,7 @@ def.drop = {
minetest.register_node("farming:vanilla_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_vanilla_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -123,6 +95,7 @@ def.drop = {
minetest.register_node("farming:vanilla_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:vanilla"] = {
crop = "farming:vanilla",
seed = "farming:vanilla",
@ -132,6 +105,7 @@ farming.registered_plants["farming:vanilla"] = {
}
-- mapgen
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"},

View File

@ -1,8 +1,8 @@
local S = farming.translate
local a = farming.recipe_items
local S = minetest.get_translator("farming")
-- seed
-- wheat seeds
minetest.register_node("farming:seed_wheat", {
description = S("Wheat Seed"),
tiles = {"farming_wheat_seed.png"},
@ -20,101 +20,26 @@ minetest.register_node("farming:seed_wheat", {
sunlight_propagates = true,
selection_box = farming.select,
next_plant = "farming:wheat_1",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:seed_wheat")
end,
on_timer = function(pos, elapsed)
minetest.set_node(pos, {name = "farming:wheat_1", param2 = 3})
end
})
-- harvested wheat
-- item
minetest.register_craftitem("farming:wheat", {
description = S("Wheat"),
inventory_image = "farming_wheat.png",
groups = {food_wheat = 1, flammable = 4}
})
-- straw
minetest.register_node("farming:straw", {
description = S("Straw"),
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {handy = 1, snappy = 3, flammable = 4, fall_damage_add_percent = -30},
sounds = farming.node_sound_leaves_defaults(),
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
-- crop definition
minetest.register_craft({
output = "farming:straw 3",
recipe = {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", "farming:wheat", "farming:wheat"}
}
})
minetest.register_craft({
output = "farming:wheat 3",
recipe = {{"farming:straw"}}
})
-- check and register stairs
if minetest.global_exists("stairs") then
if stairs.mod and stairs.mod == "redo" then
stairs.register_all("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw",
farming.node_sound_leaves_defaults())
else
stairs.register_stair_and_slab("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
farming.node_sound_leaves_defaults())
end
end
-- flour
minetest.register_craftitem("farming:flour", {
description = S("Flour"),
inventory_image = "farming_flour.png",
groups = {food_flour = 1, flammable = 1}
})
minetest.register_craft({
output = "farming:flour",
recipe = {
{"farming:wheat", "farming:wheat", "farming:wheat"},
{"farming:wheat", a.mortar_pestle, ""}
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- bread
minetest.register_craftitem("farming:bread", {
description = S("Bread"),
inventory_image = "farming_bread.png",
on_use = minetest.item_eat(5),
groups = {food_bread = 1}
})
farming.add_eatable("farming:bread", 5)
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- wheat definition
local def = {
drawtype = "plantlike",
tiles = {"farming_wheat_1.png"},
@ -137,21 +62,26 @@ local def = {
}
-- stage 1
minetest.register_node("farming:wheat_1", table.copy(def))
-- stage 2
def.tiles = {"farming_wheat_2.png"}
minetest.register_node("farming:wheat_2", table.copy(def))
-- stage 3
def.tiles = {"farming_wheat_3.png"}
minetest.register_node("farming:wheat_3", table.copy(def))
-- stage 4
def.tiles = {"farming_wheat_4.png"}
minetest.register_node("farming:wheat_4", table.copy(def))
-- stage 5
def.tiles = {"farming_wheat_5.png"}
def.drop = {
items = {
@ -162,6 +92,7 @@ def.drop = {
minetest.register_node("farming:wheat_5", table.copy(def))
-- stage 6
def.tiles = {"farming_wheat_6.png"}
def.drop = {
items = {
@ -172,6 +103,7 @@ def.drop = {
minetest.register_node("farming:wheat_6", table.copy(def))
-- stage 7
def.tiles = {"farming_wheat_7.png"}
def.drop = {
items = {
@ -184,6 +116,7 @@ def.drop = {
minetest.register_node("farming:wheat_7", table.copy(def))
-- stage 8 (final)
def.tiles = {"farming_wheat_8.png"}
def.groups.growing = nil
def.selection_box = farming.select_final
@ -198,6 +131,7 @@ def.drop = {
minetest.register_node("farming:wheat_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:wheat"] = {
crop = "farming:wheat",
seed = "farming:seed_wheat",
@ -205,16 +139,3 @@ farming.registered_plants["farming:wheat"] = {
maxlight = farming.max_light,
steps = 8
}
-- fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:straw",
burntime = 3
})
minetest.register_craft({
type = "fuel",
recipe = "farming:wheat",
burntime = 1
})

923
food.lua
View File

@ -1,923 +0,0 @@
local S = farming.translate
local a = farming.recipe_items
-- sliced bread
minetest.register_craftitem("farming:bread_slice", {
description = S("Sliced Bread"),
inventory_image = "farming_bread_slice.png",
on_use = minetest.item_eat(1),
groups = {food_bread_slice = 1, compostability = 65}
})
farming.add_eatable("farming:bread_slice", 1)
minetest.register_craft({
output = "farming:bread_slice 5",
recipe = {{"group:food_bread", a.cutting_board}},
replacements = {{"group:food_cutting_board", "farming:cutting_board"}}
})
-- toast
minetest.register_craftitem("farming:toast", {
description = S("Toast"),
inventory_image = "farming_toast.png",
on_use = minetest.item_eat(1),
groups = {food_toast = 1, compostability = 65}
})
farming.add_eatable("farming:toast", 1)
minetest.register_craft({
type = "cooking",
cooktime = 3,
output = "farming:toast",
recipe = "farming:bread_slice"
})
-- toast sandwich
minetest.register_craftitem("farming:toast_sandwich", {
description = S("Toast Sandwich"),
inventory_image = "farming_toast_sandwich.png",
on_use = minetest.item_eat(4),
groups = {compostability = 85}
})
farming.add_eatable("farming:toast_sandwich", 4)
minetest.register_craft({
output = "farming:toast_sandwich",
recipe = {
{"farming:bread_slice"},
{"farming:toast"},
{"farming:bread_slice"}
}
})
-- filter sea water into river water
minetest.register_craft({
output = a.bucket_river_water,
recipe = {
{"farming:hemp_fibre"},
{"farming:hemp_fibre"},
{a.bucket_water}
}
})
if farming.mcl then
minetest.register_craft({
output = "mcl_potions:river_water",
recipe = {
{"farming:hemp_fibre"},
{"mcl_potions:water"}
}
})
end
-- glass of water
minetest.register_craftitem("farming:glass_water", {
description = S("Glass of Water"),
inventory_image = "farming_water_glass.png",
groups = {food_glass_water = 1, flammable = 3, vessel = 1}
})
minetest.register_craft({
output = "farming:glass_water 4",
recipe = {
{a.drinking_glass, a.drinking_glass},
{a.drinking_glass, a.drinking_glass},
{a.bucket_river_water, ""}
},
replacements = {{a.bucket_river_water, a.bucket_empty}}
})
minetest.register_craft({
output = "farming:glass_water 4",
recipe = {
{a.drinking_glass, a.drinking_glass},
{a.drinking_glass, a.drinking_glass},
{a.bucket_water, "farming:hemp_fibre"}
},
replacements = {{a.bucket_water, a.bucket_empty}}
})
if minetest.get_modpath("bucket_wooden") then
minetest.register_craft({
output = "farming:glass_water 4",
recipe = {
{a.drinking_glass, a.drinking_glass},
{a.drinking_glass, a.drinking_glass},
{"group:water_bucket_wooden", "farming:hemp_fibre"}
},
replacements = {{"group:water_bucket_wooden", "bucket_wooden:bucket_empty"}}
})
end
-- Sugar
if not farming.mcl then
minetest.register_craftitem("farming:sugar", {
description = S("Sugar"),
inventory_image = "farming_sugar.png",
groups = {food_sugar = 1, flammable = 3}
})
minetest.register_craft({
type = "cooking",
cooktime = 3,
output = "farming:sugar 2",
recipe = "default:papyrus"
})
end
minetest.register_node("farming:sugar_cube", {
description = S("Sugar Cube"),
tiles = {"farming_sugar_cube.png"},
groups = {shovely = 1, handy = 1, crumbly = 2},
is_ground_content = false,
floodable = true,
sounds = farming.node_sound_gravel_defaults(),
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_craft({
output = "farming:sugar_cube",
recipe = {
{a.sugar, a.sugar, a.sugar},
{a.sugar, a.sugar, a.sugar},
{a.sugar, a.sugar, a.sugar}
}
})
minetest.register_craft({
output = a.sugar .. " 9",
recipe = {{"farming:sugar_cube"}}
})
-- Sugar caramel
minetest.register_craftitem("farming:caramel", {
description = S("Caramel"),
inventory_image = "farming_caramel.png",
groups = {compostability = 40}
})
minetest.register_craft({
type = "cooking",
cooktime = 6,
output = "farming:caramel",
recipe = "group:food_sugar"
})
-- Salt
minetest.register_node("farming:salt", {
description = S("Salt"),
inventory_image = "farming_salt.png",
wield_image = "farming_salt.png",
drawtype = "plantlike",
visual_scale = 0.8,
paramtype = "light",
tiles = {"farming_salt.png"},
groups = {food_salt = 1, vessel = 1, dig_immediate = 3, attached_node = 1},
is_ground_content = false,
sounds = farming.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
-- special function to make salt crystals form inside water
dropped_step = function(self, pos, dtime)
self.ctimer = (self.ctimer or 0) + dtime
if self.ctimer < 15.0 then return end
self.ctimer = 0
local needed
if self.node_inside
and self.node_inside.name == a.water_source then
needed = 8
elseif self.node_inside
and self.node_inside.name == a.river_water_source then
needed = 9
end
if not needed then return end
local objs = core.get_objects_inside_radius(pos, 0.5)
if not objs or #objs ~= 1 then return end
local salt, ent = nil, nil
for k, obj in pairs(objs) do
ent = obj:get_luaentity()
if ent and ent.name == "__builtin:item"
and ent.itemstring == "farming:salt " .. needed then
obj:remove()
core.add_item(pos, "farming:salt_crystal")
return false -- return with no further action
end
end
end
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:salt",
recipe = a.bucket_water,
replacements = {{a.bucket_water, a.bucket_empty}}
})
-- Salt Crystal
minetest.register_node("farming:salt_crystal", {
description = S("Salt crystal"),
inventory_image = "farming_salt_crystal.png",
wield_image = "farming_salt_crystal.png",
drawtype = "plantlike",
visual_scale = 0.8,
paramtype = "light",
light_source = 1,
tiles = {"farming_salt_crystal.png"},
groups = {dig_immediate = 3, attached_node = 1},
is_ground_content = false,
sounds = farming.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_craft({
output = "farming:salt 9",
recipe = {
{"farming:salt_crystal", a.mortar_pestle}
},
replacements = {{"farming:mortar_pestle", "farming:mortar_pestle"}}
})
minetest.register_craft({
output = "farming:salt_crystal",
recipe = {
{"farming:salt", "farming:salt", "farming:salt"},
{"farming:salt", "farming:salt", "farming:salt"},
{"farming:salt", "farming:salt", "farming:salt"}
}
})
-- Mayonnaise
minetest.register_node("farming:mayonnaise", {
description = S("Mayonnaise"),
drawtype = "plantlike",
tiles = {"farming_mayo.png"},
inventory_image = "farming_mayo.png",
wield_image = "farming_mayo.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
on_use = minetest.item_eat(3),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.45, 0.25}
},
groups = {
compostability = 65, food_mayonnaise = 1, vessel = 1, dig_immediate = 3,
attached_node = 1
},
sounds = farming.node_sound_glass_defaults()
})
farming.add_eatable("farming:mayonnaise", 3)
minetest.register_craft({
output = "farming:mayonnaise",
recipe = {
{"group:food_olive_oil", "group:food_lemon"},
{"group:food_egg", "farming:salt"}
},
replacements = {{"farming:olive_oil", a.glass_bottle}}
})
-- Rose Water
minetest.register_node("farming:rose_water", {
description = S("Rose Water"),
inventory_image = "farming_rose_water.png",
wield_image = "farming_rose_water.png",
drawtype = "plantlike",
visual_scale = 0.8,
paramtype = "light",
tiles = {"farming_rose_water.png"},
groups = {
food_rose_water = 1, vessel = 1, dig_immediate = 3, attached_node = 1
},
is_ground_content = false,
sounds = farming.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
}
})
minetest.register_craft({
output = "farming:rose_water",
recipe = {
{a.rose, a.rose, a.rose},
{a.rose, a.rose, a.rose},
{"group:food_glass_water", a.pot, a.glass_bottle}
},
replacements = {
{"group:food_glass_water", a.drinking_glass},
{"group:food_pot", "farming:pot"}
}
})
-- Turkish Delight
minetest.register_craftitem("farming:turkish_delight", {
description = S("Turkish Delight"),
inventory_image = "farming_turkish_delight.png",
groups = {compostability = 85},
on_use = minetest.item_eat(2)
})
farming.add_eatable("farming:turkish_delight", 2)
minetest.register_craft({
output = "farming:turkish_delight 4",
recipe = {
{"group:food_gelatin", "group:food_sugar", "group:food_gelatin"},
{"group:food_sugar", "group:food_rose_water", "group:food_sugar"},
{"group:food_sugar", a.dye_pink, "group:food_sugar"}
},
replacements = {
{"group:food_cornstarch", a.bowl},
{"group:food_cornstarch", a.bowl},
{"group:food_rose_water", a.glass_bottle}
}
})
-- Garlic Bread
minetest.register_craftitem("farming:garlic_bread", {
description = S("Garlic Bread"),
inventory_image = "farming_garlic_bread.png",
groups = {compostability = 65},
on_use = minetest.item_eat(2)
})
farming.add_eatable("farming:garlic_bread", 2)
minetest.register_craft({
output = "farming:garlic_bread",
recipe = {
{"group:food_toast", "group:food_garlic_clove", "group:food_garlic_clove"}
}
})
-- Donuts (thanks to Bockwurst for making the donut images)
minetest.register_craftitem("farming:donut", {
description = S("Donut"),
inventory_image = "farming_donut.png",
on_use = minetest.item_eat(4),
groups = {compostability = 65}
})
farming.add_eatable("farming:donut", 4)
minetest.register_craft({
output = "farming:donut 3",
recipe = {
{"", "group:food_wheat", ""},
{"group:food_wheat", "group:food_sugar", "group:food_wheat"},
{"", "group:food_wheat", ""}
}
})
minetest.register_craftitem("farming:donut_chocolate", {
description = S("Chocolate Donut"),
inventory_image = "farming_donut_chocolate.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65}
})
farming.add_eatable("farming:donut_chocolate", 6)
minetest.register_craft({
output = "farming:donut_chocolate",
recipe = {
{"group:food_cocoa"},
{"farming:donut"}
}
})
minetest.register_craftitem("farming:donut_apple", {
description = S("Apple Donut"),
inventory_image = "farming_donut_apple.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65}
})
farming.add_eatable("farming:donut_apple", 6)
minetest.register_craft({
output = "farming:donut_apple",
recipe = {
{"group:food_apple"},
{"farming:donut"}
}
})
-- Porridge Oats
minetest.register_craftitem("farming:porridge", {
description = S("Porridge"),
inventory_image = "farming_porridge.png",
on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:porridge", 6)
minetest.register_craft({
output = "farming:porridge",
recipe = {
{"group:food_oats", "group:food_oats", "group:food_oats"},
{"group:food_oats", "group:food_bowl", "group:food_milk_glass"}
},
replacements = {
{"mobs:glass_milk", a.drinking_glass},
{"farming:soy_milk", a.drinking_glass}
}
})
-- Jaffa Cake
minetest.register_craftitem("farming:jaffa_cake", {
description = S("Jaffa Cake"),
inventory_image = "farming_jaffa_cake.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65}
})
farming.add_eatable("farming:jaffa_cake", 6)
minetest.register_craft({
output = "farming:jaffa_cake 3",
recipe = {
{a.baking_tray, "group:food_egg", "group:food_sugar"},
{a.flour, "group:food_cocoa", "group:food_orange"},
{"group:food_milk", "", ""}
},
replacements = {
{"farming:baking_tray", "farming:baking_tray"},
{"mobs:bucket_milk", a.bucket_empty},
{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"},
{"farming:soy_milk", a.drinking_glass}
}
})
-- Apple Pie
minetest.register_craftitem("farming:apple_pie", {
description = S("Apple Pie"),
inventory_image = "farming_apple_pie.png",
on_use = minetest.item_eat(6),
groups = {compostability = 75}
})
farming.add_eatable("farming:apple_pie", 6)
minetest.register_craft({
output = "farming:apple_pie",
recipe = {
{a.flour, "group:food_sugar", "group:food_apple"},
{"", a.baking_tray, ""}
},
replacements = {{"group:food_baking_tray", "farming:baking_tray"}}
})
-- Cactus Juice
minetest.register_craftitem("farming:cactus_juice", {
description = S("Cactus Juice"),
inventory_image = "farming_cactus_juice.png",
groups = {vessel = 1, drink = 1, compostability = 55},
on_use = function(itemstack, user, pointed_thing)
if user then
local num = math.random(5) == 1 and -1 or 2
return minetest.do_item_eat(num, "vessels:drinking_glass",
itemstack, user, pointed_thing)
end
end
})
farming.add_eatable("farming:cactus_juice", 1)
minetest.register_craft({
output = "farming:cactus_juice",
recipe = {
{a.juicer},
{a.cactus},
{a.drinking_glass}
},
replacements = {
{"group:food_juicer", "farming:juicer"}
}
})
-- Pasta
minetest.register_craftitem("farming:pasta", {
description = S("Pasta"),
inventory_image = "farming_pasta.png",
groups = {compostability = 65, food_pasta = 1}
})
minetest.register_craft({
output = "farming:pasta",
recipe = {
{a.flour, "group:food_butter", a.mixing_bowl}
},
replacements = {{"group:food_mixing_bowl", "farming:mixing_bowl"}}
})
minetest.register_craft({
output = "farming:pasta",
recipe = {
{a.flour, "group:food_oil", a.mixing_bowl}
},
replacements = {
{"group:food_mixing_bowl", "farming:mixing_bowl"},
{"group:food_oil", a.glass_bottle}
}
})
-- Mac & Cheese
minetest.register_craftitem("farming:mac_and_cheese", {
description = S("Mac & Cheese"),
inventory_image = "farming_mac_and_cheese.png",
on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:mac_and_cheese", 6)
minetest.register_craft({
output = "farming:mac_and_cheese",
recipe = {
{"group:food_pasta", "group:food_cheese", "group:food_bowl"}
}
})
-- Spaghetti
minetest.register_craftitem("farming:spaghetti", {
description = S("Spaghetti"),
inventory_image = "farming_spaghetti.png",
on_use = minetest.item_eat(8),
groups = {compostability = 65}
})
farming.add_eatable("farming:spaghetti", 8)
minetest.register_craft({
output = "farming:spaghetti",
recipe = {
{"group:food_pasta", "group:food_tomato", a.saucepan},
{"group:food_garlic_clove", "group:food_garlic_clove", ""}
},
replacements = {{"group:food_saucepan", "farming:saucepan"}}
})
-- Korean Bibimbap
minetest.register_craftitem("farming:bibimbap", {
description = S("Bibimbap"),
inventory_image = "farming_bibimbap.png",
on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:bibimbap", 8)
minetest.register_craft({
output = "farming:bibimbap",
recipe = {
{a.skillet, "group:food_bowl", "group:food_egg"},
{"group:food_rice", "group:food_chicken_raw", "group:food_cabbage"},
{"group:food_carrot", "group:food_chili_pepper", ""}
},
replacements = {{"group:food_skillet", "farming:skillet"}}
})
minetest.register_craft({
output = "farming:bibimbap",
type = "shapeless",
recipe = {
a.skillet, "group:food_bowl", "group:food_mushroom",
"group:food_rice", "group:food_cabbage", "group:food_carrot",
"group:food_mushroom", "group:food_chili_pepper"
},
replacements = {{"group:food_skillet", "farming:skillet"}}
})
-- Burger
minetest.register_craftitem("farming:burger", {
description = S("Burger"),
inventory_image = "farming_burger.png",
on_use = minetest.item_eat(16),
groups = {compostability = 95}
})
farming.add_eatable("farming:burger", 16)
minetest.register_craft({
output = "farming:burger",
recipe = {
{a.bread, "group:food_meat", "group:food_cheese"},
{"group:food_tomato", "group:food_cucumber", "group:food_onion"},
{"group:food_lettuce", "", ""}
}
})
-- Salad
minetest.register_craftitem("farming:salad", {
description = S("Salad"),
inventory_image = "farming_salad.png",
on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 45}
})
farming.add_eatable("farming:salad", 8)
minetest.register_craft({
output = "farming:salad",
type = "shapeless",
recipe = {
"group:food_bowl", "group:food_tomato", "group:food_cucumber",
"group:food_lettuce", "group:food_oil"
}
})
-- Triple Berry Smoothie
minetest.register_craftitem("farming:smoothie_berry", {
description = S("Triple Berry Smoothie"),
inventory_image = "farming_berry_smoothie.png",
on_use = minetest.item_eat(6, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1, compostability = 65}
})
farming.add_eatable("farming:smoothie_berry", 6)
minetest.register_craft({
output = "farming:smoothie_berry",
type = "shapeless",
recipe = {
"group:food_raspberries", "group:food_blackberries",
"group:food_strawberry", "group:food_banana",
a.drinking_glass
}
})
-- Patatas a la importancia
minetest.register_craftitem("farming:spanish_potatoes", {
description = S("Spanish Potatoes"),
inventory_image = "farming_spanish_potatoes.png",
on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:spanish_potatoes", 8)
minetest.register_craft({
output = "farming:spanish_potatoes",
recipe = {
{"group:food_potato", "group:food_parsley", "group:food_potato"},
{"group:food_egg", a.flour, "group:food_onion"},
{"farming:garlic_clove", "group:food_bowl", a.skillet}
},
replacements = {{"group:food_skillet", "farming:skillet"}}
})
-- Potato omelet
minetest.register_craftitem("farming:potato_omelet", {
description = S("Potato omelette"),
inventory_image = "farming_potato_omelet.png",
on_use = minetest.item_eat(6, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:potato_omelet", 6)
minetest.register_craft({
output = "farming:potato_omelet",
recipe = {
{"group:food_egg", "group:food_potato", "group:food_onion"},
{a.skillet, "group:food_bowl", ""}
},
replacements = {{"group:food_skillet", "farming:skillet"}}
})
-- Paella
minetest.register_craftitem("farming:paella", {
description = S("Paella"),
inventory_image = "farming_paella.png",
on_use = minetest.item_eat(8, a.bowl),
groups = {compostability = 65}
})
farming.add_eatable("farming:paella", 8)
minetest.register_craft({
output = "farming:paella",
recipe = {
{"group:food_rice", a.dye_orange, "farming:pepper_red"},
{"group:food_peas", "group:food_chicken", "group:food_bowl"},
{"", a.skillet, ""}
},
replacements = {{"group:food_skillet", "farming:skillet"}}
})
-- Flan
minetest.register_craftitem("farming:flan", {
description = S("Vanilla Flan"),
inventory_image = "farming_vanilla_flan.png",
on_use = minetest.item_eat(6),
groups = {compostability = 65}
})
farming.add_eatable("farming:flan", 6)
minetest.register_craft({
output = "farming:flan",
recipe = {
{"group:food_sugar", "group:food_milk", "farming:caramel"},
{"group:food_egg", "group:food_egg", "farming:vanilla_extract"}
},
replacements = {
{"cucina_vegana:soy_milk", a.drinking_glass},
{"mobs:bucket_milk", "bucket:bucket_empty"},
{"mobs:wooden_bucket_milk", "wooden_bucket:bucket_wood_empty"},
{"farming:vanilla_extract", a.glass_bottle}
}
})
-- Vegan Cheese
minetest.register_craftitem("farming:cheese_vegan", {
description = S("Vegan Cheese"),
inventory_image = "farming_cheese_vegan.png",
on_use = minetest.item_eat(2),
groups = {compostability = 65, food_cheese = 1}
})
farming.add_eatable("farming:cheese_vegan", 2)
minetest.register_craft({
output = "farming:cheese_vegan",
recipe = {
{"farming:soy_milk", "farming:soy_milk", "farming:soy_milk"},
{"group:food_salt", "group:food_peppercorn", "farming:bottle_ethanol"},
{"group:food_gelatin", a.pot, ""}
},
replacements = {
{"farming:soy_milk", a.drinking_glass .. " 3"},
{"farming:pot", "farming:pot"},
{"farming:bottle_ethanol", a.glass_bottle}
}
})
minetest.register_craft({
output = "farming:cheese_vegan",
recipe = {
{"farming:soy_milk", "farming:soy_milk", "farming:soy_milk"},
{"group:food_salt", "group:food_peppercorn", "group:food_lemon"},
{"group:food_gelatin", a.pot, ""}
},
replacements = {
{"farming:soy_milk", a.drinking_glass .. " 3"},
{"farming:pot", "farming:pot"}
}
})
-- Onigiri
minetest.register_craftitem("farming:onigiri", {
description = S("Onigiri"),
inventory_image = "farming_onigiri.png",
on_use = minetest.item_eat(2),
groups = {compostability = 65}
})
farming.add_eatable("farming:onigiri", 2)
minetest.register_craft({
output = "farming:onigiri",
recipe = {
{"group:food_rice", "group:food_salt", "group:food_rice"},
{"", "group:food_seaweed", ""}
}
})
-- Gyoza
minetest.register_craftitem("farming:gyoza", {
description = S("Gyoza"),
inventory_image = "farming_gyoza.png",
on_use = minetest.item_eat(4),
groups = {compostability = 65}
})
farming.add_eatable("farming:gyoza", 4)
minetest.register_craft({
output = "farming:gyoza 4",
recipe = {
{"group:food_cabbage", "group:food_garlic_clove", "group:food_onion"},
{"group:food_meat_raw", "group:food_salt", a.flour},
{"", a.skillet, ""}
},
replacements = {
{"group:food_skillet", "farming:skillet"}
}
})
-- Mochi
minetest.register_craftitem("farming:mochi", {
description = S("Mochi"),
inventory_image = "farming_mochi.png",
on_use = minetest.item_eat(3),
groups = {compostability = 65}
})
farming.add_eatable("farming:mochi", 3)
minetest.register_craft({
output = "farming:mochi",
recipe = {
{"", a.mortar_pestle, ""},
{"group:food_rice", "group:food_sugar", "group:food_rice"},
{"", "group:food_glass_water", ""}
},
replacements = {
{"group:food_mortar_pestle", "farming:mortar_pestle"},
{"group:food_glass_water", a.drinking_glass}
}
})
-- Gingerbread Man
minetest.register_craftitem("farming:gingerbread_man", {
description = S("Gingerbread Man"),
inventory_image = "farming_gingerbread_man.png",
on_use = minetest.item_eat(2),
groups = {compostability = 85}
})
farming.add_eatable("farming:gingerbread_man", 2)
minetest.register_craft({
output = "farming:gingerbread_man 3",
recipe = {
{"", "group:food_egg", ""},
{"group:food_wheat", "group:food_ginger", "group:food_wheat"},
{"group:food_sugar", "", "group:food_sugar"}
}
})

View File

@ -1,5 +1,5 @@
-- Override grasses to drop seeds
-- Override grass to drop wheat and oat seeds
local rarity_lookup = {[1] = 50, [2] = 50, [3] = 50, [4] = 5, [5] = 5}
@ -20,6 +20,8 @@ if minetest.registered_nodes["default:grass_1"] then
end
end
-- override dry grass to drop barley and rye seeds
if minetest.registered_nodes["default:dry_grass_1"] then
for i = 1, 5 do
@ -37,6 +39,8 @@ if minetest.registered_nodes["default:dry_grass_1"] then
end
end
-- override jungle grass to drop cotton and rice seeds
if minetest.registered_nodes["default:junglegrass"] then
minetest.override_item("default:junglegrass", {
@ -51,6 +55,8 @@ if minetest.registered_nodes["default:junglegrass"] then
})
end
-- override mineclone tallgrass to drop all sof the above seeds
if farming.mcl then
minetest.override_item("mcl_flowers:tallgrass", {

View File

@ -1,28 +1,22 @@
local S = farming.translate
local tr = minetest.get_modpath("toolranks")
-- translation and mod check
local S = minetest.get_translator("farming")
local mod_tr = minetest.get_modpath("toolranks")
-- Hoe registration function
farming.register_hoe = function(name, def)
-- Check for : prefix (register new hoes in your mod's namespace)
if name:sub(1,1) ~= ":" then
name = ":" .. name
end
if name:sub(1,1) ~= ":" then name = ":" .. name end
-- Check def table
if def.description == nil then
def.description = S("Hoe")
end
if def.description == nil then def.description = S("Hoe") end
if def.inventory_image == nil then
def.inventory_image = "unknown_item.png"
end
if def.inventory_image == nil then def.inventory_image = "unknown_item.png" end
if def.max_uses == nil then
def.max_uses = 30
end
if def.max_uses == nil then def.max_uses = 30 end
-- add hoe group
def.groups = def.groups or {}
@ -32,20 +26,23 @@ farming.register_hoe = function(name, def)
minetest.register_tool(name, {
description = def.description,
inventory_image = def.inventory_image,
groups = def.groups,
sound = {breaks = "default_tool_breaks"},
on_use = function(itemstack, user, pointed_thing)
return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses)
end,
groups = def.groups,
sound = {breaks = "default_tool_breaks"}
end
})
-- Register its recipe
if def.recipe then
minetest.register_craft({
output = name:sub(2),
recipe = def.recipe
})
elseif def.material then
minetest.register_craft({
output = name:sub(2),
recipe = {
@ -64,8 +61,7 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- am I going to hoe the top of a dirt node?
if not pt or pt.type ~= "node"
or pt.above.y ~= pt.under.y + 1 then
if not pt or pt.type ~= "node" or pt.above.y ~= pt.under.y + 1 then
return
end
@ -82,22 +78,17 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then
return
end
or not minetest.registered_nodes[above.name] then return end
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
if above.name ~= "air" then return end
-- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
if minetest.get_item_group(under.name, "soil") ~= 1 then return end
-- check if (wet) soil defined
local ndef = minetest.registered_nodes[under.name]
if ndef.soil == nil or ndef.soil.wet == nil or ndef.soil.dry == nil then
return
end
@ -116,14 +107,15 @@ function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
local wear = 65535 / (uses - 1)
if farming.is_creative(user:get_player_name()) then
if tr then
if mod_tr then
wear = 1
else
wear = 0
end
end
if tr then
if mod_tr then
itemstack = toolranks.new_afteruse(itemstack, user, under, {wear = wear})
else
itemstack:add_wear(wear)
@ -188,7 +180,8 @@ farming.register_hoe(":farming:hoe_diamond", {
})
-- Toolranks support
if tr then
if mod_tr then
minetest.override_item("farming:hoe_wood", {
original_description = S("Wood Hoe"),
@ -215,8 +208,8 @@ if tr then
description = toolranks.create_description(S("Diamond Hoe"))})
end
-- hoe bomb function
local function hoe_area(pos, player)
-- check for protection
@ -229,9 +222,8 @@ local function hoe_area(pos, player)
-- remove flora (grass, flowers etc.)
local res = minetest.find_nodes_in_area(
{x = pos.x - r, y = pos.y - 1, z = pos.z - r},
{x = pos.x + r, y = pos.y + 2, z = pos.z + r},
{"group:flora"})
{x = pos.x - r, y = pos.y - 1, z = pos.z - r},
{x = pos.x + r, y = pos.y + 2, z = pos.z + r}, {"group:flora"})
for n = 1, #res do
minetest.swap_node(res[n], {name = "air"})
@ -249,8 +241,8 @@ local function hoe_area(pos, player)
end
end
-- throwable hoe bomb entity
-- throwable hoe bomb
minetest.register_entity("farming:hoebomb_entity", {
initial_properties = {
@ -280,9 +272,7 @@ minetest.register_entity("farming:hoebomb_entity", {
local vel = self.object:get_velocity()
-- only when potion hits something physical
if vel.x == 0
or vel.y == 0
or vel.z == 0 then
if vel.x == 0 or vel.y == 0 or vel.z == 0 then
if self.player ~= "" then
@ -303,8 +293,8 @@ minetest.register_entity("farming:hoebomb_entity", {
end
})
-- actual throwing function
local function throw_potion(itemstack, player)
local playerpos = player:get_pos()
@ -327,12 +317,13 @@ local function throw_potion(itemstack, player)
obj:get_luaentity().player = player
end
-- hoe bomb item
minetest.register_craftitem("farming:hoe_bomb", {
description = S("Hoe Bomb (use or throw on grassy areas to hoe land)"),
inventory_image = "farming_hoe_bomb.png",
groups = {flammable = 2, not_in_creative_inventory = 1},
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type == "node" then
@ -381,22 +372,16 @@ minetest.register_tool("farming:scythe_mithril", {
on_use = function(itemstack, placer, pointed_thing)
if pointed_thing.type ~= "node" then
return
end
if pointed_thing.type ~= "node" then return end
local pos = pointed_thing.under
local name = placer:get_player_name()
if minetest.is_protected(pos, name) then
return
end
if minetest.is_protected(pos, name) then return end
local node = minetest.get_node_or_nil(pos)
if not node then
return
end
if not node then return end
local def = minetest.registered_nodes[node.name]
@ -414,9 +399,7 @@ minetest.register_tool("farming:scythe_mithril", {
local mname = node.name:split(":")[1]
local pname = node_not_num(node.name:split(":")[2])
if not pname then
return
end
if not pname then return end
-- add dropped items
for _, dropped_item in pairs(drops) do
@ -470,9 +453,11 @@ minetest.register_tool("farming:scythe_mithril", {
return itemstack
end
end,
end
})
-- if moreores found add mithril scythe recipe
if minetest.get_modpath("moreores") then
minetest.register_craft({

239
init.lua
View File

@ -5,6 +5,11 @@
auto-refill by crabman77
]]
-- Translation support
local S = minetest.get_translator("farming")
-- set global
farming = {
mod = "redo",
version = "20240811",
@ -22,7 +27,8 @@ farming = {
use_utensils = minetest.settings:get_bool("farming_use_utensils") ~= false,
mtg = minetest.get_modpath("default"),
mcl = minetest.get_modpath("mcl_core"),
mcl_hardness = 0.01
mcl_hardness = 0.01,
translate = S
}
-- determine which sounds to use, default or mcl_sounds
@ -46,36 +52,28 @@ sound_helper("node_sound_water_defaults")
sound_helper("node_sound_snow_defaults")
sound_helper("node_sound_glass_defaults")
-- check for creative mode or priv
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
function farming.is_creative(name)
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
end
-- stats, locals, settings, function helper
local statistics = dofile(farming.path .. "/statistics.lua")
-- Translation support
local S = minetest.get_translator("farming")
farming.translate = S
-- localise
local random = math.random
local floor = math.floor
-- Utility Function
local time_speed = tonumber(minetest.settings:get("time_speed")) or 72
local SECS_PER_CYCLE = (time_speed > 0 and (24 * 60 * 60) / time_speed) or 0
local function clamp(x, min, max)
return (x < min and min) or (x > max and max) or x
end
-- return amount of day or night that has elapsed
-- dt is time elapsed, count_day if true counts day, otherwise night
local function day_or_night_time(dt, count_day)
local t_day = minetest.get_timeofday()
@ -104,7 +102,9 @@ local function day_or_night_time(dt, count_day)
local dt_c = clamp(t2_c, 0, 0.5) - clamp(t1_c, 0, 0.5) -- this cycle
if t1_c < -0.5 then
local nc = floor(-t1_c)
t1_c = t1_c + nc
dt_c = dt_c + 0.5 * nc + clamp(-t1_c - 0.5, 0, 0.5)
end
@ -112,14 +112,13 @@ local function day_or_night_time(dt, count_day)
return dt_c * SECS_PER_CYCLE
end
-- Growth Logic
local STAGE_LENGTH_AVG = tonumber(
minetest.settings:get("farming_stage_length")) or 200
local STAGE_LENGTH_AVG = tonumber(minetest.settings:get("farming_stage_length")) or 200
local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6
-- quick start seed timer
farming.start_seed_timer = function(pos)
local timer = minetest.get_node_timer(pos)
@ -128,16 +127,15 @@ farming.start_seed_timer = function(pos)
timer:start(grow_time)
end
-- return plant name and stage from node provided
local function plant_name_stage(node)
local name
if type(node) == "table" then
if node.name then
name = node.name
if node.name then name = node.name
elseif node.x and node.y and node.z then
node = minetest.get_node_or_nil(node)
name = node and node.name
@ -146,9 +144,7 @@ local function plant_name_stage(node)
name = tostring(node)
end
if not name or name == "ignore" then
return nil
end
if not name or name == "ignore" then return nil end
local sep_pos = name:find("_[^_]+$")
@ -164,7 +160,6 @@ local function plant_name_stage(node)
return name, 0
end
-- Map from node name to
-- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } }
@ -173,30 +168,24 @@ local plant_stages = {}
farming.plant_stages = plant_stages
--- Registers the stages of growth of a (possible plant) node.
--
-- @param node
-- Node or position table, or node name.
-- @return
-- The (possibly zero) number of stages of growth the plant will go through
-- before being fully grown, or nil if not a plant.
-- @param node - Node or position table, or node name.
-- @return - The (possibly zero) number of stages of growth the plant will go through
-- before being fully grown, or nil if not a plant.
local register_plant_node
-- Recursive helper
local function reg_plant_stages(plant_name, stage, force_last)
local node_name = plant_name and plant_name .. "_" .. stage
local node_def = node_name and minetest.registered_nodes[node_name]
if not node_def then
return nil
end
if not node_def then return nil end
local stages = plant_stages[node_name]
if stages then
return stages
end
if stages then return stages end
if minetest.get_item_group(node_name, "growing") > 0 then
@ -219,9 +208,7 @@ local function reg_plant_stages(plant_name, stage, force_last)
on_construct = function(pos)
if old_constr then
old_constr(pos)
end
if old_constr then old_constr(pos) end
farming.handle_growth(pos)
end,
@ -230,9 +217,7 @@ local function reg_plant_stages(plant_name, stage, force_last)
minetest.get_node_timer(pos):stop()
if old_destr then
old_destr(pos)
end
if old_destr then old_destr(pos) end
end,
on_timer = function(pos, elapsed)
@ -275,9 +260,7 @@ end
local function set_growing(pos, stages_left)
if not stages_left then
return
end
if not stages_left then return end
local timer = minetest.get_node_timer(pos)
@ -297,19 +280,15 @@ local function set_growing(pos, stages_left)
end
end
-- detects a crop at given position, starting or stopping growth timer when needed
function farming.handle_growth(pos, node)
if not pos then
return
end
if not pos then return end
local stages_left = register_plant_node(node or pos)
if stages_left then
set_growing(pos, stages_left)
end
if stages_left then set_growing(pos, stages_left) end
end
@ -320,21 +299,20 @@ minetest.after(0, function()
end
end)
-- Just in case a growing type or added node is missed (also catches existing
-- nodes added to map before timers were incorporated).
minetest.register_abm({
label = "Start crop timer",
nodenames = {"group:growing"},
interval = 300,
chance = 1,
catch_up = false,
action = function(pos, node)
-- skip if node timer already active
if minetest.get_node_timer(pos):is_started() then
return
end
if minetest.get_node_timer(pos):is_started() then return end
-- check if group:growing node is a seed
local def = minetest.registered_nodes[node.name]
@ -367,27 +345,24 @@ minetest.register_abm({
end
})
-- default check if on wet soil
-- check if on wet soil
farming.can_grow = function(pos)
local below = minetest.get_node({x = pos.x, y = pos.y -1, z = pos.z})
return minetest.get_item_group(below.name, "soil") >= 3
end
-- Plant timer function that grows plants under the right conditions.
function farming.plant_growth_timer(pos, elapsed, node_name)
local stages = plant_stages[node_name]
if not stages then
return false
end
if not stages then return false end
local max_growth = #stages.stages_left
if max_growth <= 0 then
return false
end
if max_growth <= 0 then return false end
local chk1 = minetest.registered_nodes[node_name].growth_check -- old
local chk2 = minetest.registered_nodes[node_name].can_grow -- new
@ -395,29 +370,21 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
-- custom farming redo growth_check function
if chk1 then
if not chk1(pos, node_name) then
return true
end
if not chk1(pos, node_name) then return true end
-- custom mt 5.9x farming can_grow function
elseif chk2 then
if not chk2(pos) then
return true
end
if not chk2(pos) then return true end
-- default mt 5.9x farming.can_grow function
elseif not farming.can_grow(pos) then
return true
end
elseif not farming.can_grow(pos) then return true end
local growth
local light_pos = {x = pos.x, y = pos.y, z = pos.z}
local lambda = elapsed / STAGE_LENGTH_AVG
if lambda < 0.1 then
return true
end
if lambda < 0.1 then return true end
local MIN_LIGHT = minetest.registered_nodes[node_name].minlight or farming.min_light
local MAX_LIGHT = minetest.registered_nodes[node_name].maxlight or farming.max_light
@ -426,9 +393,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
local light = (minetest.get_node_light(light_pos) or 0)
if light < MIN_LIGHT or light > MAX_LIGHT then
return true
end
if light < MIN_LIGHT or light > MAX_LIGHT then return true end
growth = 1
else
@ -439,9 +404,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
if not night_growth then
if not day_growth then
return true
end
if not day_growth then return true end
lambda = day_or_night_time(elapsed, true) / STAGE_LENGTH_AVG
@ -452,9 +415,7 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
growth = statistics.poisson(lambda, max_growth)
if growth < 1 then
return true
end
if growth < 1 then return true end
end
if minetest.registered_nodes[stages.stages_left[growth]] then
@ -469,8 +430,8 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
return growth ~= max_growth
end
-- refill placed plant by crabman (26/08/2015) updated by TenPlus1
function farming.refill_plant(player, plantname, index)
if not player then return end
@ -481,9 +442,7 @@ function farming.refill_plant(player, plantname, index)
local old_stack = inv:get_stack("main", index)
if old_stack:get_name() ~= "" then
return
end
if old_stack:get_name() ~= "" then return end
for i, stack in ipairs(inv:get_list("main")) do
@ -498,22 +457,21 @@ function farming.refill_plant(player, plantname, index)
end
end
-- Place Seeds on Soil
function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local pt = pointed_thing
-- check if pointing at a node
if not itemstack or not pt or pt.type ~= "node" then
return
end
if not itemstack or not pt or pt.type ~= "node" then return end
local under = minetest.get_node(pt.under)
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and itemstack and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack, pt)
end
@ -521,23 +479,16 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
local above = minetest.get_node(pt.above)
-- check if pointing at the top of the node
if pt.above.y ~= pt.under.y + 1 then
return
end
if pt.above.y ~= pt.under.y + 1 then return end
-- return if any of the nodes is not registered
if not minetest.registered_nodes[under.name]
or not minetest.registered_nodes[above.name] then
return
end
or not minetest.registered_nodes[above.name] then return end
-- can I replace above node, and am I pointing at soil
-- can I replace above node, and am I pointing directly at soil
if not minetest.registered_nodes[above.name].buildable_to
or minetest.get_item_group(under.name, "soil") < 2
-- avoid multiple seed placement bug
or minetest.get_item_group(above.name, "plant") ~= 0 then
return
end
or minetest.get_item_group(above.name, "plant") ~= 0 then return end
-- is player planting seed?
local name = placer and placer:get_player_name() or ""
@ -549,9 +500,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
minetest.set_node(pt.above, {name = plantname, param2 = p2})
farming.start_seed_timer(pt.above)
--minetest.get_node_timer(pt.above):start(1)
--farming.handle_growth(pt.above)--, node)
farming.start_seed_timer(pt.above)
minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0})
@ -565,12 +514,8 @@ farming.start_seed_timer(pt.above)
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.2,
farming.refill_plant,
placer,
name,
placer:get_wield_index()
)
minetest.after(0.2, farming.refill_plant,
placer, name, placer:get_wield_index())
end
end
@ -578,13 +523,11 @@ farming.start_seed_timer(pt.above)
end
end
-- Function to register plants (default farming compatibility)
farming.register_plant = function(name, def)
if not def.steps then
return nil
end
if not def.steps then return nil end
local mname = name:split(":")[1]
local pname = name:split(":")[2]
@ -622,14 +565,12 @@ farming.register_plant = function(name, def)
local def = minetest.registered_nodes[mname .. ":" .. pname .. "_1"]
if def then
minetest.swap_node(pos, {
name = def.next_plant,
param2 = def.place_param2
})
minetest.swap_node(pos, {name = def.next_plant, param2 = def.place_param2})
end
end,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing,
mname .. ":seed_" .. pname)
end
@ -703,21 +644,21 @@ farming.register_plant = function(name, def)
})
end
-- add to farming.registered_plants
farming.registered_plants[mname .. ":" .. pname] = {
crop = mname .. ":" .. pname,
seed = mname .. ":seed_" .. pname,
steps = def.steps,
minlight = def.minlight,
maxlight = def.maxlight
}
--print(dump(farming.registered_plants[mname .. ":" .. pname]))
-- Return info
-- add to farming.registered_plants
farming.registered_plants[mname .. ":" .. pname] = {
crop = mname .. ":" .. pname,
seed = mname .. ":seed_" .. pname,
steps = def.steps,
minlight = def.minlight,
maxlight = def.maxlight
}
-- print(dump(farming.registered_plants[mname .. ":" .. pname]))
return {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname}
end
-- default settings
farming.asparagus = 0.002
farming.eggplant = 0.002
farming.spinach = 0.002
@ -758,23 +699,26 @@ farming.strawberry = 0.002
farming.grains = true
farming.rice = true
-- Load new global settings if found inside mod folder
local input = io.open(farming.path .. "/farming.conf", "r")
if input then
dofile(farming.path .. "/farming.conf")
input:close()
dofile(farming.path .. "/farming.conf") ; input:close()
end
-- load new world-specific settings if found inside world folder
local worldpath = minetest.get_worldpath()
input = io.open(worldpath .. "/farming.conf", "r")
if input then
dofile(worldpath .. "/farming.conf")
input:close()
dofile(worldpath .. "/farming.conf") ; input:close()
end
-- helper function to add {eatable} group to food items
-- helper function to add {eatable} group to food items, also {flammable}
function farming.add_eatable(item, hp)
local def = minetest.registered_items[item]
@ -789,19 +733,21 @@ function farming.add_eatable(item, hp)
end
end
-- recipe items
dofile(farming.path .. "/items.lua")
-- recipe item list and alternatives
dofile(farming.path .. "/items_list.lua")
-- important items
if minetest.get_modpath("default") then
dofile(farming.path .. "/soil.lua")
dofile(farming.path .. "/hoes.lua")
end
dofile(farming.path.."/grass.lua")
dofile(farming.path.."/utensils.lua")
-- default crops
if not farming.mcl then
dofile(farming.path.."/crops/wheat.lua")
end
@ -809,6 +755,7 @@ end
dofile(farming.path.."/crops/cotton.lua")
-- disable crops Mineclone already has
if farming.mcl then
farming.carrot = nil
farming.potato = nil
@ -820,11 +767,10 @@ if farming.mcl then
end
-- helper function
local function ddoo(file, check)
if check then
dofile(farming.path .. "/crops/" .. file)
end
if check then dofile(farming.path .. "/crops/" .. file) end
end
-- add additional crops and food (if enabled)
@ -851,7 +797,7 @@ ddoo("pineapple.lua", farming.pineapple)
ddoo("peas.lua", farming.peas)
ddoo("beetroot.lua", farming.beetroot)
ddoo("chili.lua", farming.chili)
ddoo("ryeoatrice.lua", farming.grains)
ddoo("rye_oat.lua", farming.grains)
ddoo("rice.lua", farming.rice)
ddoo("mint.lua", farming.mint)
ddoo("cabbage.lua", farming.cabbage)
@ -868,7 +814,12 @@ ddoo("eggplant.lua", farming.eggplant)
ddoo("spinach.lua", farming.eggplant)
ddoo("ginger.lua", farming.ginger)
dofile(farming.path .. "/food.lua")
-- register food items, non-food items, recipes and stairs
dofile(farming.path .. "/items_non_food.lua")
dofile(farming.path .. "/items_food.lua")
dofile(farming.path .. "/item_recipes.lua")
dofile(farming.path .. "/item_stairs.lua")
if not farming.mcl then
dofile(farming.path .. "/compatibility.lua") -- Farming Plus compatibility

1390
item_recipes.lua Normal file

File diff suppressed because it is too large Load Diff

35
item_stairs.lua Normal file
View File

@ -0,0 +1,35 @@
-- check and register stairs
if minetest.global_exists("stairs") then
if stairs.mod and stairs.mod == "redo" then
stairs.register_all("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw",
farming.node_sound_leaves_defaults())
stairs.register_all("hemp_block", "farming:hemp_block",
{snappy = 2, oddly_breakable_by_hand = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block",
farming.node_sound_leaves_defaults())
else
stairs.register_stair_and_slab("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
farming.node_sound_leaves_defaults())
stairs.register_stair_and_slab("hemp_block", "farming:hemp_block",
{snappy = 2, oddly_breakable_by_hand = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block Stair",
"Hemp Block Slab",
farming.node_sound_leaves_defaults())
end
end

1014
items_food.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,24 @@
-- add group function
-- add group helper
local function add_groups(item, groups)
local def = minetest.registered_items[item]
if not def then return end
if def then
local grp = def.groups
local grps = table.copy(def.groups) or {}
for k, v in pairs(groups) do
grp[k] = v
for k, v in pairs(groups) do
grps[k] = v
end
minetest.override_item(item, {groups = grps})
end
minetest.override_item(item, {groups = grp})
end
-- default recipe items
farming.recipe_items = {
-- if utensils are disabled then use blank item
@ -62,7 +65,8 @@ farming.recipe_items = {
add_groups("default:apple", {food_apple = 1})
-- change recipe items to mineclone variations
-- if mineclone found then change recipe items
if farming.mcl then
local a = farming.recipe_items
@ -97,6 +101,8 @@ if farming.mcl then
a.stone = "mcl_core:stone"
a.glass = "mcl_core:glass"
-- add missing groups for recipes to work properly
add_groups("mcl_core:sugar", {food_sugar = 1})
add_groups("mcl_throwing:egg", {food_egg = 1})
add_groups("mcl_farming:wheat_item", {food_wheat = 1})
@ -114,8 +120,6 @@ if farming.mcl then
add_groups("mcl_mobitems:milk_bucket", {food_milk = 1})
add_groups("mcl_ocean:dried_kelp", {food_seaweed = 1})
add_groups("mcl_potions:river_water", {food_glass_water = 1})
-- add missing food groups to current items so recipes work
add_groups("mcl_dye:yellow", {food_lemon = 1, food_banana = 1})
add_groups("mcl_dye:orange", {food_orange = 1})
add_groups("mcl_flowers:sunflower", {food_olive_oil = 1, food_butter = 1})

269
items_non_food.lua Normal file
View File

@ -0,0 +1,269 @@
local S = minetest.get_translator("farming")
-- wooden bowl
minetest.register_craftitem("farming:bowl", {
description = S("Wooden Bowl"),
inventory_image = "farming_bowl.png",
groups = {food_bowl = 1, flammable = 2}
})
-- saucepan
minetest.register_craftitem("farming:saucepan", {
description = S("Saucepan"),
inventory_image = "farming_saucepan.png",
groups = {food_saucepan = 1, flammable = 2}
})
-- cooking pot
minetest.register_craftitem("farming:pot", {
description = S("Cooking Pot"),
inventory_image = "farming_pot.png",
groups = {food_pot = 1, flammable = 2}
})
-- baking tray
minetest.register_craftitem("farming:baking_tray", {
description = S("Baking Tray"),
inventory_image = "farming_baking_tray.png",
groups = {food_baking_tray = 1, flammable = 2}
})
-- skillet
minetest.register_craftitem("farming:skillet", {
description = S("Skillet"),
inventory_image = "farming_skillet.png",
groups = {food_skillet = 1, flammable = 2}
})
-- mortar & pestle
minetest.register_craftitem("farming:mortar_pestle", {
description = S("Mortar and Pestle"),
inventory_image = "farming_mortar_pestle.png",
groups = {food_mortar_pestle = 1, flammable = 2}
})
-- cutting board
minetest.register_craftitem("farming:cutting_board", {
description = S("Cutting Board"),
inventory_image = "farming_cutting_board.png",
groups = {food_cutting_board = 1, flammable = 2}
})
-- juicer
minetest.register_craftitem("farming:juicer", {
description = S("Juicer"),
inventory_image = "farming_juicer.png",
groups = {food_juicer = 1, flammable = 2}
})
-- glass mixing bowl
minetest.register_craftitem("farming:mixing_bowl", {
description = S("Glass Mixing Bowl"),
inventory_image = "farming_mixing_bowl.png",
groups = {food_mixing_bowl = 1, flammable = 2}
})
-- Ethanol (thanks to JKMurray for this idea)
minetest.register_node("farming:bottle_ethanol", {
description = S("Bottle of Ethanol"),
drawtype = "plantlike",
tiles = {"farming_bottle_ethanol.png"},
inventory_image = "farming_bottle_ethanol.png",
wield_image = "farming_bottle_ethanol.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = farming.node_sound_glass_defaults()
})
-- String
if not farming.mcl then
minetest.register_craftitem("farming:string", {
description = S("String"),
inventory_image = "farming_string.png",
groups = {flammable = 2}
})
end
-- straw
minetest.register_node("farming:straw", {
description = S("Straw"),
tiles = {"farming_straw.png"},
is_ground_content = false,
groups = {handy = 1, snappy = 3, flammable = 4, fall_damage_add_percent = -30},
sounds = farming.node_sound_leaves_defaults(),
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
-- hemp oil
minetest.register_node("farming:hemp_oil", {
description = S("Bottle of Hemp Oil"),
drawtype = "plantlike",
tiles = {"farming_hemp_oil.png"},
inventory_image = "farming_hemp_oil.png",
wield_image = "farming_hemp_oil.png",
paramtype = "light",
is_ground_content = false,
walkable = false,
selection_box = {
type = "fixed",
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,
compostability = 45
},
sounds = farming.node_sound_glass_defaults()
})
-- hemp fibre
minetest.register_craftitem("farming:hemp_fibre", {
description = S("Hemp Fibre"),
inventory_image = "farming_hemp_fibre.png",
groups = {compostability = 55}
})
-- hemp block
minetest.register_node("farming:hemp_block", {
description = S("Hemp Block"),
tiles = {"farming_hemp_block.png"},
paramtype = "light",
groups = {
axey = 1, handy = 1, snappy = 2, oddly_breakable_by_hand = 1, flammable = 2,
compostability = 85
},
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
-- hemp rope
minetest.register_node("farming:hemp_rope", {
description = S("Hemp Rope"),
walkable = false,
climbable = true,
sunlight_propagates = true,
paramtype = "light",
tiles = {"farming_hemp_rope.png"},
wield_image = "farming_hemp_rope.png",
inventory_image = "farming_hemp_rope.png",
drawtype = "plantlike",
groups = {
handy = 1, axey = 1, swordy = 1, flammable = 2, choppy = 3,
oddly_breakable_by_hand = 3, compostability = 55
},
is_ground_content = false,
sounds = farming.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7}
},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
-- Jack 'O Lantern
minetest.register_node("farming:jackolantern", {
description = S("Jack 'O Lantern (punch to turn on and off)"),
tiles = {
"farming_pumpkin_bottom.png^farming_pumpkin_top.png",
"farming_pumpkin_bottom.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png^farming_pumpkin_face_off.png"
},
paramtype2 = "facedir",
groups = {
handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2
},
is_ground_content = false,
sounds = farming.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
node.name = "farming:jackolantern_on"
minetest.swap_node(pos, node)
end,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
minetest.register_node("farming:jackolantern_on", {
tiles = {
"farming_pumpkin_bottom.png^farming_pumpkin_top.png",
"farming_pumpkin_bottom.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png^farming_pumpkin_face_on.png"
},
light_source = minetest.LIGHT_MAX - 1,
paramtype2 = "facedir",
groups = {
handy = 1, snappy = 2, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2,
not_in_creative_inventory = 1
},
is_ground_content = false,
sounds = farming.node_sound_wood_defaults(),
drop = "farming:jackolantern",
on_punch = function(pos, node, puncher)
local name = puncher:get_player_name() or ""
if minetest.is_protected(pos, name) then return end
node.name = "farming:jackolantern"
minetest.swap_node(pos, node)
end,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})
--- Wooden scarecrow base
minetest.register_node("farming:scarecrow_bottom", {
description = S("Scarecrow Bottom"),
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"default_wood.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-1/16, -8/16, -1/16, 1/16, 8/16, 1/16},
{-12/16, 4/16, -1/16, 12/16, 2/16, 1/16},
}
},
groups = {axey = 1, handy = 1, snappy = 3, flammable = 2},
is_ground_content = false,
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1
})

View File

@ -1,3 +1,6 @@
-- add lucky blocks
lucky_block:add_blocks({
{"dro", {"farming:corn"}, 5},
{"dro", {"farming:coffee_cup_hot"}, 1},

View File

@ -1,25 +1,21 @@
local S = farming.translate
local S = minetest.get_translator("farming")
-- default dry soil node
local dry_soil = "farming:soil"
-- add soil types to existing dirt blocks
minetest.override_item("default:dirt", {
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
base = "default:dirt", dry = "farming:soil", wet = "farming:soil_wet"
}
})
minetest.override_item("default:dirt_with_grass", {
soil = {
base = "default:dirt_with_grass",
dry = "farming:soil",
wet = "farming:soil_wet"
base = "default:dirt_with_grass", dry = "farming:soil", wet = "farming:soil_wet"
}
})
@ -27,8 +23,7 @@ if minetest.registered_nodes["default:dirt_with_dry_grass"] then
minetest.override_item("default:dirt_with_dry_grass", {
soil = {
base = "default:dirt_with_dry_grass",
dry = "farming:soil",
base = "default:dirt_with_dry_grass", dry = "farming:soil",
wet = "farming:soil_wet"
}
})
@ -36,8 +31,7 @@ end
minetest.override_item("default:dirt_with_rainforest_litter", {
soil = {
base = "default:dirt_with_rainforest_litter",
dry = "farming:soil",
base = "default:dirt_with_rainforest_litter", dry = "farming:soil",
wet = "farming:soil_wet"
}
})
@ -46,29 +40,26 @@ if minetest.registered_nodes["default:dirt_with_coniferous_litter"] then
minetest.override_item("default:dirt_with_coniferous_litter", {
soil = {
base = "default:dirt_with_coniferous_litter",
dry = "farming:soil",
base = "default:dirt_with_coniferous_litter", dry = "farming:soil",
wet = "farming:soil_wet"
}
})
end
-- savanna soil
if minetest.registered_nodes["default:dry_dirt"] then
minetest.override_item("default:dry_dirt", {
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
base = "default:dry_dirt", dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
minetest.override_item("default:dry_dirt_with_dry_grass", {
soil = {
base = "default:dry_dirt_with_dry_grass",
dry = "farming:dry_soil",
base = "default:dry_dirt_with_dry_grass", dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
@ -84,8 +75,7 @@ if minetest.registered_nodes["default:dry_dirt"] then
is_ground_content = false,
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
base = "default:dry_dirt", dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
@ -101,8 +91,7 @@ if minetest.registered_nodes["default:dry_dirt"] then
is_ground_content = false,
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dry_dirt",
dry = "farming:dry_soil",
base = "default:dry_dirt", dry = "farming:dry_soil",
wet = "farming:dry_soil_wet"
}
})
@ -111,6 +100,7 @@ if minetest.registered_nodes["default:dry_dirt"] then
end
-- normal soil
minetest.register_node("farming:soil", {
description = S("Soil"),
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
@ -119,13 +109,12 @@ minetest.register_node("farming:soil", {
is_ground_content = false,
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
base = "default:dirt", dry = "farming:soil", wet = "farming:soil_wet"
}
})
-- wet soil
minetest.register_node("farming:soil_wet", {
description = S("Wet Soil"),
tiles = {
@ -137,19 +126,17 @@ minetest.register_node("farming:soil_wet", {
is_ground_content = false,
sounds = default.node_sound_dirt_defaults(),
soil = {
base = "default:dirt",
dry = "farming:soil",
wet = "farming:soil_wet"
base = "default:dirt", dry = "farming:soil", wet = "farming:soil_wet"
}
})
-- sand is not soil, change existing sand-soil to use dry soil
minetest.register_alias("farming:desert_sand_soil", dry_soil)
minetest.register_alias("farming:desert_sand_soil_wet", dry_soil .. "_wet")
-- if water near soil then change to wet soil
minetest.register_abm({
label = "Soil changes",
nodenames = {"group:field"},

View File

@ -1,12 +1,11 @@
local statistics = {}
local ROOT_2 = math.sqrt(2.0)
-- Approximations for erf(x) and erfInv(x) from
-- https://en.wikipedia.org/wiki/Error_function
local statistics = {}
local ROOT_2 = math.sqrt(2.0)
local erf
local erf_inv
local A = 8 * (math.pi - 3.0) / (3.0 * math.pi * (4.0 - math.pi))
local B = 4.0 / math.pi
local C = 2.0 / (math.pi * A)
@ -114,17 +113,16 @@ poisson = function(lambda, max)
end
end
-- Error function.
statistics.erf = erf
-- Inverse error function.
statistics.erf_inv = erf_inv
--- Standard normal distribution function (mean 0, standard deviation 1).
--
-- @return
-- Any real number (actually between -3.0 and 3.0).
-- @return - Any real number (actually between -3.0 and 3.0).
statistics.std_normal = function()
@ -139,15 +137,10 @@ statistics.std_normal = function()
return std_normal(u)
end
--- Standard normal distribution function (mean 0, standard deviation 1).
--
-- @param mu
-- The distribution mean.
-- @param sigma
-- The distribution standard deviation.
-- @return
-- Any real number (actually between -3*sigma and 3*sigma).
-- @param mu - The distribution mean.
-- @param sigma - The distribution standard deviation.
-- @return - Any real number (actually between -3*sigma and 3*sigma).
statistics.normal = function(mu, sigma)
@ -162,15 +155,10 @@ statistics.normal = function(mu, sigma)
return mu + sigma * std_normal(u)
end
--- Poisson distribution function.
--
-- @param lambda
-- The distribution mean and variance.
-- @param max
-- The distribution maximum.
-- @return
-- An integer between 0 and max (both inclusive).
-- @param lambda - The distribution mean and variance.
-- @param max - The distribution maximum.
-- @return - An integer between 0 and max (both inclusive).
statistics.poisson = function(lambda, max)
@ -181,5 +169,4 @@ statistics.poisson = function(lambda, max)
return poisson(lambda, max)
end
return statistics

View File

@ -1,164 +0,0 @@
local S = farming.translate
local a = farming.recipe_items
-- wooden bowl
minetest.register_craftitem("farming:bowl", {
description = S("Wooden Bowl"),
inventory_image = "farming_bowl.png",
groups = {food_bowl = 1, flammable = 2}
})
if not farming.mcl then
minetest.register_craft({
output = "farming:bowl 4",
recipe = {
{"group:wood", "", "group:wood"},
{"", "group:wood", ""}
}
})
end
minetest.register_craft({
type = "fuel",
recipe = "farming:bowl",
burntime = 10
})
-- saucepan
minetest.register_craftitem("farming:saucepan", {
description = S("Saucepan"),
inventory_image = "farming_saucepan.png",
groups = {food_saucepan = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:saucepan",
recipe = {
{a.steel_ingot, "", ""},
{"", "group:stick", ""}
}
})
-- cooking pot
minetest.register_craftitem("farming:pot", {
description = S("Cooking Pot"),
inventory_image = "farming_pot.png",
groups = {food_pot = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:pot",
recipe = {
{"group:stick", a.steel_ingot, a.steel_ingot},
{"", a.steel_ingot, a.steel_ingot}
}
})
-- baking tray
minetest.register_craftitem("farming:baking_tray", {
description = S("Baking Tray"),
inventory_image = "farming_baking_tray.png",
groups = {food_baking_tray = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:baking_tray",
recipe = {
{a.clay_brick, a.clay_brick, a.clay_brick},
{a.clay_brick, "", a.clay_brick},
{a.clay_brick, a.clay_brick, a.clay_brick}
}
})
-- skillet
minetest.register_craftitem("farming:skillet", {
description = S("Skillet"),
inventory_image = "farming_skillet.png",
groups = {food_skillet = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:skillet",
recipe = {
{a.steel_ingot, "", ""},
{"", a.steel_ingot, ""},
{"", "", "group:stick"}
}
})
-- mortar and pestle
minetest.register_craftitem("farming:mortar_pestle", {
description = S("Mortar and Pestle"),
inventory_image = "farming_mortar_pestle.png",
groups = {food_mortar_pestle = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:mortar_pestle",
recipe = {
{a.stone, "group:stick", a.stone},
{"", a.stone, ""}
}
})
-- cutting board
minetest.register_craftitem("farming:cutting_board", {
description = S("Cutting Board"),
inventory_image = "farming_cutting_board.png",
groups = {food_cutting_board = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:cutting_board",
recipe = {
{a.steel_ingot, "", ""},
{"", "group:stick", ""},
{"", "", "group:wood"}
}
})
-- juicer
minetest.register_craftitem("farming:juicer", {
description = S("Juicer"),
inventory_image = "farming_juicer.png",
groups = {food_juicer = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:juicer",
recipe = {
{"", a.stone, ""},
{a.stone, "", a.stone}
}
})
-- glass mixing bowl
minetest.register_craftitem("farming:mixing_bowl", {
description = S("Glass Mixing Bowl"),
inventory_image = "farming_mixing_bowl.png",
groups = {food_mixing_bowl = 1, flammable = 2}
})
minetest.register_craft({
output = "farming:mixing_bowl",
recipe = {
{a.glass, "group:stick", a.glass},
{"", a.glass, ""}
}
})
minetest.register_craft( {
output = "vessels:glass_fragments",
recipe = {{"farming:mixing_bowl"}}
})