add new mortar for awards

master
A. Demant 2018-11-28 16:54:51 +01:00
parent e295853ba0
commit 745a3b0036
206 changed files with 6123 additions and 1 deletions

62
README.md Normal file
View File

@ -0,0 +1,62 @@
# Farming Redo Mod
### by TenPlus1
https://forum.minetest.net/viewtopic.php?id=9019
Farming Redo is a simplified version of the built-in farming mod in minetest and comes with wheat, cotton, carrot, cucumber, potato and tomato to start out with which spawn throughout the map... new foods need only be planted on tilled soil so no seeds are required, original wheat and cotton will require seeds which are found inside normal and jungle grass...
This mod works by adding your new plant to the {growing=1} group and numbering the stages from _1 to as many stages as you like, but the underscore MUST be used only once in the node name to separate plant from stage number e.g.
"farming:cotton_1" through to "farming:cotton_8"
"farming:wheat_1" through to "farming:wheat_8"
"farming:cucumber_4" through to "farming:cucumber_4"
### Changelog:
- 1.38 - Pumpkin grows into block, use chopping board to cut into 4x slices, same with melon block, 2x2 slices makes a block, cocoa pods are no longer walkable
- 1.37 - Added custom 'growth_check(pos, nodename) function for crop nodes to use (check cocoa.lua for example)
- 1.36 - Added Beetroot, Beetroot Soup (6x beetroot, 1x bowl), fix register_plant() issue, add new recipes
- 1.35 - Deprecated bronze/mese/diamond hoe's, added hoe bomb and deprecated hoe's as lucky block prizes
- 1.34 - Added scarecrow Base (5x sticks in a cross shape)
- 1.33 - Added cooking utensils (wooden bowl, saucepan, cooking pot, baking tray, skillet, cutting board, mortar & pestle, juicer, glass mixing bowl) for easier food crafts.
- 1.32 - Added Pea plant (textures by Andrey01) - also added Wooden Bowl and Pea Soup crafts
- 1.31 - Added Pineapple which can be found growing in savannah areas (place pineapple in crafting to obtain 5x rings to eat and a top for re-planting), also Salt which is made from cooking a bucket of water, added food groups so it's more compatible with Ruben's food mods.
- 1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures
- 1.29 - Updating functions so requires Minetest 0.4.16 and above to run
- 1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge
- 1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string)
- 1.26 - Added support for [toolranks] mod when using hoe's
- 1.25 - Added check for farming.conf setting file to disable specific crops globally (inside mod folder) or world specific (inside world folder)
- 1.24 - Added Hemp which can be crafted into fibre, paper, string, rope and oil.
- 1.23 - Huge code tweak and tidy done and added barley seeds to be found in dry grass, barley can make flour for bread also.
- 1.22 - Added grape bushes at high climates which can be cultivated into grape vines using trellis (9 sticks).
- 1.21 - Added auto-refill code for planting crops (thanks crabman77), also fixed a few bugs
- 1.20b - Tidied code, made api compatible with new 0.4.13 changes and changed to soil texture overlays
- 1.20 - NEW growing routine added that allows crops to grow while player is away doing other things (thanks prestidigitator)
- 1.14 - Added Green Beans from Crops mod (thanks sofar), little bushels in the wild but need to be grown using beanpoles crafted with 4 sticks (2 either side)
- 1.13 - Fixed seed double-placement glitch. Mapgen now uses 0.4.12+ for plant generation
- 1.12 - Player cannot place seeds in protected area, also growing speeds changed to match defaults
- 1.11 - Added Straw Bale, streamlined growing abm a little, fixed melon rotation bug with screwdriver
- 1.10 - Added Blueberry Bush and Blueberry Muffins, also Pumpkin/Melon easier to pick up, added check for unloaded map
- 1.09 - Corn now uses single nodes instead of 1 ontop of the other, Ethanol recipe is more expensive (requires 5 corn) and some code cleanup.
- 1.08 - Added Farming Plus compatibility, plus can be removed and no more missing nodes
- 1.07 - Added Rhubarb and Rhubarb Pie
- 1.06 - register_hoe and register_plant added for compatibility with default farming mod, although any plants registered will use farming redo to grow
- 1.05 - Added Raspberry Bushels and Raspberry Smoothie
- 1.04 - Added Donuts... normal, chocolate and apple... and a few code cleanups and now compatible with jungletree's from MoreTrees mod
- 1.03 - Bug fixes and more compatibility as drop-in replacement for built-in farming mod
- 1.02 - Added farming.mod string to help other mods identify which farming mod is running, if it returns "redo" then you're using this one, "" empty is built-in mod
- 1.01 - Crafting coffee or ethanol returns empty bucket/bottle, also Cocoa spawns a little rarer
- 1.0 - Added Cocoa which randomly grows on jungle tree's, pods give cocoa beans which can be used to farm more pods on a jungle trunk or make Cookies which have been added (or other treats)
- 0.9 - Added Pumpkin, Jack 'O Lantern, Pumpkin Slice and Sugar (a huge thanks to painterly.net for allowing me to use their textures)
- 0.8 - Added Watermelon and Melon Slice
- 0.7 - Added Coffee, Coffee Beans, Drinking Cup, Cold and Hot Cup of Coffee
- 0.6 - Added Corn, Corn on the Cob... Also reworked Abm
- 0.5 - Added Carrot, Cucumber, Potato (and Baked Potato), Tomato
- 0.4 - Checks for Protection, also performance changes
- 0.3 - Added Diamond and Mese hoe
- 0.2 - Fixed check for wet soil
- 0.1 - Fixed growing bug
- 0.0 - Initial release
### Lucky Blocks: 30

View File

@ -96,3 +96,5 @@ Created by ademant (CC BY 3.0):
farming_spelt (based on farming_barley)
farming_hop
farming_tobaco (based on pictures of wikimedia)
farming_tool_spinningwheal (based on drawing by firkin on opencliparts)
farming_yarn (based on picture from ikiwana on wikimedia)

53
api.txt Normal file
View File

@ -0,0 +1,53 @@
Farming API
-----------
The farming API allows you to easily register plants and hoes.
`farming.register_hoe(name, hoe definition)`
* Register a new hoe, see [#hoe definition]
`farming.register_plant(name, Plant definition)`
* Register a new growing plant, see [#Plant definition]
`farming.registered_plants[name] = definition`
* Table of registered plants, indexed by plant name
### Hoe Definition
{
description = "", -- Description for tooltip
inventory_image = "unknown_item.png", -- Image to be used as wield- and inventory image
max_uses = 30, -- Uses until destroyed
material = "", -- Material for recipes
recipe = { -- Craft recipe, if material isn't used
{"air", "air", "air"},
{"", "group:stick"},
{"", "group:stick"},
}
}
### Plant definition
{
description = "", -- Description of seed item
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
minlight = 13, -- Minimum light to grow
maxlight = default.LIGHT_MAX -- Maximum light to grow
}
Note: Any crops registered with the above function will use the new growing routines, also if crops are manually added with the {growing=1} group they will also grow.
### Crop functions
If a mod registers nodes to be used as crops using the {growing=1} group then an additional function can be used for custom growth checks instead of the standard 'are we above wet soil'.
growth_check = function(pos, node_name)
-- check surrounding for jungle tree
if minetest.find_node_near(pos, 1, {"default:jungletree"}) then
return false -- place next growth stage
end
return true -- condition not met, skip next growth stage until next check
end,

46
coffee.lua Normal file
View File

@ -0,0 +1,46 @@
local S = farming.intllib
-- cold cup of coffee
minetest.register_node("farming:grain_coffee_cup", {
description = S("Cup of Grain Coffee"),
drawtype = "torchlike", --"plantlike",
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},
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = default.node_sound_glass_defaults(),
})
minetest.register_alias("farming:grain_coffee_cup_hot", "farming:grain_coffee_cup")
minetest.register_craft( {
output = "farming:grain_coffee_cup",
type = "shapeless",
recipe = {"vessels:drinking_glass", "group:food_grain_powder",
"bucket:bucket_water", "group:food_saucepan"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"},
}
})
minetest.register_craftitem("farming:grain_coffee", {
description = S("Grain Coffee"),
inventory_image = "farming_roasted_powder.png",
groups = {food_grain_powder = 1, flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:grain_coffee",
recipe = {
"group:food_grain_roasted", "group:food_grain_roasted", "farming:coffee_grinder"
},
replacements = {{"group:food_coffee_grinder", "farming:coffee_grinder"}},
})

172
compatibility.lua Normal file
View File

@ -0,0 +1,172 @@
--= Helpers
local eth = minetest.get_modpath("ethereal")
local alias = function(orig, new)
minetest.register_alias(orig, new)
end
--= Overrides (add food_* group to apple and brown mushroom)
minetest.override_item("default:apple", {
groups = {food_apple = 1, fleshy = 3, dig_immediate = 3, flammable = 2,
leafdecay = 3, leafdecay_drop = 1},
})
if minetest.registered_nodes["flowers:mushroom_brown"] then
minetest.override_item("flowers:mushroom_brown", {
light_source = 1,
groups = {food_mushroom = 1, snappy = 3, attached_node = 1, flammable = 2},
})
end
--= Aliases
-- Banana
if eth then
alias("farming_plus:banana_sapling", "ethereal:banana_tree_sapling")
alias("farming_plus:banana_leaves", "ethereal:bananaleaves")
alias("farming_plus:banana", "ethereal:banana")
else
minetest.register_node(":ethereal:banana", {
description = "Banana",
drawtype = "torchlike",
tiles = {"banana_single.png"},
inventory_image = "banana_single.png",
wield_image = "banana_single.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.2, 0.2, 0.2, 0.2}
},
groups = {food_banana = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node(":ethereal:bananaleaves", {
description = "Banana Leaves",
tiles = {"banana_leaf.png"},
inventory_image = "banana_leaf.png",
wield_image = "banana_leaf.png",
paramtype = "light",
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
sounds = default.node_sound_leaves_defaults(),
})
alias("farming_plus:banana_sapling", "default:sapling")
alias("farming_plus:banana_leaves", "ethereal:bananaleaves")
alias("farming_plus:banana", "ethereal:banana")
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")
alias("farming_plus:carrot_3", "farming:carrot_6")
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")
if eth then
alias("farming_plus:orange_item", "ethereal:orange")
alias("farming_plus:orange", "ethereal:orange")
alias("farming_plus:orange_seed", "ethereal:orange_tree_sapling")
else
minetest.register_node(":ethereal:orange", {
description = "Orange",
drawtype = "plantlike",
tiles = {"farming_orange.png"},
inventory_image = "farming_orange.png",
wield_image = "farming_orange.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.3, -0.2, 0.2, 0.2, 0.2}
},
groups = {food_orange = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(4),
sounds = default.node_sound_leaves_defaults(),
})
alias("farming_plus:orange_item", "ethereal:orange")
alias("farming_plus:orange", "ethereal:orange")
alias("farming_plus:orange_seed", "default:sapling")
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")
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")
alias("farming:big_pumpkin", "farming:jackolantern")
alias("farming:big_pumpkin_side", "air")
alias("farming:big_pumpkin_top", "air")
alias("farming:big_pumpkin_corner", "air")
alias("farming:scarecrow", "farming:jackolantern")
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")
alias("farming_plus:rhubarb", "farming:rhubarb_3")
alias("farming_plus:rhubarb_item", "farming:rhubarb")
-- Strawberry
if eth then
alias("farming_plus:strawberry_item", "ethereal:strawberry")
alias("farming_plus:strawberry_seed", "ethereal:strawberry")
alias("farming_plus:strawberry_1", "ethereal:strawberry_1")
alias("farming_plus:strawberry_2", "ethereal:strawberry_3")
alias("farming_plus:strawberry_3", "ethereal:strawberry_5")
alias("farming_plus:strawberry", "ethereal:strawberry_7")
else
minetest.register_craftitem(":ethereal:strawberry", {
description = "Strawberry",
inventory_image = "strawberry.png",
wield_image = "strawberry.png",
groups = {food_strawberry = 1, flammable = 2},
on_use = minetest.item_eat(1),
})
alias("farming_plus:strawberry_item", "ethereal:strawberry")
alias("farming_plus:strawberry_seed", "ethereal:strawberry")
alias("farming_plus:strawberry_1", "farming:raspberry_1")
alias("farming_plus:strawberry_2", "farming:raspberry_2")
alias("farming_plus:strawberry_3", "farming:raspberry_3")
alias("farming_plus:strawberry", "farming:raspberry_4")
end
-- Tomato
alias("farming_plus:tomato_seed", "farming:tomato")
alias("farming_plus:tomato_item", "farming:tomato")
alias("farming_plus:tomato_1", "farming:tomato_2")
alias("farming_plus:tomato_2", "farming:tomato_4")
alias("farming_plus:tomato_3", "farming:tomato_6")
alias("farming_plus:tomato", "farming:tomato_8")
-- Weed
alias("farming:weed", "default:grass_2")

View File

@ -24,6 +24,15 @@ minetest.register_craft({
replacements = {{"group:food_mortar_pestle", modname..":mortar_pestle"}},
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"group:for_flour", "group:for_flour", "group:for_flour",
modname..":mortar_pestle_highlevel"
},
replacements = {{modname..":mortar_pestle_highlevel", modname..":mortar_pestle_highlevel"}},
})
minetest.register_craftitem("farming:bread", {

105
crops/barley.lua Normal file
View File

@ -0,0 +1,105 @@
local S = farming.intllib
-- barley seeds
minetest.register_node("farming:seed_barley", {
description = S("Barley Seed"),
tiles = {"farming_barley_seed.png"},
inventory_image = "farming_barley_seed.png",
wield_image = "farming_barley_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1")
end,
})
-- harvested barley
minetest.register_craftitem("farming:barley", {
description = S("Barley"),
inventory_image = "farming_barley.png",
groups = {food_barley = 1, flammable = 2},
})
-- flour
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"farming:barley", "farming:barley", "farming:barley",
"farming:barley", "farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- barley definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_barley_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:barley_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_barley_2.png"}
minetest.register_node("farming:barley_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_barley_3.png"}
minetest.register_node("farming:barley_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_barley_4.png"}
minetest.register_node("farming:barley_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_barley_5.png"}
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 2},
{items = {'farming:seed_barley'}, rarity = 2},
}
}
minetest.register_node("farming:barley_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_barley_6.png"}
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 2},
{items = {'farming:seed_barley'}, rarity = 1},
}
}
minetest.register_node("farming:barley_6", table.copy(crop_def))
-- stage 7 (final)
crop_def.tiles = {"farming_barley_7.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:barley'}, rarity = 1},
{items = {'farming:barley'}, rarity = 3},
{items = {'farming:seed_barley'}, rarity = 1},
{items = {'farming:seed_barley'}, rarity = 3},
}
}
minetest.register_node("farming:barley_7", table.copy(crop_def))

249
crops/beans.lua Normal file
View File

@ -0,0 +1,249 @@
--[[
All textures by
(C) Auke Kok <sofar@foo-projects.org>
CC-BY-SA-3.0
]]
local S = farming.intllib
-- place beans
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
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
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack)
end
-- is player planting crop?
local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
return
end
-- check if pointing at bean pole
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})
if placer or not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:beans",
placer:get_wield_index()
)
end
end
return itemstack
end
-- beans
minetest.register_craftitem("farming:beans", {
description = S("Green Beans"),
inventory_image = "farming_beans.png",
groups = {food_beans = 1, flammable = 2},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
end,
})
-- beans can be used for green dye
minetest.register_craft({
output = "dye:green",
recipe = {
{'farming:beans'},
}
})
-- beanpole
minetest.register_node("farming:beanpole", {
description = S("Bean Pole (place on soil before planting beans)"),
drawtype = "plantlike",
tiles = {"farming_beanpole.png"},
inventory_image = "farming_beanpole.png",
visual_scale = 1.90, -- 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = "farming:beanpole",
selection_box = farming.select,
groups = {snappy = 3, flammable = 2, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
-- check if pointing at a node
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
-- 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)
end
if minetest.is_protected(pt.above, placer:get_player_name()) then
return
end
local nodename = under.name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
minetest.set_node(pointed_thing.above, {name = "farming:beanpole"})
if not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
})
minetest.register_craft({
output = "farming:beanpole",
recipe = {
{'', '', ''},
{'default:stick', '', 'default:stick'},
{'default:stick', '', 'default:stick'},
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:beanpole",
burntime = 10,
})
-- green bean definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_beanpole_1.png"},
visual_scale = 1.90, -- 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:beanpole_1", table.copy(crop_def))
-- stage2
crop_def.tiles = {"farming_beanpole_2.png"}
minetest.register_node("farming:beanpole_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_beanpole_3.png"}
minetest.register_node("farming:beanpole_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_beanpole_4.png"}
minetest.register_node("farming:beanpole_4", table.copy(crop_def))
-- stage 5 (final)
crop_def.tiles = {"farming_beanpole_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:beanpole'}, rarity = 1},
{items = {'farming:beans 3'}, rarity = 1},
{items = {'farming:beans 2'}, rarity = 2},
{items = {'farming:beans 2'}, rarity = 3},
}
}
minetest.register_node("farming:beanpole_5", table.copy(crop_def))
-- wild green bean bush (this is what you find on the map)
minetest.register_node("farming:beanbush", {
drawtype = "plantlike",
tiles = {"farming_beanbush.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:beans 1'}, rarity = 1},
{items = {'farming:beans 1'}, rarity = 2},
{items = {'farming:beans 1'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})

85
crops/beetroot.lua Normal file
View File

@ -0,0 +1,85 @@
local S = farming.intllib
-- beetroot
minetest.register_craftitem("farming:beetroot", {
description = S("Beetroot"),
inventory_image = "farming_beetroot.png",
groups = {food_beetroot = 1, flammable = 2},
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),
})
-- beetroot soup
minetest.register_craftitem("farming:beetroot_soup", {
description = S("Beetroot Soup"),
inventory_image = "farming_beetroot_soup.png",
groups = {flammable = 2},
on_use = minetest.item_eat(6, "farming:bowl"),
})
minetest.register_craft({
type = "shapeless",
output = "farming:beetroot_soup",
recipe = {
"group:food_beetroot", "group:food_beetroot",
"group:food_beetroot", "group:food_beetroot",
"group:food_beetroot", "group:food_beetroot","group:food_bowl"
}
})
-- red dye
minetest.register_craft({
type = "shapeless",
output = "dye:red",
recipe = {"group:food_beetroot"},
})
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_beetroot_1.png"},
paramtype = "light",
-- paramtype2 = "meshoptions",
-- place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:beetroot_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_beetroot_2.png"}
minetest.register_node("farming:beetroot_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_beetroot_3.png"}
minetest.register_node("farming:beetroot_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_beetroot_4.png"}
minetest.register_node("farming:beetroot_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_beetroot_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 4, items = {
{items = {'farming:beetroot'}, rarity = 1},
{items = {'farming:beetroot'}, rarity = 2},
{items = {'farming:beetroot'}, rarity = 3},
{items = {'farming:beetroot'}, rarity = 4},
}
}
minetest.register_node("farming:beetroot_5", table.copy(crop_def))

85
crops/blueberry.lua Normal file
View File

@ -0,0 +1,85 @@
local S = farming.intllib
-- blueberries
minetest.register_craftitem("farming:blueberries", {
description = S("Blueberries"),
inventory_image = "farming_blueberries.png",
groups = {food_blueberries = 1, food_blueberry = 1, food_berry = 1, flammable = 2},
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),
})
-- 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),
})
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),
})
minetest.register_craft({
output = "farming:blueberry_pie",
type = "shapeless",
recipe = {
"group:food_flour", "group:food_sugar",
"group:food_blueberries", "group:food_baking_tray"
},
})
-- blueberry definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_blueberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:blueberry_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_blueberry_2.png"}
minetest.register_node("farming:blueberry_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_blueberry_3.png"}
minetest.register_node("farming:blueberry_3", table.copy(crop_def))
-- stage 4 (final)
crop_def.tiles = {"farming_blueberry_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:blueberries 2'}, rarity = 1},
{items = {'farming:blueberries'}, rarity = 2},
{items = {'farming:blueberries'}, rarity = 3},
}
}
minetest.register_node("farming:blueberry_4", table.copy(crop_def))

96
crops/carrot.lua Normal file
View File

@ -0,0 +1,96 @@
--[[
Original textures from PixelBox texture pack
https://forum.minetest.net/viewtopic.php?id=4990
]]
local S = farming.intllib
-- carrot
minetest.register_craftitem("farming:carrot", {
description = S("Carrot"),
inventory_image = "farming_carrot.png",
groups = {food_carrot = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:carrot_1")
end,
on_use = minetest.item_eat(4),
})
-- golden carrot
minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(6),
})
minetest.register_craft({
output = "farming:carrot_gold",
recipe = {
{"", "default:gold_lump", ""},
{"default:gold_lump", "group:food_carrot", "default:gold_lump"},
{"", "default:gold_lump", ""},
}
})
-- carrot definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_carrot_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:carrot_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_carrot_2.png"}
minetest.register_node("farming:carrot_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_carrot_3.png"}
minetest.register_node("farming:carrot_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_carrot_4.png"}
minetest.register_node("farming:carrot_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_carrot_5.png"}
minetest.register_node("farming:carrot_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_carrot_6.png"}
minetest.register_node("farming:carrot_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_carrot_7.png"}
crop_def.drop = {
items = {
{items = {'farming:carrot'}, rarity = 1},
{items = {'farming:carrot 2'}, rarity = 3},
}
}
minetest.register_node("farming:carrot_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_carrot_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:carrot 2'}, rarity = 1},
{items = {'farming:carrot 3'}, rarity = 2},
}
}
minetest.register_node("farming:carrot_8", table.copy(crop_def))

92
crops/chili.lua Normal file
View File

@ -0,0 +1,92 @@
local S = farming.intllib
-- chili pepper
minetest.register_craftitem("farming:chili_pepper", {
description = S("Chili Pepper"),
inventory_image = "farming_chili_pepper.png",
groups = {food_chili_pepper = 1, flammable = 4},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:chili_1")
end,
on_use = minetest.item_eat(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, "farming:bowl"),
})
minetest.register_craft({
type = "shapeless",
output = "farming:chili_bowl",
recipe = {
"group:food_chili_pepper", "group:food_barley",
"group:food_tomato", "group:food_beans", "group:food_bowl"
},
})
-- chili can be used for red dye
minetest.register_craft({
output = "dye:red",
recipe = {
{'farming:chili_pepper'},
}
})
-- chili definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_chili_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:chili_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_chili_2.png"}
minetest.register_node("farming:chili_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_chili_3.png"}
minetest.register_node("farming:chili_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_chili_4.png"}
minetest.register_node("farming:chili_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_chili_5.png"}
minetest.register_node("farming:chili_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_chili_6.png"}
minetest.register_node("farming:chili_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_chili_7.png"}
minetest.register_node("farming:chili_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_chili_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:chili_pepper 3'}, rarity = 1},
{items = {'farming:chili_pepper 2'}, rarity = 2},
}
}
minetest.register_node("farming:chili_8", table.copy(crop_def))

210
crops/cocoa.lua Normal file
View File

@ -0,0 +1,210 @@
local S = farming.intllib
-- place cocoa
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
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
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack)
end
-- check if pointing at jungletree
if under.name ~= "default:jungletree"
or minetest.get_node(pt.above).name ~= "air" then
return
end
-- is player planting crop?
local name = placer and placer:get_player_name() or ""
-- check for protection
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})
if placer and not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:cocoa_beans",
placer:get_wield_index()
)
end
end
return itemstack
end
-- cocoa beans
minetest.register_craftitem("farming:cocoa_beans", {
description = S("Cocoa Beans"),
inventory_image = "farming_cocoa_beans.png",
groups = {food_cocoa = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
end,
})
minetest.register_craft( {
output = "dye:brown 2",
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),
})
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),
})
minetest.register_craft( {
output = "farming:chocolate_dark",
recipe = {
{"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"},
}
})
-- cocoa definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"},
paramtype = "light",
walkable = false,
drop = {
items = {
{items = {'farming:cocoa_beans 1'}, rarity = 2},
}
},
selection_box = {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
growth_check = function(pos, node_name)
if minetest.find_node_near(pos, 1, {"default:jungletree"}) then
return false
end
return true
end,
}
-- stage 1
minetest.register_node("farming:cocoa_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_cocoa_2.png"}
minetest.register_node("farming:cocoa_2", table.copy(crop_def))
-- stage3
crop_def.tiles = {"farming_cocoa_3.png"}
crop_def.drop = {
items = {
{items = {'farming:cocoa_beans 1'}, rarity = 1},
}
}
minetest.register_node("farming:cocoa_3", table.copy(crop_def))
-- stage 4 (final)
crop_def.tiles = {"farming_cocoa_4.png"}
crop_def.groups.growing = 0
crop_def.growth_check = nil
crop_def.drop = {
items = {
{items = {'farming:cocoa_beans 2'}, rarity = 1},
{items = {'farming:cocoa_beans 1'}, rarity = 2},
{items = {'farming:cocoa_beans 1'}, rarity = 4},
}
}
minetest.register_node("farming:cocoa_4", table.copy(crop_def))
-- add random cocoa pods to jungle tree's
minetest.register_on_generated(function(minp, maxp)
if maxp.y < 0 then
return
end
local pos, dir
local cocoa = minetest.find_nodes_in_area(minp, maxp, "default:jungletree")
for n = 1, #cocoa do
pos = cocoa[n]
if minetest.find_node_near(pos, 1,
{"default:jungleleaves", "moretrees:jungletree_leaves_green"}) then
dir = math.random(1, 80)
if dir == 1 then
pos.x = pos.x + 1
elseif dir == 2 then
pos.x = pos.x - 1
elseif dir == 3 then
pos.z = pos.z + 1
elseif dir == 4 then
pos.z = pos.z -1
end
if dir < 5
and minetest.get_node(pos).name == "air"
and minetest.get_node_light(pos) > 12 then
--print ("Cocoa Pod added at " .. minetest.pos_to_string(pos))
minetest.swap_node(pos, {
name = "farming:cocoa_" .. tostring(math.random(1, 4))
})
end
end
end
end)

123
crops/coffee.lua Normal file
View File

@ -0,0 +1,123 @@
local S = farming.intllib
-- coffee
minetest.register_craftitem("farming:coffee_beans_raw", {
description = S("Raw Coffee Beans"),
inventory_image = "farming_coffee_beans_raw.png",
groups = {food_coffee_raw = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
end,
})
minetest.register_craftitem("farming:coffee_beans", {
description = S("Coffee Beans"),
inventory_image = "farming_coffee_beans.png",
groups = {food_coffee = 1, flammable = 2},
})
-- roasted coffee
minetest.register_craftitem("farming:coffee_beans", {
description = S("Caffee Beans"),
inventory_image = "farming_coffee_beans_raw.png",
groups = {food_coffee = 1, flammable = 2},
})
minetest.register_craft({
type = "cooking",
cooktime = 5,
output = "farming:coffee_beans",
recipe = "farming:coffee_beans_raw"
})
-- spelt coffee
minetest.register_craftitem("farming:coffee_powder", {
description = S("Coffee Powder"),
inventory_image = "farming_roasted_powder.png",
groups = {food_coffee_powder = 1, flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:coffee_powder",
recipe = {
"farming:coffee_beans", "farming:coffee_beans", "farming:coffee_beans",
"farming:coffee_beans", "farming:coffee_grinder"
},
replacements = {{"group:food_coffee_grinder", "farming:coffee_grinder"}},
})
-- cold cup of coffee
minetest.register_node("farming:coffee_cup", {
description = S("Cup of Coffee"),
drawtype = "torchlike", --"plantlike",
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},
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = default.node_sound_glass_defaults(),
})
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",
type = "shapeless",
recipe = {"vessels:drinking_glass", "group:food_coffee_powder",
"bucket:bucket_water", "group:food_saucepan"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"},
}
})
-- coffee definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_coffee_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:coffee_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_coffee_2.png"}
minetest.register_node("farming:coffee_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_coffee_3.png"}
minetest.register_node("farming:coffee_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_coffee_4.png"}
minetest.register_node("farming:coffee_4", table.copy(crop_def))
-- stage 5 (final)
crop_def.tiles = {"farming_coffee_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:coffee_beans 2'}, rarity = 1},
{items = {'farming:coffee_beans 2'}, rarity = 2},
{items = {'farming:coffee_beans 2'}, rarity = 3},
}
}
minetest.register_node("farming:coffee_5", table.copy(crop_def))

149
crops/corn.lua Normal file
View File

@ -0,0 +1,149 @@
--[[
Original textures from GeMinecraft
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.intllib
-- corn
minetest.register_craftitem("farming:corn", {
description = S("Corn"),
inventory_image = "farming_corn.png",
groups = {food_corn = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:corn_1")
end,
on_use = minetest.item_eat(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 = {food_corn_cooked = 1, flammable = 2},
on_use = minetest.item_eat(5),
})
minetest.register_craft({
type = "cooking",
cooktime = 10,
output = "farming:corn_cob",
recipe = "group:food_corn"
})
-- cornstarch
minetest.register_craftitem("farming:cornstarch", {
description = S("Cornstarch"),
inventory_image = "farming_cornstarch.png",
groups = {food_cornstarch = 1, flammable = 2},
})
minetest.register_craft({
output = "farming:cornstarch",
recipe = {
{"group:food_mortar_pestle", "group:food_corn_cooked", "group:food_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 = default.node_sound_glass_defaults(),
})
minetest.register_craft( {
output = "farming:bottle_ethanol",
recipe = {
{ "vessels:glass_bottle", "group:food_corn", "group:food_corn"},
{ "group:food_corn", "group:food_corn", "group:food_corn"},
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:bottle_ethanol",
burntime = 80, --240,
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})
-- corn definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:corn_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_corn_2.png"}
minetest.register_node("farming:corn_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_corn_3.png"}
minetest.register_node("farming:corn_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_corn_4.png"}
minetest.register_node("farming:corn_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_corn_5.png"}
minetest.register_node("farming:corn_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_corn_6.png"}
crop_def.visual_scale = 1.9 -- 1.45
minetest.register_node("farming:corn_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_corn_7.png"}
crop_def.drop = {
items = {
{items = {'farming:corn'}, rarity = 1},
{items = {'farming:corn'}, rarity = 2},
{items = {'farming:corn'}, rarity = 3},
}
}
minetest.register_node("farming:corn_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_corn_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:corn 2'}, rarity = 1},
{items = {'farming:corn 2'}, rarity = 2},
{items = {'farming:corn 2'}, rarity = 2},
}
}
minetest.register_node("farming:corn_8", table.copy(crop_def))

151
crops/cotton.lua Normal file
View File

@ -0,0 +1,151 @@
local S = farming.intllib
-- cotton seeds
minetest.register_node("farming:seed_cotton", {
description = S("Cotton Seed"),
tiles = {"farming_cotton_seed.png"},
inventory_image = "farming_cotton_seed.png",
wield_image = "farming_cotton_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end,
})
-- cotton / string
minetest.register_craftitem("farming:cotton", {
description = S("Cotton"),
inventory_image = "farming_cotton.png",
groups = {flammable = 4},
})
minetest.register_craftitem("farming:string", {
description = S("String"),
inventory_image = "farming_string.png",
groups = {flammable = 2},
})
-- cotton to wool
minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"},
}
})
-- cotton to string
minetest.register_craft({
output = "farming: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 crop_def = {
drawtype = "plantlike",
tiles = {"farming_cotton_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:cotton_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_cotton_2.png"}
minetest.register_node("farming:cotton_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_cotton_3.png"}
minetest.register_node("farming:cotton_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_cotton_4.png"}
minetest.register_node("farming:cotton_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_cotton_5.png"}
crop_def.drop = {
items = {
{items = {"farming:seed_cotton"}, rarity = 1},
}
}
minetest.register_node("farming:cotton_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_cotton_6.png"}
crop_def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
}
}
minetest.register_node("farming:cotton_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_cotton_7.png"}
crop_def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
}
}
minetest.register_node("farming:cotton_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_cotton_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:cotton"}, rarity = 3},
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 3},
}
}
minetest.register_node("farming:cotton_8", table.copy(crop_def))
--[[ Cotton (example, is already registered in cotton.lua)
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",
groups = {flammable = 2},
steps = 8,
})]]

56
crops/cucumber.lua Normal file
View File

@ -0,0 +1,56 @@
--[[
Original textures from DocFarming mod
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.intllib
-- cucumber
minetest.register_craftitem("farming:cucumber", {
description = S("Cucumber"),
inventory_image = "farming_cucumber.png",
groups = {food_cucumber = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cucumber_1")
end,
on_use = minetest.item_eat(4),
})
-- cucumber definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_cucumber_1.png"},
paramtype = "light",
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:cucumber_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_cucumber_2.png"}
minetest.register_node("farming:cucumber_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_cucumber_3.png"}
minetest.register_node("farming:cucumber_3", table.copy(crop_def))
-- stage 4 (final)
crop_def.tiles = {"farming_cucumber_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:cucumber 2'}, rarity = 1},
{items = {'farming:cucumber 2'}, rarity = 2},
}
}
minetest.register_node("farming:cucumber_4", table.copy(crop_def))

128
crops/garlic.lua Normal file
View File

@ -0,0 +1,128 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:garlic_clove", {
description = S("Garlic clove"),
inventory_image = "crops_garlic_clove.png",
groups = {food_garlic_clove = 1, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1")
end,
})
-- 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, flammable = 3},
})
minetest.register_craft({
type = "shapeless",
output = "farming:garlic_clove 9",
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", "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",
paramtype = "light",
paramtype2 = "facedir",
tiles = {
"crops_garlic_braid_side.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},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.13, -0.45, 0.5, 0.13, 0.45, 0.24},
},
}
})
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 crop_def = {
drawtype = "plantlike",
tiles = {"crops_garlic_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:garlic_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_garlic_plant_2.png"}
minetest.register_node("farming:garlic_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_garlic_plant_3.png"}
minetest.register_node("farming:garlic_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_garlic_plant_4.png"}
minetest.register_node("farming:garlic_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_garlic_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 5, items = {
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 2},
{items = {'farming:garlic'}, rarity = 5},
}
}
minetest.register_node("farming:garlic_5", table.copy(crop_def))

256
crops/grapes.lua Normal file
View File

@ -0,0 +1,256 @@
local S = farming.intllib
-- 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
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
-- am I right-clicking on something that has a custom on_place set?
-- thanks to Krock for helping with this issue :)
local def = minetest.registered_nodes[under.name]
if placer and def and def.on_rightclick then
return def.on_rightclick(pt.under, under, placer, itemstack)
end
-- is player planting seed?
local name = placer and placer:get_player_name() or ""
-- check for protection
if minetest.is_protected(pt.under, name) then
return
end
-- check if pointing at trellis
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})
if placer and not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()
-- check for refill
if itemstack:get_count() == 0 then
minetest.after(0.20,
farming.refill_plant,
placer,
"farming:grapes",
placer:get_wield_index()
)
end
end
return itemstack
end
-- grapes
minetest.register_craftitem("farming:grapes", {
description = S("Grapes"),
inventory_image = "farming_grapes.png",
on_use = minetest.item_eat(2),
groups = {food_grapes = 1, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
return place_grapes(itemstack, placer, pointed_thing, "farming:grapes_1")
end,
})
-- grapes can be used for violet dye
minetest.register_craft({
output = "dye:violet",
recipe = {
{'farming:grapes'},
}
})
-- trellis
minetest.register_node("farming:trellis", {
description = S("Trellis (place on soil before planting grapes)"),
drawtype = "plantlike",
tiles = {"farming_trellis.png"},
inventory_image = "farming_trellis.png",
visual_scale = 1.9, -- 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = "farming:trellis",
selection_box = farming.select,
groups = {snappy = 3, flammable = 2, attached_node = 1},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
-- check if pointing at a node
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
-- 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)
end
if minetest.is_protected(pt.above, placer:get_player_name()) then
return
end
local nodename = under.name
if minetest.get_item_group(nodename, "soil") < 2 then
return
end
local top = {
x = pointed_thing.above.x,
y = pointed_thing.above.y + 1,
z = pointed_thing.above.z
}
nodename = minetest.get_node(top).name
if nodename ~= "air" then
return
end
minetest.set_node(pointed_thing.above, {name = "farming:trellis"})
if not farming.is_creative(placer:get_player_name()) then
itemstack:take_item()
end
return itemstack
end
})
minetest.register_craft({
output = "farming:trellis",
recipe = {
{'default:stick', 'default:stick', 'default:stick'},
{'default:stick', 'default:stick', 'default:stick'},
{'default:stick', 'default:stick', 'default:stick'},
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:trellis",
burntime = 15,
})
-- grapes definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_grapes_1.png"},
visual_scale = 1.9, -- 1.45,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, not_in_creative_inventory = 1,
attached_node = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:grapes_1", table.copy(crop_def))
-- stage2
crop_def.tiles = {"farming_grapes_2.png"}
minetest.register_node("farming:grapes_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_grapes_3.png"}
minetest.register_node("farming:grapes_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_grapes_4.png"}
minetest.register_node("farming:grapes_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_grapes_5.png"}
minetest.register_node("farming:grapes_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_grapes_6.png"}
minetest.register_node("farming:grapes_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_grapes_7.png"}
minetest.register_node("farming:grapes_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_grapes_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:trellis'}, rarity = 1},
{items = {'farming:grapes 3'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
}
minetest.register_node("farming:grapes_8", table.copy(crop_def))
-- wild grape vine (this is what you find on the map)
minetest.register_node("farming:grapebush", {
drawtype = "plantlike",
tiles = {"farming_grapebush.png"},
paramtype = "light",
waving = 1,
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {'farming:grapes 1'}, rarity = 1},
{items = {'farming:grapes 1'}, rarity = 2},
{items = {'farming:grapes 1'}, rarity = 3},
}
},
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory=1
},
sounds = default.node_sound_leaves_defaults(),
})

251
crops/hemp.lua Normal file
View File

@ -0,0 +1,251 @@
local S = farming.intllib
-- hemp seeds
minetest.register_node("farming:seed_hemp", {
description = S("Hemp Seed"),
tiles = {"farming_hemp_seed.png"},
inventory_image = "farming_hemp_seed.png",
wield_image = "farming_hemp_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:hemp_1")
end,
})
-- harvested hemp
minetest.register_craftitem("farming:hemp_leaf", {
description = S("Hemp Leaf"),
inventory_image = "farming_hemp_leaf.png",
})
-- 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},
sounds = default.node_sound_glass_defaults(),
})
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"},
{"", "vessels: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", "vessels:glass_bottle", "farming:seed_hemp"}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:hemp_oil",
burntime = 20,
replacements = {{ "farming:hemp_oil", "vessels:glass_bottle"}}
})
-- hemp fibre
minetest.register_craftitem("farming:hemp_fibre", {
description = S("Hemp Fibre"),
inventory_image = "farming_hemp_fibre.png",
})
minetest.register_craft( {
output = "farming:hemp_fibre 8",
recipe = {
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"farming:hemp_leaf", "bucket:bucket_water", "farming:hemp_leaf"},
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
},
replacements = {{ "bucket:bucket_water", "bucket:bucket_empty"}}
})
minetest.register_craft( {
output = "farming:hemp_fibre 8",
recipe = {
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"},
{"farming:hemp_leaf", "bucket:bucket_river_water", "farming:hemp_leaf"},
{"farming:hemp_leaf", "farming:hemp_leaf", "farming:hemp_leaf"}
},
replacements = {{ "bucket:bucket_river_water", "bucket:bucket_empty"}}
})
-- hemp block
minetest.register_node("farming:hemp_block", {
description = S("Hemp Block"),
tiles = {"farming_hemp_block.png"},
paramtype = "light",
groups = {snappy = 1, oddly_breakable_by_hand = 1, flammable = 2}
})
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 = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block",
default.node_sound_leaves_defaults())
else
stairs.register_stair_and_slab("hemp_block", "farming:hemp_block",
{snappy = 1, flammable = 2},
{"farming_hemp_block.png"},
"Hemp Block Stair",
"Hemp Block Slab",
default.node_sound_leaves_defaults())
end
end
-- paper
minetest.register_craft( {
output = "default:paper",
recipe = {
{"farming:hemp_fibre", "farming:hemp_fibre", "farming:hemp_fibre"},
}
})
-- string
minetest.register_craft( {
output = "farming:cotton",
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 = {flammable = 2, choppy = 3, oddly_breakable_by_hand = 3},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
},
})
-- 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 crop_def = {
drawtype = "plantlike",
tiles = {"farming_hemp_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:hemp_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_hemp_2.png"}
minetest.register_node("farming:hemp_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_hemp_3.png"}
minetest.register_node("farming:hemp_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_hemp_4.png"}
minetest.register_node("farming:hemp_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_hemp_5.png"}
minetest.register_node("farming:hemp_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_hemp_6.png"}
crop_def.drop = {
items = {
{items = {'farming:hemp_leaf'}, rarity = 2},
{items = {'farming:seed_hemp'}, rarity = 1},
}
}
minetest.register_node("farming:hemp_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_hemp_7.png"}
crop_def.drop = {
items = {
{items = {'farming:hemp_leaf'}, rarity = 1},
{items = {'farming:hemp_leaf'}, rarity = 3},
{items = {'farming:seed_hemp'}, rarity = 1},
{items = {'farming:seed_hemp'}, rarity = 3},
}
}
minetest.register_node("farming:hemp_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_hemp_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:hemp_leaf 2'}, rarity = 1},
{items = {'farming:hemp_leaf'}, rarity = 2},
{items = {'farming:seed_hemp'}, rarity = 1},
{items = {'farming:seed_hemp'}, rarity = 2},
}
}
minetest.register_node("farming:hemp_8", table.copy(crop_def))

86
crops/melon.lua Normal file
View File

@ -0,0 +1,86 @@
local S = farming.intllib
-- melon
minetest.register_craftitem("farming:melon_slice", {
description = S("Melon Slice"),
inventory_image = "farming_melon_slice.png",
groups = {food_melon_slice = 1, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:melon_1")
end,
on_use = minetest.item_eat(2),
})
minetest.register_craft({
output = "farming:melon_8",
recipe = {
{"farming:melon_slice", "farming:melon_slice"},
{"farming:melon_slice", "farming:melon_slice"},
}
})
minetest.register_craft({
type = "shapeless",
output = "farming:melon_slice 4",
recipe = {"farming:melon_8", "farming:cutting_board"},
replacements = {{"farming:cutting_board", "farming:cutting_board"}},
})
-- melon definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_melon_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:melon_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_melon_2.png"}
minetest.register_node("farming:melon_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_melon_3.png"}
minetest.register_node("farming:melon_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_melon_4.png"}
minetest.register_node("farming:melon_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_melon_5.png"}
minetest.register_node("farming:melon_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_melon_6.png"}
minetest.register_node("farming:melon_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_melon_7.png"}
minetest.register_node("farming:melon_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.drawtype = "nodebox"
crop_def.description = S("Melon")
crop_def.tiles = {"farming_melon_top.png", "farming_melon_top.png", "farming_melon_side.png"}
crop_def.selection_box = {-.5, -.5, -.5, .5, .5, .5}
crop_def.walkable = true
crop_def.groups = {
food_melon = 1, snappy = 1, oddly_breakable_by_hand = 1,
flammable = 2, plant = 1
}
--crop_def.drop = "farming:melon_slice 9"
crop_def.drop = "farming:melon_8"
minetest.register_node("farming:melon_8", table.copy(crop_def))

68
crops/onion.lua Normal file
View File

@ -0,0 +1,68 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:onion", {
description = S("Onion"),
inventory_image = "crops_onion.png",
groups = {food_onion = 1, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
end,
on_use = minetest.item_eat(1),
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
tiles = {"crops_onion_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:onion_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_onion_plant_2.png"}
minetest.register_node("farming:onion_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_onion_plant_3.png"}
minetest.register_node("farming:onion_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_onion_plant_4.png"}
minetest.register_node("farming:onion_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_onion_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 5, items = {
{items = {'farming:onion'}, rarity = 1},
{items = {'farming:onion'}, rarity = 1},
{items = {'farming:onion'}, rarity = 2},
{items = {'farming:onion'}, rarity = 2},
{items = {'farming:onion'}, rarity = 5},
}
}
minetest.register_node("farming:onion_5", table.copy(crop_def))

89
crops/peas.lua Normal file
View File

@ -0,0 +1,89 @@
local S = farming.intllib
-- Textures for Pea crop and Peas were done by Andrey01
-- pea pod
minetest.register_craftitem("farming:pea_pod", {
description = S("Pea Pod"),
inventory_image = "farming_pea_pod.png",
groups = {food_pea_pod = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pea_1")
end
})
minetest.register_craftitem("farming:peas", {
description = S("Peas"),
inventory_image = "farming_pea_peas.png",
groups = {food_peas = 1, flammable = 2},
on_use = minetest.item_eat(1)
})
minetest.register_craft({
type = "shapeless",
output = "farming:peas",
recipe = {"farming:pea_pod"}
})
-- pea soup
minetest.register_craftitem("farming:pea_soup", {
description = S("Pea Soup"),
inventory_image = "farming_pea_soup.png",
groups = {flammable = 2},
on_use = minetest.item_eat(4, "farming:bowl"),
})
minetest.register_craft({
type = "shapeless",
output = "farming:pea_soup",
recipe = {"group:food_peas", "group:food_peas", "group:food_bowl"}
})
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_pea_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:pea_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_pea_2.png"}
minetest.register_node("farming:pea_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_pea_3.png"}
minetest.register_node("farming:pea_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_pea_4.png"}
minetest.register_node("farming:pea_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_pea_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 5, items = {
{items = {'farming:pea_pod'}, rarity = 1},
{items = {'farming:pea_pod'}, rarity = 2},
{items = {'farming:pea_pod'}, rarity = 3},
{items = {'farming:pea_pod'}, rarity = 4},
{items = {'farming:pea_pod'}, rarity = 5},
}
}
minetest.register_node("farming:pea_5", table.copy(crop_def))

106
crops/pepper.lua Normal file
View File

@ -0,0 +1,106 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- peppercorn (seed)
minetest.register_craftitem("farming:peppercorn", {
description = S("Peppercorn"),
inventory_image = "crops_peppercorn.png",
groups = {food_peppercorn = 1, flammable = 3},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1")
end,
})
-- green pepper
minetest.register_craftitem("farming:pepper", {
description = S("Pepper"),
inventory_image = "crops_pepper.png",
on_use = minetest.item_eat(2),
groups = {food_pepper = 1, flammable = 3},
})
minetest.register_craft({
type = "shapeless",
output = "farming:peppercorn",
recipe = {"farming:pepper"}
})
-- ground pepper
minetest.register_node("farming:pepper_ground", {
description = ("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
},
sounds = default.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",
type = "shapeless",
recipe = {"group:food_peppercorn", "vessels:glass_bottle", "farming:mortar_pestle"},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
tiles = {"crops_pepper_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 1,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:pepper_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_pepper_plant_2.png"}
minetest.register_node("farming:pepper_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_pepper_plant_3.png"}
minetest.register_node("farming:pepper_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_pepper_plant_4.png"}
minetest.register_node("farming:pepper_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_pepper_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 2, items = {
{items = {'farming:pepper 2'}, rarity = 1},
{items = {'farming:pepper'}, rarity = 2},
{items = {'farming:pepper'}, rarity = 3},
}
}
minetest.register_node("farming:pepper_5", table.copy(crop_def))

129
crops/pineapple.lua Normal file
View File

@ -0,0 +1,129 @@
local S = farming.intllib
-- pineapple top
minetest.register_craftitem("farming:pineapple_top", {
description = S("Pineapple Top"),
inventory_image = "farming_pineapple_top.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pineapple_1")
end,
})
-- pineapple
minetest.register_node("farming:pineapple", {
description = S("Pineapple"),
drawtype = "plantlike",
tiles = {"farming_pineapple.png"},
inventory_image = "farming_pineapple.png",
wield_image = "farming_pineapple.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
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},
})
-- pineapple
minetest.register_craftitem("farming:pineapple_ring", {
description = S("Pineapple Ring"),
inventory_image = "farming_pineapple_ring.png",
groups = {food_pineapple_ring = 1, flammable = 2},
on_use = minetest.item_eat(1),
})
minetest.register_craft( {
output = "farming:pineapple_ring 5",
type = "shapeless",
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"),
})
minetest.register_craft({
output = "farming:pineapple_juice",
type = "shapeless",
recipe = {"vessels:drinking_glass", "group:food_pineapple_ring",
"group:food_pineapple_ring", "group:food_pineapple_ring",
"farming:juicer"},
replacements = {
{"group:food_juicer", "farming:juicer"},
},
})
minetest.register_craft({
output = "farming:pineapple_juice 2",
type = "shapeless",
recipe = {
"vessels:drinking_glass", "vessels:drinking_glass",
"group:food_pineapple", "farming:juicer"
},
replacements = {
{"group:food_juicer", "farming:juicer"},
},
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
visual_scale = 1.5,
tiles = {"farming_pineapple_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:pineapple_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_pineapple_2.png"}
minetest.register_node("farming:pineapple_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_pineapple_3.png"}
minetest.register_node("farming:pineapple_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_pineapple_4.png"}
minetest.register_node("farming:pineapple_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_pineapple_5.png"}
minetest.register_node("farming:pineapple_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_pineapple_6.png"}
minetest.register_node("farming:pineapple_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_pineapple_7.png"}
minetest.register_node("farming:pineapple_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_pineapple_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:pineapple'}, rarity = 1},
{items = {'farming:pineapple'}, rarity = 15},
}
}
minetest.register_node("farming:pineapple_8", table.copy(crop_def))

94
crops/potato.lua Normal file
View File

@ -0,0 +1,94 @@
--[[
Original textures from DocFarming mod
https://forum.minetest.net/viewtopic.php?id=3948
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:potato", {
description = S("Potato"),
inventory_image = "farming_potato.png",
groups = {food_potato = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:potato_1")
end,
on_use = minetest.item_eat(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),
})
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"),
})
minetest.register_craft({
output = "farming:potato_salad",
recipe = {
{"group:food_cucumber"},
{"farming:baked_potato"},
{"group:food_bowl"},
}
})
-- potato definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_potato_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:potato_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_potato_2.png"}
minetest.register_node("farming:potato_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_potato_3.png"}
crop_def.drop = {
items = {
{items = {'farming:potato'}, rarity = 1},
{items = {'farming:potato'}, rarity = 3},
}
}
minetest.register_node("farming:potato_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_potato_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:potato 2'}, rarity = 1},
{items = {'farming:potato 3'}, rarity = 2},
}
}
minetest.register_node("farming:potato_4", table.copy(crop_def))

213
crops/pumpkin.lua Normal file
View File

@ -0,0 +1,213 @@
--[[
Big thanks to PainterlyPack.net for allowing me to use these textures
]]
local S = farming.intllib
-- pumpkin slice
minetest.register_craftitem("farming:pumpkin_slice", {
description = S("Pumpkin Slice"),
inventory_image = "farming_pumpkin_slice.png",
groups = {food_pumpkin_slice = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pumpkin_1")
end,
on_use = minetest.item_eat(2),
})
minetest.register_craft({
output = "farming:pumpkin",
recipe = {
{"farming:pumpkin_slice", "farming:pumpkin_slice"},
{"farming:pumpkin_slice", "farming:pumpkin_slice"},
}
})
minetest.register_craft({
type = "shapeless",
output = "farming:pumpkin_slice 4",
recipe = {"farming:pumpkin", "farming:cutting_board"},
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_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_off.png"
},
paramtype2 = "facedir",
groups = {choppy = 1, oddly_breakable_by_hand = 1, flammable = 2},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
node.name = "farming:jackolantern_on"
minetest.swap_node(pos, node)
end,
})
minetest.register_node("farming:jackolantern_on", {
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_side.png",
"farming_pumpkin_face_on.png"
},
light_source = default.LIGHT_MAX - 1,
paramtype2 = "facedir",
groups = {
choppy = 1, oddly_breakable_by_hand = 1, flammable = 2,
not_in_creative_inventory = 1
},
sounds = default.node_sound_wood_defaults(),
drop = "farming:jackolantern",
on_punch = function(pos, node, puncher)
node.name = "farming:jackolantern"
minetest.swap_node(pos, node)
end,
})
minetest.register_craft({
output = "farming:jackolantern",
recipe = {
{"default:torch"},
{"group:food_pumpkin"},
}
})
--- wooden scarecrow base
minetest.register_node("farming: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 = {snappy = 3, flammable = 2},
})
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, flammable = 2},
})
minetest.register_craftitem("farming:pumpkin_dough", {
description = S("Pumpkin Dough"),
inventory_image = "farming_pumpkin_dough.png",
})
minetest.register_craft({
output = "farming:pumpkin_dough",
type = "shapeless",
recipe = {"group:food_flour", "group:food_pumpkin_slice", "group:food_pumpkin_slice"}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_dough",
cooktime = 10
})
-- pumpkin definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_pumpkin_1.png"},
paramtype = "light",
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:pumpkin_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_pumpkin_2.png"}
minetest.register_node("farming:pumpkin_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_pumpkin_3.png"}
minetest.register_node("farming:pumpkin_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_pumpkin_4.png"}
minetest.register_node("farming:pumpkin_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_pumpkin_5.png"}
minetest.register_node("farming:pumpkin_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_pumpkin_6.png"}
minetest.register_node("farming:pumpkin_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_pumpkin_7.png"}
minetest.register_node("farming:pumpkin_7", table.copy(crop_def))
-- stage 8 (final)
--[[
crop_def.tiles = {"farming_pumpkin_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:pumpkin_slice 9'}, rarity = 1},
}
}
minetest.register_node("farming:pumpkin_8", table.copy(crop_def))
]]
minetest.register_node("farming:pumpkin_8", {
description = S("Pumpkin"),
tiles = {
"farming_pumpkin_top.png",
"farming_pumpkin_top.png",
"farming_pumpkin_side.png"
},
groups = {
food_pumpkin = 1, choppy = 1, oddly_breakable_by_hand = 1,
flammable = 2, plant = 1
},
-- drop = {
-- items = {
-- {items = {'farming:pumpkin_slice 9'}, rarity = 1},
-- }
-- },
sounds = default.node_sound_wood_defaults(),
})
minetest.register_alias("farming:pumpkin", "farming:pumpkin_8")

69
crops/raspberry.lua Normal file
View File

@ -0,0 +1,69 @@
local S = farming.intllib
-- raspberries
minetest.register_craftitem("farming:raspberries", {
description = S("Raspberries"),
inventory_image = "farming_raspberries.png",
groups = {food_raspberries = 1, food_raspberry = 1, food_berry = 1, flammable = 2},
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),
})
-- 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"),
})
minetest.register_craft({
output = "farming:smoothie_raspberry",
recipe = {
{"default:snow"},
{"group:food_raspberries"},
{"vessels:drinking_glass"},
}
})
-- raspberries definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_raspberry_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:raspberry_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_raspberry_2.png"}
minetest.register_node("farming:raspberry_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_raspberry_3.png"}
minetest.register_node("farming:raspberry_3", table.copy(crop_def))
-- stage 4 (final)
crop_def.tiles = {"farming_raspberry_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:raspberries 2'}, rarity = 1},
{items = {'farming:raspberries'}, rarity = 2},
{items = {'farming:raspberries'}, rarity = 3},
}
}
minetest.register_node("farming:raspberry_4", table.copy(crop_def))

66
crops/rhubarb.lua Normal file
View File

@ -0,0 +1,66 @@
local S = farming.intllib
-- rhubarb
minetest.register_craftitem("farming:rhubarb", {
description = S("Rhubarb"),
inventory_image = "farming_rhubarb.png",
groups = {food_rhubarb = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:rhubarb_1")
end,
on_use = minetest.item_eat(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),
})
minetest.register_craft({
output = "farming:rhubarb_pie",
recipe = {
{"farming: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 crop_def = {
drawtype = "plantlike",
tiles = {"farming_rhubarb_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:rhubarb_1", table.copy(crop_def))
-- stage2
crop_def.tiles = {"farming_rhubarb_2.png"}
minetest.register_node("farming:rhubarb_2", table.copy(crop_def))
-- stage 3 (final)
crop_def.tiles = {"farming_rhubarb_3.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:rhubarb 2'}, rarity = 1},
{items = {'farming:rhubarb'}, rarity = 2},
{items = {'farming:rhubarb'}, rarity = 3},
}
}
minetest.register_node("farming:rhubarb_3", table.copy(crop_def))

171
crops/spelt.lua Normal file
View File

@ -0,0 +1,171 @@
local S = farming.intllib
-- spelt seeds
minetest.register_node("farming:seed_spelt", {
description = S("Spelt Seed"),
tiles = {"farming_spelt_seed.png"},
inventory_image = "farming_spelt_seed.png",
wield_image = "farming_spelt_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:spelt_1")
end,
})
-- harvested spelt
minetest.register_craftitem("farming:spelt", {
description = S("Spelt"),
inventory_image = "farming_spelt.png",
groups = {food_spelt = 1, flammable = 2},
})
-- flour
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"farming:spelt", "farming:spelt", "farming:spelt",
"farming:spelt", "farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
})
-- roasted spelt
minetest.register_craftitem("farming:spelt_roasted", {
description = S("Roasted Spelt"),
inventory_image = "farming_spelt_roasted.png",
groups = {food_spelt_roasted = 1, flammable = 2},
})
minetest.register_craft({
type = "cooking",
cooktime = 1,
output = "farming:spelt_roasted",
recipe = "farming:spelt"
})
-- spelt coffee
minetest.register_craftitem("farming:spelt_coffee", {
description = S("Spelt Coffee"),
inventory_image = "farming_roasted_powder.png",
groups = {food_spelt_powder = 1, flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:spelt_coffee",
recipe = {
"farming:spelt_roasted", "farming:spelt_roasted", "farming:coffee_grinder"
},
replacements = {{"group:food_coffee_grinder", "farming:coffee_grinder"}},
})
-- cold cup of coffee
minetest.register_node("farming:spelt_coffee_cup", {
description = S("Cup of Spelt Coffee"),
drawtype = "torchlike", --"plantlike",
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},
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = default.node_sound_glass_defaults(),
})
minetest.register_alias("farming:spelt_coffee_cup_hot", "farming:spelt_coffee_cup")
minetest.register_craft( {
output = "farming:spelt_coffee_cup",
type = "shapeless",
recipe = {"vessels:drinking_glass", "group:food_spelt_powder",
"bucket:bucket_water", "group:food_saucepan"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"},
}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:spelt_roasted",
recipe = "farming:spelt"
})
-- spelt definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_spelt_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:spelt_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_spelt_2.png"}
minetest.register_node("farming:spelt_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_spelt_3.png"}
minetest.register_node("farming:spelt_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_spelt_4.png"}
minetest.register_node("farming:spelt_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_spelt_5.png"}
crop_def.drop = {
items = {
{items = {'farming:spelt'}, rarity = 2},
{items = {'farming:seed_spelt'}, rarity = 2},
}
}
minetest.register_node("farming:spelt_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_spelt_6.png"}
crop_def.drop = {
items = {
{items = {'farming:spelt'}, rarity = 2},
{items = {'farming:seed_spelt'}, rarity = 1},
}
}
minetest.register_node("farming:spelt_6", table.copy(crop_def))
-- stage 7 (final)
crop_def.tiles = {"farming_spelt_7.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:spelt'}, rarity = 1},
{items = {'farming:spelt'}, rarity = 3},
{items = {'farming:seed_spelt'}, rarity = 1},
{items = {'farming:seed_spelt'}, rarity = 3},
}
}
minetest.register_node("farming:spelt_7", table.copy(crop_def))

79
crops/tomato.lua Normal file
View File

@ -0,0 +1,79 @@
--[[
Textures edited from:
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.intllib
-- tomato
minetest.register_craftitem("farming:tomato", {
description = S("Tomato"),
inventory_image = "farming_tomato.png",
groups = {food_tomato = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:tomato_1")
end,
on_use = minetest.item_eat(4),
})
-- tomato definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_tomato_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:tomato_1", table.copy(crop_def))
-- stage2
crop_def.tiles = {"farming_tomato_2.png"}
minetest.register_node("farming:tomato_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_tomato_3.png"}
minetest.register_node("farming:tomato_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_tomato_4.png"}
minetest.register_node("farming:tomato_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_tomato_5.png"}
minetest.register_node("farming:tomato_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_tomato_6.png"}
minetest.register_node("farming:tomato_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_tomato_7.png"}
crop_def.drop = {
items = {
{items = {'farming:tomato'}, rarity = 1},
{items = {'farming:tomato'}, rarity = 3},
}
}
minetest.register_node("farming:tomato_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_tomato_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:tomato 3'}, rarity = 1},
{items = {'farming:tomato 3'}, rarity = 2},
}
}
minetest.register_node("farming:tomato_8", table.copy(crop_def))

244
crops/wheat.lua Normal file
View File

@ -0,0 +1,244 @@
local S = farming.intllib
-- wheat seeds
minetest.register_node("farming:seed_wheat", {
description = S("Wheat Seed"),
tiles = {"farming_wheat_seed.png"},
inventory_image = "farming_wheat_seed.png",
wield_image = "farming_wheat_seed.png",
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:wheat_1")
end,
})
-- harvested wheat
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 = {snappy = 3, flammable = 4, fall_damage_add_percent = -30},
sounds = default.node_sound_leaves_defaults(),
})
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",
default.node_sound_leaves_defaults())
else
stairs.register_stair_and_slab("straw", "farming:straw",
{snappy = 3, flammable = 4},
{"farming_straw.png"},
"Straw Stair",
"Straw Slab",
default.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({
type = "shapeless",
output = "farming:flour",
recipe = {
"farming:wheat", "farming:wheat", "farming:wheat",
"farming:wheat", "farming: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, flammable = 2},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- 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, flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:bread_slice 5",
recipe = {"farming:bread", "group:food_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, flammable = 2},
})
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 = {flammable = 2},
})
minetest.register_craft({
output = "farming:toast_sandwich",
recipe = {
{"farming:bread_slice"},
{"farming:toast"},
{"farming:bread_slice"},
}
})
-- wheat definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_wheat_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:wheat_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"farming_wheat_2.png"}
minetest.register_node("farming:wheat_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"farming_wheat_3.png"}
minetest.register_node("farming:wheat_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"farming_wheat_4.png"}
minetest.register_node("farming:wheat_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"farming_wheat_5.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 2},
}
}
minetest.register_node("farming:wheat_5", table.copy(crop_def))
-- stage 6
crop_def.tiles = {"farming_wheat_6.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 2},
{items = {'farming:seed_wheat'}, rarity = 1},
}
}
minetest.register_node("farming:wheat_6", table.copy(crop_def))
-- stage 7
crop_def.tiles = {"farming_wheat_7.png"}
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_7", table.copy(crop_def))
-- stage 8 (final)
crop_def.tiles = {"farming_wheat_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
items = {
{items = {'farming:wheat'}, rarity = 1},
{items = {'farming:wheat'}, rarity = 3},
{items = {'farming:seed_wheat'}, rarity = 1},
{items = {'farming:seed_wheat'}, rarity = 3},
}
}
minetest.register_node("farming:wheat_8", table.copy(crop_def))
-- fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:straw",
burntime = 3,
})
minetest.register_craft({
type = "fuel",
recipe = "farming:wheat",
burntime = 1,
})

34
farming.conf_example Normal file
View File

@ -0,0 +1,34 @@
--[[
Farming settings can be changed here and kept inside mod folder
even after the mod has been updated, or you can place inside
world folder for map specific settings.
--]]
-- true to enable crop/food in-game and on mapgen
farming.carrot = true
farming.potato = true
farming.tomato = true
farming.cucumber = true
farming.corn = true
farming.coffee = true
farming.melon = true
farming.pumpkin = true
farming.cocoa = true
farming.raspberry = true
farming.blueberry = true
farming.rhubarb = true
farming.beans = true
farming.grapes = true
farming.barley = true
farming.chili = true
farming.hemp = true
farming.onion = true
farming.garlic = true
farming.pepper = true
farming.pineapple = true
farming.peas = true
farming.beetroot = true
-- rarety of crops on map, default is 0.001 (higher number = more crops)
farming.rarety = 0.002

188
food.lua Normal file
View File

@ -0,0 +1,188 @@
local S = farming.intllib
--= Sugar
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",
})
--= Salt
minetest.register_node("farming:salt", {
description = ("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},
sounds = default.node_sound_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:salt",
recipe = "bucket:bucket_water",
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
})
--= Rose Water
minetest.register_node("farming:rose_water", {
description = ("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},
sounds = default.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 = {
{"flowers:rose", "flowers:rose", "flowers:rose"},
{"flowers:rose", "flowers:rose", "flowers:rose"},
{"bucket:bucket_water", "group:food_pot", "vessels:glass_bottle"},
},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"},
{"group:food_pot", "farming:pot"},
}
})
--= Turkish Delight
minetest.register_craftitem("farming:turkish_delight", {
description = S("Turkish Delight"),
inventory_image = "farming_turkish_delight.png",
groups = {flammable = 3},
on_use = minetest.item_eat(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_cornstarch", "group:food_sugar", "dye:pink"},
},
replacements = {
{"group:food_cornstarch", "farming:bowl"},
{"group:food_rose_water", "vessels:glass_bottle"},
},
})
--= Garlic Bread
minetest.register_craftitem("farming:garlic_bread", {
description = S("Garlic Bread"),
inventory_image = "farming_garlic_bread.png",
groups = {flammable = 3},
on_use = minetest.item_eat(2),
})
minetest.register_craft({
type = "shapeless",
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),
})
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),
})
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),
})
minetest.register_craft({
output = "farming:donut_apple",
recipe = {
{'default:apple'},
{'farming:donut'},
}
})
--= Porridge Oats
minetest.register_craftitem("farming:porridge", {
description = S("Porridge"),
inventory_image = "farming_porridge.png",
on_use = minetest.item_eat(6, "farming:bowl"),
})
minetest.after(0, function()
local fluid = "bucket:bucket_water"
local fluid_return = "bucket:bucket_water"
if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then
fluid = "group:food_milk"
fluid_return = "mobs:bucket_milk"
end
minetest.register_craft({
type = "shapeless",
output = "farming:porridge",
recipe = {
"group:food_barley", "group:food_barley", "group:food_wheat",
"group:food_wheat", "group:food_bowl", fluid
},
replacements = {{fluid_return, "bucket:bucket_empty"}}
})
end)

197
grains.lua Normal file
View File

@ -0,0 +1,197 @@
local S = farming.intllib
-- fuels
minetest.register_craft({
type = "fuel",
recipe = "farming:straw",
burntime = 3,
})
-- flour
minetest.register_craftitem("farming:flour", {
description = S("Flour"),
inventory_image = "farming_flour.png",
groups = {food_flour = 1, flammable = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:flour",
recipe = {
"group:seed", "group:seed", "group:seed",
"group:seed", "farming: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, flammable = 2},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "farming:bread",
recipe = "farming:flour"
})
-- 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, flammable = 2},
})
minetest.register_craft({
type = "shapeless",
output = "farming:bread_slice 5",
recipe = {"farming:bread", "group:food_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, flammable = 2},
})
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 = {flammable = 2},
})
minetest.register_craft({
output = "farming:toast_sandwich",
recipe = {
{"farming:bread_slice"},
{"farming:toast"},
{"farming:bread_slice"},
}
})
local function register_grain(grain_name_in,bwild,max_level,harvest_threshold,seed_threshold,seed_rarity)
local grain_name=string.lower(grain_name_in)
local print_name=string.upper(string.sub(grain_name,1,1))..string.sub(grain_name,2,99)
local modname=minetest.get_current_modname()
local farming_name=modname..":"..grain_name
local seed_name=modname..":seed_"..grain_name
print("registering "..seed_name)
local seed_png="farming_"..grain_name.."_seed.png"
-- seeds
minetest.register_node(seed_name, {
description = S(print_name.." Seed"),
tiles = {seed_png},
inventory_image = seed_png,
wield_image = seed_png,
drawtype = "signlike",
groups = {seed = 1, snappy = 3, attached_node = 1, flammable = 4},
paramtype = "light",
paramtype2 = "wallmounted",
walkable = false,
sunlight_propagates = true,
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:"..grain_name.."_1")
end,
})
-- harvested
minetest.register_craftitem(farming_name, {
description = S(print_name),
inventory_image = "farming_"..grain_name..".png",
groups = {food_harvested = 1, flammable = 4},
})
-- roasted
minetest.register_craftitem(seed_name.."_roasted", {
description = S(print_name.." roasted"),
inventory_image = "farming_"..grain_name.."_seed_roasted.png",
groups = {food_grain_roasted = 1, flammable = 4},
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = seed_name.."_roasted",
recipe = seed_name
})
minetest.register_craft({
type = "shapeless",
output = seed_name,
recipe = {
farming_name, farming_name, farming_name,
farming_name, modname..":flail"
},
replacements = {{"group:flail", "farming:flail"},
{"group:harvested",modname..":straw"}},
})
-- grain definition
local crop_def = {
drawtype = "plantlike",
tiles = {"farming_"..grain_name.."_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 4, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stages
for level=1,max_level,1 do
crop_def.tiles = {"farming_"..grain_name.."_"..level..".png"}
if (level >= harvest_threshold) and (level < seed_threshold) then
crop_def.drop={items={items = {items = {farming_name},rarity=1}}}
end
if (level >= seed_threshold) then
crop_def.drop={ items = {
{items = {farming_name},rarity=1},
{items = {farming_name},rarity=3},
{items = {seed_name},rarity=seed_rarity}
}
}
end
if (level == max_level) then
crop_def.groups.growing = 0
end
minetest.register_node(farming_name.."_"..level, table.copy(crop_def))
end
-- fuels
minetest.register_craft({
type = "fuel",
recipe = farming_name,
burntime = 1,
})
end
register_grain("wheat",true,8,5,7,2)
print("register grain spelt")
register_grain("spelt",true,7,5,6,2)

44
grass.lua Normal file
View File

@ -0,0 +1,44 @@
for i = 4, 5 do
-- Override default grass and have it drop Wheat Seeds
minetest.override_item("default:grass_" .. i, {
drop = {
max_items = 1,
items = {
{items = {'farming:seed_wheat'}, rarity = 5},
{items = {'farming:seed_spelt'}, rarity = 5},
{items = {'default:grass_1'}},
}
},
})
-- Override default dry grass and have it drop Barley Seeds
if minetest.registered_nodes["default:dry_grass_1"] then
minetest.override_item("default:dry_grass_" .. i, {
drop = {
max_items = 1,
items = {
{items = {'farming:seed_barley'}, rarity = 6},
{items = {'default:dry_grass_1'}},
}
},
})
end
end
-- Override default Jungle Grass and have it drop Cotton Seeds
minetest.override_item("default:junglegrass", {
drop = {
max_items = 1,
items = {
{items = {'farming:seed_cotton'}, rarity = 8},
{items = {'default:junglegrass'}},
}
},
})

332
hoes.lua Normal file
View File

@ -0,0 +1,332 @@
local S = farming.intllib
local 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
-- Check def table
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.max_uses == nil then
def.max_uses = 30
end
-- Register the tool
minetest.register_tool(name, {
description = def.description,
inventory_image = def.inventory_image,
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"},
})
-- 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 = {
{def.material, def.material, ""},
{"", "group:stick", ""},
{"", "group:stick", ""}
}
})
end
end
-- Turns dirt with group soil=1 into soil
function farming.hoe_on_use(itemstack, user, pointed_thing, uses)
local pt = pointed_thing
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
local under = minetest.get_node(pt.under)
local upos = pointed_thing.under
if minetest.is_protected(upos, user:get_player_name()) then
minetest.record_protection_violation(upos, user:get_player_name())
return
end
local p = {x = pt.under.x, y = pt.under.y + 1, z = pt.under.z}
local above = minetest.get_node(p)
-- 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
-- check if the node above the pointed thing is air
if above.name ~= "air" then
return
end
-- check if pointing at dirt
if minetest.get_item_group(under.name, "soil") ~= 1 then
return
end
-- turn the node into soil, wear out item and play sound
minetest.set_node(pt.under, {name = "farming:soil"})
minetest.sound_play("default_dig_crumbly", {pos = pt.under, gain = 0.5})
local wear = 65535 / (uses -1)
if farming.is_creative(user:get_player_name()) then
if tr then
wear = 1
else
wear = 0
end
end
if tr then
itemstack = toolranks.new_afteruse(itemstack, user, under, {wear = wear})
else
itemstack:add_wear(wear)
end
return itemstack
end
-- Define Hoes
farming.register_hoe(":farming:hoe_wood", {
description = S("Wooden Hoe"),
inventory_image = "farming_tool_woodhoe.png",
max_uses = 30,
material = "group:wood"
})
minetest.register_craft({
type = "fuel",
recipe = "farming:hoe_wood",
burntime = 5,
})
farming.register_hoe(":farming:hoe_stone", {
description = S("Stone Hoe"),
inventory_image = "farming_tool_stonehoe.png",
max_uses = 90,
material = "group:stone"
})
farming.register_hoe(":farming:hoe_steel", {
description = S("Steel Hoe"),
inventory_image = "farming_tool_steelhoe.png",
max_uses = 200,
material = "default:steel_ingot"
})
farming.register_hoe(":farming:hoe_bronze", {
description = S("Bronze Hoe"),
inventory_image = "farming_tool_bronzehoe.png",
max_uses = 500,
groups = {not_in_creative_inventory = 1},
})
farming.register_hoe(":farming:hoe_mese", {
description = S("Mese Hoe"),
inventory_image = "farming_tool_mesehoe.png",
max_uses = 350,
groups = {not_in_creative_inventory = 1},
})
farming.register_hoe(":farming:hoe_diamond", {
description = S("Diamond Hoe"),
inventory_image = "farming_tool_diamondhoe.png",
max_uses = 500,
groups = {not_in_creative_inventory = 1},
})
-- Toolranks support
if tr then
minetest.override_item("farming:hoe_wood", {
original_description = "Wood Hoe",
description = toolranks.create_description("Wood Hoe")})
minetest.override_item("farming:hoe_stone", {
original_description = "Stone Hoe",
description = toolranks.create_description("Stone Hoe")})
minetest.override_item("farming:hoe_steel", {
original_description = "Steel Hoe",
description = toolranks.create_description("Steel Hoe")})
minetest.override_item("farming:hoe_bronze", {
original_description = "Bronze Hoe",
description = toolranks.create_description("Bronze Hoe")})
minetest.override_item("farming:hoe_mese", {
original_description = "Mese Hoe",
description = toolranks.create_description("Mese Hoe")})
minetest.override_item("farming:hoe_diamond", {
original_description = "Diamond Hoe",
description = toolranks.create_description("Diamond Hoe")})
end
-- hoe bomb function
local function hoe_area(pos, player)
-- check for protection
if minetest.is_protected(pos, player:get_player_name()) then
minetest.record_protection_violation(pos, player:get_player_name())
return
end
local r = 5 -- radius
-- 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"})
for n = 1, #res do
minetest.swap_node(res[n], {name = "air"})
end
-- replace dirt with tilled soil
res = nil
res = minetest.find_nodes_in_area_under_air(
{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:soil"})
for n = 1, #res do
minetest.swap_node(res[n], {name = "farming:soil"})
end
end
-- throwable hoe bomb
minetest.register_entity("farming:hoebomb_entity", {
physical = true,
visual = "sprite",
visual_size = {x = 1.0, y = 1.0},
textures = {"farming_hoe_bomb.png"},
collisionbox = {0,0,0,0,0,0},
lastpos = {},
player = "",
on_step = function(self, dtime)
if not self.player then
self.object:remove()
return
end
local pos = self.object:get_pos()
if self.lastpos.x ~= nil then
local vel = self.object:getvelocity()
-- only when potion hits something physical
if vel.x == 0
or vel.y == 0
or vel.z == 0 then
if self.player ~= "" then
-- round up coords to fix glitching through doors
self.lastpos = vector.round(self.lastpos)
hoe_area(self.lastpos, self.player)
end
self.object:remove()
return
end
end
self.lastpos = pos
end
})
-- actual throwing function
local function throw_potion(itemstack, player)
local playerpos = player:get_pos()
local obj = minetest.add_entity({
x = playerpos.x,
y = playerpos.y + 1.5,
z = playerpos.z
}, "farming:hoebomb_entity")
local dir = player:get_look_dir()
local velocity = 20
obj:setvelocity({
x = dir.x * velocity,
y = dir.y * velocity,
z = dir.z * velocity
})
obj:setacceleration({
x = dir.x * -3,
y = -9.5,
z = dir.z * -3
})
obj:setyaw(player:get_look_yaw() + math.pi)
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
hoe_area(pointed_thing.above, user)
else
throw_potion(itemstack, user)
if not farming.is_creative(user:get_player_name()) then
itemstack:take_item()
return itemstack
end
end
end,
})

259
locale/fr.po Normal file
View File

@ -0,0 +1,259 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-27 20:21+0200\n"
"PO-Revision-Date: 2018-03-27 22:16+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Language: fr\n"
#: barley.lua
msgid "Barley Seed"
msgstr "Graine d'orge"
#: barley.lua
msgid "Barley"
msgstr "Orge"
#: beanpole.lua
msgid "Green Beans"
msgstr "Haricots verts"
#: beanpole.lua
msgid "Bean Pole (place on soil before planting beans)"
msgstr "Tuteur pour haricots (placer sur le sol avant de planter des haricots)"
#: blueberry.lua
msgid "Blueberries"
msgstr "Myrtilles"
#: blueberry.lua
msgid "Blueberry Muffin"
msgstr "Gâteau aux myrtilles"
#: carrot.lua
msgid "Carrot"
msgstr "Carotte"
#: carrot.lua
msgid "Golden Carrot"
msgstr "Carotte dorée"
#: cocoa.lua
msgid "Cocoa Beans"
msgstr "Fèves de chocolat"
#: cocoa.lua
msgid "Cookie"
msgstr "Biscuit"
#: cocoa.lua
msgid "Bar of Dark Chocolate"
msgstr "Barre de chocolat noir"
#: coffee.lua
msgid "Coffee Beans"
msgstr "Grains de café"
#: coffee.lua
msgid "Drinking Cup (empty)"
msgstr "Tasse (vide)"
#: coffee.lua
msgid "Cold Cup of Coffee"
msgstr "Tasse de café froid"
#: coffee.lua
msgid "Hot Cup of Coffee"
msgstr "Tasse de café chaud"
#: corn.lua
msgid "Corn"
msgstr "Maïs"
#: corn.lua
msgid "Corn on the Cob"
msgstr "Épi de maïs"
#: corn.lua
msgid "Bottle of Ethanol"
msgstr "Bouteille de'éthanol"
#: cotton.lua
msgid "Cotton Seed"
msgstr "Graines de coton"
#: cotton.lua
msgid "Cotton"
msgstr "Coton"
#: cucumber.lua
msgid "Cucumber"
msgstr "Concombre"
#: donut.lua
msgid "Donut"
msgstr "Beignet"
#: donut.lua
msgid "Chocolate Donut"
msgstr "Beignet au chocolat"
#: donut.lua
msgid "Apple Donut"
msgstr "Beignet aux pommes"
#: grapes.lua
msgid "Grapes"
msgstr "Raisins"
#: grapes.lua
msgid "Trellis (place on soil before planting grapes)"
msgstr "Treillis (placer sur le sol avant de planter les raisins)"
#: hemp.lua
msgid "Hemp Seed"
msgstr "Graines de chanvre"
#: hemp.lua
msgid "Hemp Leaf"
msgstr "Feuille de chanvre"
#: hemp.lua
msgid "Bottle of Hemp Oil"
msgstr "Bouteille d'huile de chanvre"
#: hemp.lua
msgid "Hemp Fibre"
msgstr "Fibre de chanvre"
#: hemp.lua
msgid "Hemp Rope"
msgstr "Corde de chanvre"
#: hoes.lua
msgid "Wooden Hoe"
msgstr "Houe en bois"
#: hoes.lua
msgid "Stone Hoe"
msgstr "Houe en pierre"
#: hoes.lua
msgid "Steel Hoe"
msgstr "Houe en acier"
#: hoes.lua
msgid "Bronze Hoe"
msgstr "Houe en bronze"
#: hoes.lua
msgid "Mese Hoe"
msgstr "Houe en mese"
#: hoes.lua
msgid "Diamond Hoe"
msgstr "Houe en diamant"
#: init.lua
msgid "Seed"
msgstr "Graine"
#: melon.lua
msgid "Melon Slice"
msgstr "Tranche de melon"
#: melon.lua
msgid "Melon"
msgstr "Melon"
#: potato.lua
msgid "Potato"
msgstr "Pomme de terre"
#: potato.lua
msgid "Baked Potato"
msgstr "Pomme de terre cuite"
#: pumpkin.lua
msgid "Pumpkin"
msgstr "Citrouille"
#: pumpkin.lua
msgid "Pumpkin Slice"
msgstr "Tranche de citrouille"
#: pumpkin.lua
msgid "Jack 'O Lantern (punch to turn on and off)"
msgstr "Jack 'O Lantern (tapé pour allumer et éteindre)"
#: pumpkin.lua
msgid "Pumpkin Bread"
msgstr "Pain à la citrouille"
#: pumpkin.lua
msgid "Pumpkin Dough"
msgstr "Pâte à la citrouille"
#: raspberry.lua
msgid "Raspberries"
msgstr "Framboises"
#: raspberry.lua
msgid "Raspberry Smoothie"
msgstr "Smoothie aux framboises"
#: rhubarb.lua
msgid "Rhubarb"
msgstr "Rhubarbe"
#: rhubarb.lua
msgid "Rhubarb Pie"
msgstr "Tarte à la rhubarbe"
#: soil.lua
msgid "Soil"
msgstr "Sol"
#: soil.lua
msgid "Wet Soil"
msgstr "Sol humide"
#: sugar.lua
msgid "Sugar"
msgstr "Sucre"
#: tomato.lua
msgid "Tomato"
msgstr "Tomate"
#: wheat.lua
msgid "Wheat Seed"
msgstr "Graine de blé"
#: wheat.lua
msgid "Wheat"
msgstr "Blé"
#: wheat.lua
msgid "Straw"
msgstr "Paille"
#: wheat.lua
msgid "Flour"
msgstr "Farine"
#: wheat.lua
msgid "Bread"
msgstr "Pain"

258
locale/pt.po Normal file
View File

@ -0,0 +1,258 @@
# Portuguese Translation for farming mod.
# Copyright (C) 2017
# This file is distributed under the same license as the farming package.
# BrunoMine <borgesdossantosbruno@gmail.com>, 2017.
#
msgid ""
msgstr ""
"Project-Id-Version: 1.27\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-16 17:38-0300\n"
"PO-Revision-Date: 2017-08-17 17:01-0300\n"
"Last-Translator: BrunoMine <borgesdossantosbruno@gmail.com>\n"
"Language-Team: \n"
"Language: Portuguese\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Gtranslator 2.91.7\n"
#: barley.lua
msgid "Barley Seed"
msgstr "Sementes de Cevada"
#: barley.lua
msgid "Barley"
msgstr "Cevada"
#: beanpole.lua
msgid "Green Beans"
msgstr "Feijoes Verdes"
#: beanpole.lua
msgid "Bean Pole (place on soil before planting beans)"
msgstr "Apoio de feijao (coloque no solo antes de plantar feijao)"
#: blueberry.lua
msgid "Blueberries"
msgstr "Mirtilos"
#: blueberry.lua
msgid "Blueberry Muffin"
msgstr "Muffin de Mirtilos"
#: carrot.lua
msgid "Carrot"
msgstr "Cenoura"
#: carrot.lua
msgid "Golden Carrot"
msgstr "Cenoura Dourada"
#: cocoa.lua
msgid "Cocoa Beans"
msgstr "Amendoas de Cacau"
#: cocoa.lua
msgid "Cookie"
msgstr "Cookie"
#: cocoa.lua
msgid "Bar of Dark Chocolate"
msgstr "Barra de Chocolate Preto"
#: coffee.lua
msgid "Coffee Beans"
msgstr "Grao de Cafe"
#: coffee.lua
msgid "Drinking Cup (empty)"
msgstr "Xicara (vazia)"
#: coffee.lua
msgid "Cold Cup of Coffee"
msgstr "Xicara de Cafe Frio"
#: coffee.lua
msgid "Hot Cup of Coffee"
msgstr "Xicara de Cafe Quente"
#: corn.lua
msgid "Corn"
msgstr "Milho"
#: corn.lua
msgid "Corn on the Cob"
msgstr "Espiga de Milho"
#: corn.lua
msgid "Bottle of Ethanol"
msgstr "Garrafa de Etanol"
#: cotton.lua
msgid "Cotton Seed"
msgstr "Sementes de Algodao"
#: cotton.lua
msgid "Cotton"
msgstr "Algodao"
#: cucumber.lua
msgid "Cucumber"
msgstr "Pepino"
#: donut.lua
msgid "Donut"
msgstr "Donut"
#: donut.lua
msgid "Chocolate Donut"
msgstr "Donut de Chocolate"
#: donut.lua
msgid "Apple Donut"
msgstr "Donut de Maça"
#: grapes.lua
msgid "Grapes"
msgstr "Uvas"
#: grapes.lua
msgid "Trellis (place on soil before planting grapes)"
msgstr "Grade de Ripas (colocar no solo antes de plantar uvas)"
#: hemp.lua
msgid "Hemp Seed"
msgstr "Sementes de Canhamo"
#: hemp.lua
msgid "Hemp Leaf"
msgstr "Folha de Canhamo"
#: hemp.lua
msgid "Bottle of Hemp Oil"
msgstr "Garrafa de Oleo de Canhamo"
#: hemp.lua
msgid "Hemp Fibre"
msgstr "Fibra de Canhamo"
#: hemp.lua
msgid "Hemp Rope"
msgstr "Corda de Canhamo"
#: hoes.lua
msgid "Wooden Hoe"
msgstr "Enxada de Madeira"
#: hoes.lua
msgid "Stone Hoe"
msgstr "Enxada de Pedra"
#: hoes.lua
msgid "Steel Hoe"
msgstr "Enxada de Aço"
#: hoes.lua
msgid "Bronze Hoe"
msgstr "Enxada de Bronze"
#: hoes.lua
msgid "Mese Hoe"
msgstr "Enxada de Mese"
#: hoes.lua
msgid "Diamond Hoe"
msgstr "Enxada de Diamante"
#: init.lua
msgid "Seed"
msgstr "Sementes"
#: melon.lua
msgid "Melon Slice"
msgstr "Sementes de Melancia"
#: melon.lua
msgid "Melon"
msgstr "Melancia"
#: potato.lua
msgid "Potato"
msgstr "Batata"
#: potato.lua
msgid "Baked Potato"
msgstr "Batata Cozida"
#: pumpkin.lua
msgid "Pumpkin"
msgstr "Abobora"
#: pumpkin.lua
msgid "Pumpkin Slice"
msgstr "Pedaço de Abobora"
#: pumpkin.lua
msgid "Jack 'O Lantern (punch to turn on and off)"
msgstr "Jack 'O Lantern (Socos para ligar e desligar)"
#: pumpkin.lua
msgid "Pumpkin Bread"
msgstr "Pao de Abobora"
#: pumpkin.lua
msgid "Pumpkin Dough"
msgstr "Massa de Abobora"
#: raspberry.lua
msgid "Raspberries"
msgstr "Framboesa"
#: raspberry.lua
msgid "Raspberry Smoothie"
msgstr "Batida de Framboesa"
#: rhubarb.lua
msgid "Rhubarb"
msgstr "Ruibarbo"
#: rhubarb.lua
msgid "Rhubarb Pie"
msgstr "Torta de Ruibarbo"
#: soil.lua
msgid "Soil"
msgstr "Solo"
#: soil.lua
msgid "Wet Soil"
msgstr "Solo Seco"
#: sugar.lua
msgid "Sugar"
msgstr "Açucar"
#: tomato.lua
msgid "Tomato"
msgstr "Tomate"
#: wheat.lua
msgid "Wheat Seed"
msgstr "Sementes de Trigo"
#: wheat.lua
msgid "Wheat"
msgstr "Trigo"
#: wheat.lua
msgid "Straw"
msgstr "Palha"
#: wheat.lua
msgid "Flour"
msgstr "Farinha"
#: wheat.lua
msgid "Bread"
msgstr "Pao"

262
locale/ru.po Normal file
View File

@ -0,0 +1,262 @@
# Russian translation for farming mod.
# Copyright (C) 2018
# This file is distributed under the same license as the farming package.
# codexp <codexp@gmx.net>, 2018.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 1.27\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-03-22 01:25+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: Russian\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: barley.lua
msgid "Barley Seed"
msgstr "семена ячменя"
#: barley.lua
msgid "Barley"
msgstr "ячмень"
#: beanpole.lua
msgid "Green Beans"
msgstr "зеленая фасоль"
#: beanpole.lua
msgid "Bean Pole (place on soil before planting beans)"
msgstr "жердь для бобовых (установите на почву перед посадкой бобовых)"
#: blueberry.lua
msgid "Blueberries"
msgstr "голубика"
#: blueberry.lua
msgid "Blueberry Muffin"
msgstr "кекс из голубики"
#: carrot.lua
msgid "Carrot"
msgstr "морковь"
#: carrot.lua
msgid "Golden Carrot"
msgstr "золотая морковь"
#: cocoa.lua
msgid "Cocoa Beans"
msgstr "бобы какао"
#: cocoa.lua
msgid "Cookie"
msgstr "печенье"
#: cocoa.lua
msgid "Bar of Dark Chocolate"
msgstr "плитка темного шоколада"
#: coffee.lua
msgid "Coffee Beans"
msgstr "кофе в зернах"
#: coffee.lua
msgid "Drinking Cup (empty)"
msgstr "чашка (пустая)"
#: coffee.lua
msgid "Cold Cup of Coffee"
msgstr "холодная чашка кофе"
#: coffee.lua
msgid "Hot Cup of Coffee"
msgstr "горячая чашка кофе"
#: corn.lua
msgid "Corn"
msgstr "кукуруза"
#: corn.lua
msgid "Corn on the Cob"
msgstr "початок кукурузы"
#: corn.lua
msgid "Bottle of Ethanol"
msgstr "бутылка этилового спирта"
#: cotton.lua
msgid "Cotton Seed"
msgstr "семена хлопка"
#: cotton.lua
msgid "Cotton"
msgstr "хлопок"
#: cucumber.lua
msgid "Cucumber"
msgstr "огурец"
#: donut.lua
msgid "Donut"
msgstr "пончик"
#: donut.lua
msgid "Chocolate Donut"
msgstr "шоколадный пончик"
#: donut.lua
msgid "Apple Donut"
msgstr "яблочный пончик"
#: grapes.lua
msgid "Grapes"
msgstr "виноград"
#: grapes.lua
msgid "Trellis (place on soil before planting grapes)"
msgstr "решетка (поставьте на почву для посадки винограда)"
#: hemp.lua
msgid "Hemp Seed"
msgstr "семена конопли"
#: hemp.lua
msgid "Hemp Leaf"
msgstr "листья конопли"
#: hemp.lua
msgid "Bottle of Hemp Oil"
msgstr "бутылка конопляного масла"
#: hemp.lua
msgid "Hemp Fibre"
msgstr ""
#: hemp.lua
msgid "Hemp Rope"
msgstr "Пенька"
#: hoes.lua
msgid "Hoe"
msgstr "мотыга"
#: hoes.lua
msgid "Wooden Hoe"
msgstr "деревянная мотыга"
#: hoes.lua
msgid "Stone Hoe"
msgstr "каменная мотыга"
#: hoes.lua
msgid "Steel Hoe"
msgstr "стальная мотыга"
#: hoes.lua
msgid "Bronze Hoe"
msgstr "бронзовая мотыга"
#: hoes.lua
msgid "Mese Hoe"
msgstr "магическая мотыга"
#: hoes.lua
msgid "Diamond Hoe"
msgstr "алмазная мотыга"
#: init.lua
msgid "Seed"
msgstr "семена"
#: melon.lua
msgid "Melon Slice"
msgstr "ломтик арбуза"
#: melon.lua
msgid "Melon"
msgstr "арбуз"
#: potato.lua
msgid "Potato"
msgstr "картофель"
#: potato.lua
msgid "Baked Potato"
msgstr "запеченный картофель"
#: pumpkin.lua
msgid "Pumpkin"
msgstr "тыква"
#: pumpkin.lua
msgid "Pumpkin Slice"
msgstr "ломтик тыквы"
#: pumpkin.lua
msgid "Jack 'O Lantern (punch to turn on and off)"
msgstr "светильник джека (удар для включения и отключения)"
#: pumpkin.lua
msgid "Pumpkin Bread"
msgstr "тыквенный хлеб"
#: pumpkin.lua
msgid "Pumpkin Dough"
msgstr "тыквенное тесто"
#: raspberry.lua
msgid "Raspberries"
msgstr "малина"
#: raspberry.lua
msgid "Raspberry Smoothie"
msgstr "малиновый коктейль"
#: rhubarb.lua
msgid "Rhubarb"
msgstr "ревень"
#: rhubarb.lua
msgid "Rhubarb Pie"
msgstr "пирог из ревеня"
#: soil.lua
msgid "Soil"
msgstr "земля"
#: soil.lua
msgid "Wet Soil"
msgstr "мокрая земля"
#: sugar.lua
msgid "Sugar"
msgstr "сахар"
#: tomato.lua
msgid "Tomato"
msgstr "помидор"
#: wheat.lua
msgid "Wheat Seed"
msgstr ""
#: wheat.lua
msgid "Wheat"
msgstr "семена пшеницы"
#: wheat.lua
msgid "Straw"
msgstr "солома"
#: wheat.lua
msgid "Flour"
msgstr "мука"
#: wheat.lua
msgid "Bread"
msgstr "хлеб"

258
locale/template.pot Normal file
View File

@ -0,0 +1,258 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-16 17:38-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: barley.lua
msgid "Barley Seed"
msgstr ""
#: barley.lua
msgid "Barley"
msgstr ""
#: beanpole.lua
msgid "Green Beans"
msgstr ""
#: beanpole.lua
msgid "Bean Pole (place on soil before planting beans)"
msgstr ""
#: blueberry.lua
msgid "Blueberries"
msgstr ""
#: blueberry.lua
msgid "Blueberry Muffin"
msgstr ""
#: carrot.lua
msgid "Carrot"
msgstr ""
#: carrot.lua
msgid "Golden Carrot"
msgstr ""
#: cocoa.lua
msgid "Cocoa Beans"
msgstr ""
#: cocoa.lua
msgid "Cookie"
msgstr ""
#: cocoa.lua
msgid "Bar of Dark Chocolate"
msgstr ""
#: coffee.lua
msgid "Coffee Beans"
msgstr ""
#: coffee.lua
msgid "Drinking Cup (empty)"
msgstr ""
#: coffee.lua
msgid "Cold Cup of Coffee"
msgstr ""
#: coffee.lua
msgid "Hot Cup of Coffee"
msgstr ""
#: corn.lua
msgid "Corn"
msgstr ""
#: corn.lua
msgid "Corn on the Cob"
msgstr ""
#: corn.lua
msgid "Bottle of Ethanol"
msgstr ""
#: cotton.lua
msgid "Cotton Seed"
msgstr ""
#: cotton.lua
msgid "Cotton"
msgstr ""
#: cucumber.lua
msgid "Cucumber"
msgstr ""
#: donut.lua
msgid "Donut"
msgstr ""
#: donut.lua
msgid "Chocolate Donut"
msgstr ""
#: donut.lua
msgid "Apple Donut"
msgstr ""
#: grapes.lua
msgid "Grapes"
msgstr ""
#: grapes.lua
msgid "Trellis (place on soil before planting grapes)"
msgstr ""
#: hemp.lua
msgid "Hemp Seed"
msgstr ""
#: hemp.lua
msgid "Hemp Leaf"
msgstr ""
#: hemp.lua
msgid "Bottle of Hemp Oil"
msgstr ""
#: hemp.lua
msgid "Hemp Fibre"
msgstr ""
#: hemp.lua
msgid "Hemp Rope"
msgstr ""
#: hoes.lua
msgid "Wooden Hoe"
msgstr ""
#: hoes.lua
msgid "Stone Hoe"
msgstr ""
#: hoes.lua
msgid "Steel Hoe"
msgstr ""
#: hoes.lua
msgid "Bronze Hoe"
msgstr ""
#: hoes.lua
msgid "Mese Hoe"
msgstr ""
#: hoes.lua
msgid "Diamond Hoe"
msgstr ""
#: init.lua
msgid "Seed"
msgstr ""
#: melon.lua
msgid "Melon Slice"
msgstr ""
#: melon.lua
msgid "Melon"
msgstr ""
#: potato.lua
msgid "Potato"
msgstr ""
#: potato.lua
msgid "Baked Potato"
msgstr ""
#: pumpkin.lua
msgid "Pumpkin"
msgstr ""
#: pumpkin.lua
msgid "Pumpkin Slice"
msgstr ""
#: pumpkin.lua
msgid "Jack 'O Lantern (punch to turn on and off)"
msgstr ""
#: pumpkin.lua
msgid "Pumpkin Bread"
msgstr ""
#: pumpkin.lua
msgid "Pumpkin Dough"
msgstr ""
#: raspberry.lua
msgid "Raspberries"
msgstr ""
#: raspberry.lua
msgid "Raspberry Smoothie"
msgstr ""
#: rhubarb.lua
msgid "Rhubarb"
msgstr ""
#: rhubarb.lua
msgid "Rhubarb Pie"
msgstr ""
#: soil.lua
msgid "Soil"
msgstr ""
#: soil.lua
msgid "Wet Soil"
msgstr ""
#: sugar.lua
msgid "Sugar"
msgstr ""
#: tomato.lua
msgid "Tomato"
msgstr ""
#: wheat.lua
msgid "Wheat Seed"
msgstr ""
#: wheat.lua
msgid "Wheat"
msgstr ""
#: wheat.lua
msgid "Straw"
msgstr ""
#: wheat.lua
msgid "Flour"
msgstr ""
#: wheat.lua
msgid "Bread"
msgstr ""

38
lucky_block.lua Normal file
View File

@ -0,0 +1,38 @@
-- add lucky blocks
if minetest.get_modpath("lucky_block") then
lucky_block:add_blocks({
{"dro", {"farming:corn"}, 5},
{"dro", {"farming:coffee_cup_hot"}, 1},
{"dro", {"farming:bread"}, 5},
{"nod", "farming:jackolantern", 0},
{"tro", "farming:jackolantern_on"},
{"nod", "default:river_water_source", 1},
{"tel"},
{"dro", {"farming:trellis", "farming:grapes"}, 5},
{"dro", {"farming:bottle_ethanol"}, 1},
{"nod", "farming:melon", 0},
{"dro", {"farming:donut", "farming:donut_chocolate", "farming:donut_apple"}, 5},
{"dro", {"farming:hemp_leaf", "farming:hemp_fibre", "farming:seed_hemp"}, 5},
{"nod", "fire:permanent_flame", 1},
{"dro", {"farming:chili_pepper", "farming:chili_bowl"}, 5},
{"dro", {"farming:bowl"}, 3},
{"dro", {"farming:saucepan"}, 1},
{"dro", {"farming:pot"}, 1},
{"dro", {"farming:baking_tray"}, 1},
{"dro", {"farming:skillet"}, 1},
{"exp", 4},
{"dro", {"farming:mortar_pestle"}, 1},
{"dro", {"farming:cutting_board"}, 1},
{"dro", {"farming:juicer"}, 1},
{"dro", {"farming:mixing_bowl"}, 1},
{"dro", {"farming:hoe_bronze"}, 1},
{"dro", {"farming:hoe_mese"}, 1},
{"dro", {"farming:hoe_diamond"}, 1},
{"dro", {"farming:hoe_bomb"}, 10},
{"dro", {"farming:turkish_delight"}, 5},
{"lig"},
})
end

142
mapgen.lua Normal file
View File

@ -0,0 +1,142 @@
-- decoration function
local function register_plant(name, min, max, spawnon, spawnby, num, enabled)
if enabled ~= true then
return
end
minetest.register_decoration({
deco_type = "simple",
place_on = spawnon or {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.006,
spread = {x = 100, y = 100, z = 100},
seed = 329,
octaves = 3,
persist = 0.6
},
y_min = min,
y_max = max,
decoration = "farming:" .. name,
spawn_by = spawnby,
num_spawn_by = num,
})
end
-- add crops to mapgen
register_plant("potato_3", 15, 40, nil, "", -1, farming.potato)
register_plant("tomato_7", 5, 20, nil, "", -1, farming.tomato)
register_plant("corn_7", 12, 22, nil, "", -1, farming.corn)
register_plant("coffee_5", 20, 45, {"default:dirt_with_dry_grass",
"default:dirt_with_rainforest_litter"}, "", -1, farming.coffee)
register_plant("raspberry_4", 3, 10, nil, "", -1, farming.raspberry)
register_plant("rhubarb_3", 3, 15, nil, "", -1, farming.rhubarb)
register_plant("blueberry_4", 3, 10, nil, "", -1, farming.blueberry)
register_plant("beanbush", 18, 35, nil, "", -1, farming.beans)
register_plant("grapebush", 25, 45, nil, "", -1, farming.grapes)
register_plant("onion_5", 5, 22, nil, "", -1, farming.onion)
register_plant("garlic_5", 3, 30, nil, "group:tree", 1, farming.garlic)
register_plant("pea_5", 25, 50, nil, "", -1, farming.peas)
register_plant("beetroot_5", 1, 15, nil, "", -1, farming.beetroot)
if minetest.get_mapgen_setting("mg_name") == "v6" then
register_plant("carrot_8", 1, 30, nil, "group:water", 1, farming.carrot)
register_plant("cucumber_4", 1, 20, nil, "group:water", 1, farming.cucumber)
register_plant("melon_8", 1, 20, nil, "group:water", 1, farming.melon)
register_plant("pumpkin_8", 1, 20, nil, "group:water", 1, farming.pumpkin)
else
-- v7 maps have a beach so plants growing near water is limited to 6 high
register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot)
register_plant("cucumber_4", 1, 10, nil, "", -1, farming.cucumber)
register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass",
"default:dirt_with_rainforest_litter"}, "", -1, farming.melon)
register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin)
end
if farming.hemp then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.6
},
y_min = 3,
y_max = 45,
decoration = "farming:hemp_7",
spawn_by = "group:tree",
num_spawn_by = 1,
})
end
if farming.chili then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 760,
octaves = 3,
persist = 0.6
},
y_min = 5,
y_max = 35,
decoration = {"farming:chili_8"},
spawn_by = "group:tree",
num_spawn_by = 1,
})
end
if farming.pepper then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 933,
octaves = 3,
persist = 0.6
},
y_min = 5,
y_max = 35,
decoration = {"farming:pepper_5"},
spawn_by = "group:tree",
num_spawn_by = 1,
})
end
if farming.pineapple then
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = farming.rarety, -- 0.06,
spread = {x = 100, y = 100, z = 100},
seed = 917,
octaves = 3,
persist = 0.6
},
y_min = 18,
y_max = 30,
decoration = {"farming:pineapple_8"},
})
end

View File

@ -2,6 +2,6 @@ name = farming
title = Farming
author = ademant
description = An enhanced farming mod with spreding crops which wilt if not harvested.
optional_depends = intllib,default,wool,vessels,bucket,thirsty,stamina
optional_depends = intllib,default,wool,vessels,bucket,thirsty
license = MIT
version = 1.0.0

0
nohup.out Normal file
View File

67
soil.lua Normal file
View File

@ -0,0 +1,67 @@
local S = farming.intllib
-- normal soil
minetest.register_node("farming:soil", {
description = S("Soil"),
tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 2},
sounds = default.node_sound_dirt_defaults(),
})
-- wet soil
minetest.register_node("farming:soil_wet", {
description = S("Wet Soil"),
tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"},
drop = "default:dirt",
groups = {crumbly = 3, not_in_creative_inventory = 1, soil = 3},
sounds = default.node_sound_dirt_defaults(),
})
-- sand is not soil, change existing sand-soil to use normal soil
minetest.register_alias("farming:desert_sand_soil", "farming:soil")
minetest.register_alias("farming:desert_sand_soil_wet", "farming:soil_wet")
-- if water near soil then change to wet soil
minetest.register_abm({
nodenames = {"farming:soil", "farming:soil_wet"},
interval = 15,
chance = 4,
catch_up = false,
action = function(pos, node)
pos.y = pos.y + 1
local nn = minetest.get_node_or_nil(pos)
pos.y = pos.y - 1
if nn then nn = nn.name else return end
-- what's on top of soil, if solid/not plant change soil to dirt
if minetest.registered_nodes[nn]
and minetest.registered_nodes[nn].walkable
and minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name = "default:dirt"})
return
end
-- if map around soil not loaded then skip until loaded
if minetest.find_node_near(pos, 3, {"ignore"}) then
return
end
-- check if there is water nearby and change soil accordingly
if minetest.find_node_near(pos, 3, {"group:water"}) then
if node.name == "farming:soil" then
minetest.set_node(pos, {name = "farming:soil_wet"})
end
elseif node.name == "farming:soil_wet" then
minetest.set_node(pos, {name = "farming:soil"})
elseif node.name == "farming:soil" and minetest.get_item_group(nn, "plant") == 0 then
minetest.set_node(pos, {name = "default:dirt"})
end
end,
})

174
statistics.lua Normal file
View File

@ -0,0 +1,174 @@
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 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)
local D = 1.0 / A
erf = function(x)
if x == 0 then return 0; end
local xSq = x * x
local aXSq = A * xSq
local v = math.sqrt(1.0 - math.exp(-xSq * (B + aXSq) / (1.0 + aXSq)))
return (x > 0 and v) or -v
end
erf_inv = function(x)
if x == 0 then return 0; end
if x <= -1 or x >= 1 then return nil; end
local y = math.log(1 - x * x)
local u = C + 0.5 * y
local v = math.sqrt(math.sqrt(u * u - D * y) - u)
return (x > 0 and v) or -v
end
local function std_normal(u)
return ROOT_2 * erf_inv(2.0 * u - 1.0)
end
local poisson
local cdf_table = {}
local function generate_cdf(lambda_index, lambda)
local max = math.ceil(4 * lambda)
local pdf = math.exp(-lambda)
local cdf = pdf
local t = { [0] = pdf }
for i = 1, max - 1 do
pdf = pdf * lambda / i
cdf = cdf + pdf
t[i] = cdf
end
return t
end
for li = 1, 100 do
cdf_table[li] = generate_cdf(li, 0.25 * li)
end
poisson = function(lambda, max)
if max < 2 then
return (math.random() < math.exp(-lambda) and 0) or 1
elseif lambda >= 2 * max then
return max
end
local u = math.random()
local lambda_index = math.floor(4 * lambda + 0.5)
local cdfs = cdf_table[lambda_index]
if cdfs then
lambda = 0.25 * lambda_index
if u < cdfs[0] then return 0; end
if max > #cdfs then max = #cdfs + 1 else max = math.floor(max); end
if u >= cdfs[max - 1] then return max; end
if max > 4 then -- Binary search
local s = 0
while s + 1 < max do
local m = math.floor(0.5 * (s + max))
if u < cdfs[m] then max = m; else s = m; end
end
else
for i = 1, max - 1 do
if u < cdfs[i] then return i; end
end
end
return max
else
local x = lambda + math.sqrt(lambda) * std_normal(u)
return (x < 0.5 and 0) or (x >= max - 0.5 and max) or math.floor(x + 0.5)
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).
statistics.std_normal = function()
local u = math.random()
if u < 0.001 then
return -3.0
elseif u > 0.999 then
return 3.0
end
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).
statistics.normal = function(mu, sigma)
local u = math.random()
if u < 0.001 then
return mu - 3.0 * sigma
elseif u > 0.999 then
return mu + 3.0 * sigma
end
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).
statistics.poisson = function(lambda, max)
lambda, max = tonumber(lambda), tonumber(max)
if not lambda or not max or lambda <= 0 or max < 1 then return 0; end
return poisson(lambda, max)
end
return statistics

BIN
textures/banana_leaf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 B

BIN
textures/banana_single.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 B

BIN
textures/crops_garlic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

BIN
textures/crops_onion.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

BIN
textures/crops_pepper.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

BIN
textures/farming_beans.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

BIN
textures/farming_bowl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 B

BIN
textures/farming_carrot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

BIN
textures/farming_cookie.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

BIN
textures/farming_corn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Some files were not shown because too many files have changed in this diff Show More