Browse Source

code tidy and tweak

master
tenplus1 2 years ago
parent
commit
6f0383d5b6
  1. 2
      README.md
  2. 12
      compatibility.lua
  3. 51
      crops/barley.lua
  4. 48
      crops/beans.lua
  5. 34
      crops/beetroot.lua
  6. 30
      crops/blueberry.lua
  7. 34
      crops/cabbage.lua
  8. 54
      crops/carrot.lua
  9. 46
      crops/chili.lua
  10. 67
      crops/cocoa.lua
  11. 37
      crops/coffee.lua
  12. 56
      crops/corn.lua
  13. 83
      crops/cotton.lua
  14. 24
      crops/cucumber.lua
  15. 44
      crops/garlic.lua
  16. 58
      crops/grapes.lua
  17. 66
      crops/hemp.lua
  18. 51
      crops/melon.lua
  19. 28
      crops/mint.lua
  20. 28
      crops/onion.lua
  21. 28
      crops/peas.lua
  22. 36
      crops/pepper.lua
  23. 61
      crops/pineapple.lua
  24. 38
      crops/potato.lua
  25. 85
      crops/pumpkin.lua
  26. 28
      crops/raspberry.lua
  27. 28
      crops/rhubarb.lua
  28. 30
      crops/ryeoatrice.lua
  29. 45
      crops/tomato.lua
  30. 80
      crops/wheat.lua
  31. 58
      food.lua
  32. 18
      grass.lua
  33. 14
      hoes.lua
  34. 16
      init.lua
  35. 12
      mapgen.lua
  36. 2
      soil.lua
  37. 11
      statistics.lua
  38. 40
      utensils.lua

2
README.md

@ -13,7 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
### Changelog:
- 1.45 - Dirt and Hoes are more in line with default by using dry/wet/base, added cactus juice, added pasta and spaghetti
- 1.45 - Dirt and Hoes are more in line with default by using dry/wet/base, added cactus juice, added pasta, spaghetti, cabbage, korean bibimbap, code tidy
options, onion soup added (thanks edcrypt), Added apple pie, added wild cotton to savanna
- 1.44 - Added 'farming_stage_length' in mod settings for speed of crop growth, also thanks to TheDarkTiger for translation updates
- 1.43 - Scythe works on use instead of right-click, added seed=1 groups to actual seeds and seed=2 group for plantable food items.

12
compatibility.lua

@ -12,13 +12,13 @@ end
minetest.override_item("default:apple", {
groups = {food_apple = 1, fleshy = 3, dig_immediate = 3, flammable = 2,
leafdecay = 3, leafdecay_drop = 1},
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},
groups = {food_mushroom = 1, snappy = 3, attached_node = 1, flammable = 2}
})
end
@ -45,7 +45,7 @@ else
},
groups = {food_banana = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(2),
sounds = default.node_sound_leaves_defaults(),
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node(":ethereal:bananaleaves", {
@ -56,7 +56,7 @@ else
paramtype = "light",
waving = 1,
groups = {snappy = 3, leafdecay = 3, leaves = 1, flammable = 2},
sounds = default.node_sound_leaves_defaults(),
sounds = default.node_sound_leaves_defaults()
})
alias("farming_plus:banana_sapling", "default:sapling")
@ -103,7 +103,7 @@ else
},
groups = {food_orange = 1, fleshy = 3, dig_immediate = 3, flammable = 2},
on_use = minetest.item_eat(4),
sounds = default.node_sound_leaves_defaults(),
sounds = default.node_sound_leaves_defaults()
})
alias("farming_plus:orange_item", "ethereal:orange")
@ -151,7 +151,7 @@ else
inventory_image = "strawberry.png",
wield_image = "strawberry.png",
groups = {food_strawberry = 1, flammable = 2},
on_use = minetest.item_eat(1),
on_use = minetest.item_eat(1)
})
alias("farming_plus:strawberry_item", "ethereal:strawberry")

51
crops/barley.lua

@ -16,14 +16,14 @@ minetest.register_node("farming:seed_barley", {
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:barley_1")
end,
end
})
-- harvested barley
minetest.register_craftitem("farming:barley", {
description = S("Barley"),
inventory_image = "farming_barley.png",
groups = {food_barley = 1, flammable = 2},
groups = {food_barley = 1, flammable = 2}
})
-- flour
@ -34,11 +34,11 @@ minetest.register_craft({
"farming:barley", "farming:barley", "farming:barley",
"farming:barley", "farming:mortar_pestle"
},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}},
replacements = {{"group:food_mortar_pestle", "farming:mortar_pestle"}}
})
-- barley definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_barley_1.png"},
paramtype = "light",
@ -57,52 +57,52 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:barley_1", table.copy(crop_def))
minetest.register_node("farming:barley_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_barley_2.png"}
minetest.register_node("farming:barley_2", table.copy(crop_def))
def.tiles = {"farming_barley_2.png"}
minetest.register_node("farming:barley_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_barley_3.png"}
minetest.register_node("farming:barley_3", table.copy(crop_def))
def.tiles = {"farming_barley_3.png"}
minetest.register_node("farming:barley_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_barley_4.png"}
minetest.register_node("farming:barley_4", table.copy(crop_def))
def.tiles = {"farming_barley_4.png"}
minetest.register_node("farming:barley_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_barley_5.png"}
crop_def.drop = {
def.tiles = {"farming_barley_5.png"}
def.drop = {
items = {
{items = {"farming:barley"}, rarity = 2},
{items = {"farming:seed_barley"}, rarity = 2},
{items = {"farming:seed_barley"}, rarity = 2}
}
}
minetest.register_node("farming:barley_5", table.copy(crop_def))
minetest.register_node("farming:barley_5", table.copy(def))
-- stage 6
crop_def.tiles = {"farming_barley_6.png"}
crop_def.drop = {
def.tiles = {"farming_barley_6.png"}
def.drop = {
items = {
{items = {"farming:barley"}, rarity = 2},
{items = {"farming:seed_barley"}, rarity = 1},
{items = {"farming:seed_barley"}, rarity = 1}
}
}
minetest.register_node("farming:barley_6", table.copy(crop_def))
minetest.register_node("farming:barley_6", table.copy(def))
-- stage 7 (final)
crop_def.tiles = {"farming_barley_7.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_barley_7.png"}
def.groups.growing = nil
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},
{items = {"farming:seed_barley"}, rarity = 3}
}
}
minetest.register_node("farming:barley_7", table.copy(crop_def))
minetest.register_node("farming:barley_7", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:barley"] = {
@ -114,9 +114,8 @@ farming.registered_plants["farming:barley"] = {
}
-- Fuel
minetest.register_craft({
type = "fuel",
recipe = "farming:barley",
burntime = 1,
burntime = 1
})

48
crops/beans.lua

@ -13,7 +13,6 @@ local function place_beans(itemstack, placer, pointed_thing, plantname)
-- check if pointing at a node
if not pt or pt.type ~= "node" then
return
end
@ -74,17 +73,16 @@ minetest.register_craftitem("farming:beans", {
inventory_image = "farming_beans.png",
groups = {seed = 2, food_beans = 1, flammable = 2},
on_use = minetest.item_eat(1),
on_place = function(itemstack, placer, pointed_thing)
return place_beans(itemstack, placer, pointed_thing, "farming:beanpole_1")
end,
end
})
-- beans can be used for green dye
minetest.register_craft({
output = "dye:green",
recipe = {
{"farming:beans"},
{"farming:beans"}
}
})
@ -94,7 +92,7 @@ minetest.register_node("farming:beanpole", {
drawtype = "plantlike",
tiles = {"farming_beanpole.png"},
inventory_image = "farming_beanpole.png",
visual_scale = 1.90, -- 1.45,
visual_scale = 1.90,
paramtype = "light",
walkable = false,
buildable_to = true,
@ -164,28 +162,28 @@ minetest.register_craft({
recipe = {
{"", "", ""},
{"default:stick", "", "default:stick"},
{"default:stick", "", "default:stick"},
{"default:stick", "", "default:stick"}
}
})
minetest.register_craft({
type = "fuel",
recipe = "farming:beanpole",
burntime = 10,
burntime = 10
})
-- green bean definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_beanpole_1.png"},
visual_scale = 1.90, -- 1.45,
visual_scale = 1.90,
paramtype = "light",
walkable = false,
buildable_to = true,
sunlight_propagates = true,
drop = {
items = {
{items = {"farming:beanpole"}, rarity = 1},
{items = {"farming:beanpole"}, rarity = 1}
}
},
selection_box = farming.select,
@ -197,32 +195,32 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:beanpole_1", table.copy(crop_def))
minetest.register_node("farming:beanpole_1", table.copy(def))
-- stage2
crop_def.tiles = {"farming_beanpole_2.png"}
minetest.register_node("farming:beanpole_2", table.copy(crop_def))
def.tiles = {"farming_beanpole_2.png"}
minetest.register_node("farming:beanpole_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_beanpole_3.png"}
minetest.register_node("farming:beanpole_3", table.copy(crop_def))
def.tiles = {"farming_beanpole_3.png"}
minetest.register_node("farming:beanpole_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_beanpole_4.png"}
minetest.register_node("farming:beanpole_4", table.copy(crop_def))
def.tiles = {"farming_beanpole_4.png"}
minetest.register_node("farming:beanpole_4", table.copy(def))
-- stage 5 (final)
crop_def.tiles = {"farming_beanpole_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_beanpole_5.png"}
def.groups.growing = nil
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},
{items = {"farming:beans 2"}, rarity = 3}
}
}
minetest.register_node("farming:beanpole_5", table.copy(crop_def))
minetest.register_node("farming:beanpole_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:beans"] = {
@ -246,13 +244,13 @@ minetest.register_node("farming:beanbush", {
items = {
{items = {"farming:beans 1"}, rarity = 1},
{items = {"farming:beans 1"}, rarity = 2},
{items = {"farming:beans 1"}, rarity = 3},
{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
not_in_creative_inventory = 1
},
sounds = default.node_sound_leaves_defaults(),
sounds = default.node_sound_leaves_defaults()
})

34
crops/beetroot.lua

@ -9,7 +9,7 @@ minetest.register_craftitem("farming:beetroot", {
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),
on_use = minetest.item_eat(1)
})
-- beetroot soup
@ -17,7 +17,7 @@ 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"),
on_use = minetest.item_eat(6, "farming:bowl")
})
minetest.register_craft({
@ -34,15 +34,13 @@ minetest.register_craft({
minetest.register_craft({
type = "shapeless",
output = "dye:red",
recipe = {"group:food_beetroot"},
recipe = {"group:food_beetroot"}
})
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_beetroot_1.png"},
paramtype = "light",
-- paramtype2 = "meshoptions",
-- place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
@ -57,32 +55,32 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:beetroot_1", table.copy(crop_def))
minetest.register_node("farming:beetroot_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_beetroot_2.png"}
minetest.register_node("farming:beetroot_2", table.copy(crop_def))
def.tiles = {"farming_beetroot_2.png"}
minetest.register_node("farming:beetroot_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_beetroot_3.png"}
minetest.register_node("farming:beetroot_3", table.copy(crop_def))
def.tiles = {"farming_beetroot_3.png"}
minetest.register_node("farming:beetroot_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_beetroot_4.png"}
minetest.register_node("farming:beetroot_4", table.copy(crop_def))
def.tiles = {"farming_beetroot_4.png"}
minetest.register_node("farming:beetroot_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_beetroot_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_beetroot_5.png"}
def.groups.growing = nil
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},
{items = {"farming:beetroot"}, rarity = 4}
}
}
minetest.register_node("farming:beetroot_5", table.copy(crop_def))
minetest.register_node("farming:beetroot_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:beetroot"] = {

30
crops/blueberry.lua

@ -10,30 +10,28 @@ minetest.register_craftitem("farming:blueberries", {
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),
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),
on_use = minetest.item_eat(2)
})
minetest.register_craft({
output = "farming:muffin_blueberry 2",
recipe = {
{"group:food_blueberries", "group:food_bread", "group:food_blueberries"},
{"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),
on_use = minetest.item_eat(6)
})
minetest.register_craft({
@ -47,7 +45,7 @@ minetest.register_craft({
})
-- blueberry definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_blueberry_1.png"},
paramtype = "light",
@ -64,27 +62,27 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:blueberry_1", table.copy(crop_def))
minetest.register_node("farming:blueberry_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_blueberry_2.png"}
minetest.register_node("farming:blueberry_2", table.copy(crop_def))
def.tiles = {"farming_blueberry_2.png"}
minetest.register_node("farming:blueberry_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_blueberry_3.png"}
minetest.register_node("farming:blueberry_3", table.copy(crop_def))
def.tiles = {"farming_blueberry_3.png"}
minetest.register_node("farming:blueberry_3", table.copy(def))
-- stage 4 (final)
crop_def.tiles = {"farming_blueberry_4.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_blueberry_4.png"}
def.groups.growing = nil
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))
minetest.register_node("farming:blueberry_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:blueberries"] = {

34
crops/cabbage.lua

@ -9,15 +9,13 @@ minetest.register_craftitem("farming:cabbage", {
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cabbage_1")
end,
on_use = minetest.item_eat(1),
on_use = minetest.item_eat(1)
})
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_cabbage_1.png"},
paramtype = "light",
-- paramtype2 = "meshoptions",
-- place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
@ -32,34 +30,34 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:cabbage_1", table.copy(crop_def))
minetest.register_node("farming:cabbage_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_cabbage_2.png"}
minetest.register_node("farming:cabbage_2", table.copy(crop_def))
def.tiles = {"farming_cabbage_2.png"}
minetest.register_node("farming:cabbage_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_cabbage_3.png"}
minetest.register_node("farming:cabbage_3", table.copy(crop_def))
def.tiles = {"farming_cabbage_3.png"}
minetest.register_node("farming:cabbage_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_cabbage_4.png"}
minetest.register_node("farming:cabbage_4", table.copy(crop_def))
def.tiles = {"farming_cabbage_4.png"}
minetest.register_node("farming:cabbage_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_cabbage_5.png"}
minetest.register_node("farming:cabbage_5", table.copy(crop_def))
def.tiles = {"farming_cabbage_5.png"}
minetest.register_node("farming:cabbage_5", table.copy(def))
-- stage 6
crop_def.tiles = {"farming_cabbage_6.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_cabbage_6.png"}
def.groups.growing = nil
def.drop = {
max_items = 2, items = {
{items = {"farming:cabbage"}, rarity = 1},
{items = {"farming:cabbage"}, rarity = 4},
{items = {"farming:cabbage"}, rarity = 5}
}
}
minetest.register_node("farming:cabbage_6", table.copy(crop_def))
minetest.register_node("farming:cabbage_6", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cabbage"] = {

54
crops/carrot.lua

@ -14,7 +14,7 @@ minetest.register_craftitem("farming:carrot", {
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),
on_use = minetest.item_eat(4)
})
-- carrot juice
@ -22,7 +22,7 @@ minetest.register_craftitem("farming:carrot_juice", {
description = S("Carrot Juice"),
inventory_image = "farming_carrot_juice.png",
on_use = minetest.item_eat(4, "vessels:drinking_glass"),
groups = {vessel = 1, drink = 1},
groups = {vessel = 1, drink = 1}
})
minetest.register_craft({
@ -32,15 +32,15 @@ minetest.register_craft({
"vessels:drinking_glass", "group:food_carrot", "farming:juicer"
},
replacements = {
{"group:food_juicer", "farming:juicer"},
},
{"group:food_juicer", "farming:juicer"}
}
})
-- golden carrot
minetest.register_craftitem("farming:carrot_gold", {
description = S("Golden Carrot"),
inventory_image = "farming_carrot_gold.png",
on_use = minetest.item_eat(6),
on_use = minetest.item_eat(10)
})
minetest.register_craft({
@ -48,12 +48,12 @@ minetest.register_craft({
recipe = {
{"", "default:gold_lump", ""},
{"default:gold_lump", "group:food_carrot", "default:gold_lump"},
{"", "default:gold_lump", ""},
{"", "default:gold_lump", ""}
}
})
-- carrot definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_carrot_1.png"},
paramtype = "light",
@ -71,48 +71,48 @@ local crop_def = {
-- stage 1
minetest.register_node("farming:carrot_1", table.copy(crop_def))
minetest.register_node("farming:carrot_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_carrot_2.png"}
minetest.register_node("farming:carrot_2", table.copy(crop_def))
def.tiles = {"farming_carrot_2.png"}
minetest.register_node("farming:carrot_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_carrot_3.png"}
minetest.register_node("farming:carrot_3", table.copy(crop_def))
def.tiles = {"farming_carrot_3.png"}
minetest.register_node("farming:carrot_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_carrot_4.png"}
minetest.register_node("farming:carrot_4", table.copy(crop_def))
def.tiles = {"farming_carrot_4.png"}
minetest.register_node("farming:carrot_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_carrot_5.png"}
minetest.register_node("farming:carrot_5", table.copy(crop_def))
def.tiles = {"farming_carrot_5.png"}
minetest.register_node("farming:carrot_5", table.copy(def))
-- stage 6
crop_def.tiles = {"farming_carrot_6.png"}
minetest.register_node("farming:carrot_6", table.copy(crop_def))
def.tiles = {"farming_carrot_6.png"}
minetest.register_node("farming:carrot_6", table.copy(def))
-- stage 7
crop_def.tiles = {"farming_carrot_7.png"}
crop_def.drop = {
def.tiles = {"farming_carrot_7.png"}
def.drop = {
items = {
{items = {"farming:carrot"}, rarity = 1},
{items = {"farming:carrot 2"}, rarity = 3},
{items = {"farming:carrot 2"}, rarity = 3}
}
}
minetest.register_node("farming:carrot_7", table.copy(crop_def))
minetest.register_node("farming:carrot_7", table.copy(def))
-- stage 8 (final)
crop_def.tiles = {"farming_carrot_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_carrot_8.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {"farming:carrot 2"}, rarity = 1},
{items = {"farming:carrot 3"}, rarity = 2},
{items = {"farming:carrot 3"}, rarity = 2}
}
}
minetest.register_node("farming:carrot_8", table.copy(crop_def))
minetest.register_node("farming:carrot_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:carrot"] = {

46
crops/chili.lua

@ -9,14 +9,14 @@ minetest.register_craftitem("farming:chili_pepper", {
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),
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"),
on_use = minetest.item_eat(8, "farming:bowl")
})
minetest.register_craft({
@ -25,19 +25,19 @@ minetest.register_craft({
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"},
{"farming:chili_pepper"}
}
})
-- chili definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_chili_1.png"},
paramtype = "light",
@ -54,42 +54,42 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:chili_1", table.copy(crop_def))
minetest.register_node("farming:chili_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_chili_2.png"}
minetest.register_node("farming:chili_2", table.copy(crop_def))
def.tiles = {"farming_chili_2.png"}
minetest.register_node("farming:chili_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_chili_3.png"}
minetest.register_node("farming:chili_3", table.copy(crop_def))
def.tiles = {"farming_chili_3.png"}
minetest.register_node("farming:chili_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_chili_4.png"}
minetest.register_node("farming:chili_4", table.copy(crop_def))
def.tiles = {"farming_chili_4.png"}
minetest.register_node("farming:chili_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_chili_5.png"}
minetest.register_node("farming:chili_5", table.copy(crop_def))
def.tiles = {"farming_chili_5.png"}
minetest.register_node("farming:chili_5", table.copy(def))
-- stage 6
crop_def.tiles = {"farming_chili_6.png"}
minetest.register_node("farming:chili_6", table.copy(crop_def))
def.tiles = {"farming_chili_6.png"}
minetest.register_node("farming:chili_6", table.copy(def))
-- stage 7
crop_def.tiles = {"farming_chili_7.png"}
minetest.register_node("farming:chili_7", table.copy(crop_def))
def.tiles = {"farming_chili_7.png"}
minetest.register_node("farming:chili_7", table.copy(def))
-- stage 8 (final)
crop_def.tiles = {"farming_chili_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_chili_8.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {"farming:chili_pepper 3"}, rarity = 1},
{items = {"farming:chili_pepper 2"}, rarity = 2},
{items = {"farming:chili_pepper 2"}, rarity = 2}
}
}
minetest.register_node("farming:chili_8", table.copy(crop_def))
minetest.register_node("farming:chili_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:chili_pepper"] = {

67
crops/cocoa.lua

@ -70,13 +70,13 @@ minetest.register_craftitem("farming:cocoa_beans", {
groups = {seed = 2, food_cocoa = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return place_cocoa(itemstack, placer, pointed_thing, "farming:cocoa_1")
end,
end
})
minetest.register_craft( {
output = "dye:brown 2",
recipe = {
{ "farming:cocoa_beans" },
{ "farming:cocoa_beans" }
}
})
@ -84,13 +84,13 @@ minetest.register_craft( {
minetest.register_craftitem("farming:cookie", {
description = S("Cookie"),
inventory_image = "farming_cookie.png",
on_use = minetest.item_eat(2),
on_use = minetest.item_eat(2)
})
minetest.register_craft( {
output = "farming:cookie 8",
recipe = {
{"group:food_wheat", "group:food_cocoa", "group:food_wheat" },
{"group:food_wheat", "group:food_cocoa", "group:food_wheat" }
}
})
@ -98,13 +98,13 @@ minetest.register_craft( {
minetest.register_craftitem("farming:chocolate_dark", {
description = S("Bar of Dark Chocolate"),
inventory_image = "farming_chocolate_dark.png",
on_use = minetest.item_eat(3),
on_use = minetest.item_eat(3)
})
minetest.register_craft( {
output = "farming:chocolate_dark",
recipe = {
{"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"},
{"group:food_cocoa", "group:food_cocoa", "group:food_cocoa"}
}
})
@ -114,7 +114,7 @@ minetest.register_node("farming:chocolate_block", {
tiles = {"farming_chocolate_block.png"},
is_ground_content = false,
groups = {cracky = 2, oddly_breakable_by_hand = 2},
sounds = default.node_sound_stone_defaults(),
sounds = default.node_sound_stone_defaults()
})
minetest.register_craft({
@ -122,19 +122,19 @@ minetest.register_craft({
recipe = {
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"},
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"},
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"},
{"farming:chocolate_dark", "farming:chocolate_dark", "farming:chocolate_dark"}
}
})
minetest.register_craft({
output = "farming:chocolate_dark 9",
recipe = {
{"farming:chocolate_block"},
{"farming:chocolate_block"}
}
})
-- cocoa definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_cocoa_1.png"},
paramtype = "light",
@ -150,7 +150,7 @@ local crop_def = {
},
groups = {
snappy = 3, flammable = 2, plant = 1, growing = 1,
not_in_creative_inventory=1, leafdecay = 1, leafdecay_drop = 1
not_in_creative_inventory = 1, leafdecay = 1, leafdecay_drop = 1
},
sounds = default.node_sound_leaves_defaults(),
growth_check = function(pos, node_name)
@ -158,37 +158,37 @@ local crop_def = {
return false
end
return true
end,
end
}
-- stage 1
minetest.register_node("farming:cocoa_1", table.copy(crop_def))
minetest.register_node("farming:cocoa_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_cocoa_2.png"}
minetest.register_node("farming:cocoa_2", table.copy(crop_def))
def.tiles = {"farming_cocoa_2.png"}
minetest.register_node("farming:cocoa_2", table.copy(def))
-- stage3
crop_def.tiles = {"farming_cocoa_3.png"}
crop_def.drop = {
def.tiles = {"farming_cocoa_3.png"}
def.drop = {
items = {
{items = {"farming:cocoa_beans 1"}, rarity = 1},
{items = {"farming:cocoa_beans 1"}, rarity = 1}
}
}
minetest.register_node("farming:cocoa_3", table.copy(crop_def))
minetest.register_node("farming:cocoa_3", table.copy(def))
-- stage 4 (final)
crop_def.tiles = {"farming_cocoa_4.png"}
crop_def.groups.growing = 0
crop_def.growth_check = nil
crop_def.drop = {
def.tiles = {"farming_cocoa_4.png"}
def.groups.growing = nil
def.growth_check = nil
def.drop = {
items = {
{items = {"farming:cocoa_beans 2"}, rarity = 1},
{items = {"farming:cocoa_beans 1"}, rarity = 2},
{items = {"farming:cocoa_beans 1"}, rarity = 4},
{items = {"farming:cocoa_beans 1"}, rarity = 4}
}
}
minetest.register_node("farming:cocoa_4", table.copy(crop_def))
minetest.register_node("farming:cocoa_4", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cocoa_beans"] = {
@ -218,27 +218,22 @@ minetest.register_on_generated(function(minp, maxp)
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
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))
--print ("Cocoa Pod added at " .. minetest.pos_to_string(pos))
minetest.swap_node(pos, {
name = "farming:cocoa_" .. tostring(math.random(1, 4))
name = "farming:cocoa_" .. tostring(math.random(4))
})
end
end
end
end)

37
crops/coffee.lua

@ -8,13 +8,13 @@ minetest.register_craftitem("farming:coffee_beans", {
groups = {seed = 2, food_coffee = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:coffee_1")
end,
end
})
-- cold cup of coffee
minetest.register_node("farming:coffee_cup", {
description = S("Cup of Coffee"),
drawtype = "torchlike", --"plantlike",
drawtype = "torchlike",
tiles = {"farming_coffee_cup.png"},
inventory_image = "farming_coffee_cup.png",
wield_image = "farming_coffee_cup.png",
@ -26,7 +26,7 @@ minetest.register_node("farming:coffee_cup", {
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1, drink = 1},
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults()
})
minetest.register_alias("farming:coffee_cup_hot", "farming:coffee_cup")
@ -35,16 +35,17 @@ 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",
recipe = {
"vessels:drinking_glass", "group:food_coffee",
"bucket:bucket_water", "group:food_saucepan"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"},
{"group:food_saucepan", "farming:saucepan"},
{"group:food_saucepan", "farming:saucepan"}
}
})
-- coffee definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_coffee_1.png"},
paramtype = "light",
@ -61,31 +62,31 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:coffee_1", table.copy(crop_def))
minetest.register_node("farming:coffee_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_coffee_2.png"}
minetest.register_node("farming:coffee_2", table.copy(crop_def))
def.tiles = {"farming_coffee_2.png"}
minetest.register_node("farming:coffee_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_coffee_3.png"}
minetest.register_node("farming:coffee_3", table.copy(crop_def))
def.tiles = {"farming_coffee_3.png"}
minetest.register_node("farming:coffee_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_coffee_4.png"}
minetest.register_node("farming:coffee_4", table.copy(crop_def))
def.tiles = {"farming_coffee_4.png"}
minetest.register_node("farming:coffee_4", table.copy(def))
-- stage 5 (final)
crop_def.tiles = {"farming_coffee_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_coffee_5.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {"farming:coffee_beans 2"}, rarity = 1},
{items = {"farming:coffee_beans 2"}, rarity = 2},
{items = {"farming:coffee_beans 2"}, rarity = 3},
{items = {"farming:coffee_beans 2"}, rarity = 3}
}
}
minetest.register_node("farming:coffee_5", table.copy(crop_def))
minetest.register_node("farming:coffee_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:coffee"] = {

56
crops/corn.lua

@ -14,7 +14,7 @@ minetest.register_craftitem("farming:corn", {
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),
on_use = minetest.item_eat(3)
})
-- corn on the cob (texture by TenPlus1)
@ -22,7 +22,7 @@ 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),
on_use = minetest.item_eat(5)
})
minetest.register_craft({
@ -36,7 +36,7 @@ minetest.register_craft({
minetest.register_craftitem("farming:cornstarch", {
description = S("Cornstarch"),
inventory_image = "farming_cornstarch.png",
groups = {food_cornstarch = 1, flammable = 2},
groups = {food_cornstarch = 1, flammable = 2}
})
minetest.register_craft({
@ -66,7 +66,7 @@ minetest.register_node("farming:bottle_ethanol", {
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(),
sounds = default.node_sound_glass_defaults()
})
minetest.register_craft( {
@ -74,19 +74,19 @@ minetest.register_craft( {
recipe = {
{ "vessels:glass_bottle", "group:food_corn", "group:food_corn"},
{ "group:food_corn", "group:food_corn", "group:food_corn"},
{ "group:food_corn", "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,
burntime = 80,
replacements = {{ "farming:bottle_ethanol", "vessels:glass_bottle"}}
})
-- corn definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_corn_1.png"},
paramtype = "light",
@ -103,51 +103,51 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:corn_1", table.copy(crop_def))
minetest.register_node("farming:corn_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_corn_2.png"}
minetest.register_node("farming:corn_2", table.copy(crop_def))
def.tiles = {"farming_corn_2.png"}
minetest.register_node("farming:corn_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_corn_3.png"}
minetest.register_node("farming:corn_3", table.copy(crop_def))
def.tiles = {"farming_corn_3.png"}
minetest.register_node("farming:corn_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_corn_4.png"}
minetest.register_node("farming:corn_4", table.copy(crop_def))
def.tiles = {"farming_corn_4.png"}
minetest.register_node("farming:corn_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_corn_5.png"}
minetest.register_node("farming:corn_5", table.copy(crop_def))
def.tiles = {"farming_corn_5.png"}
minetest.register_node("farming:corn_5", table.copy(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))
def.tiles = {"farming_corn_6.png"}
def.visual_scale = 1.9
minetest.register_node("farming:corn_6", table.copy(def))
-- stage 7
crop_def.tiles = {"farming_corn_7.png"}
crop_def.drop = {
def.tiles = {"farming_corn_7.png"}
def.drop = {
items = {
{items = {"farming:corn"}, rarity = 1},
{items = {"farming:corn"}, rarity = 2},
{items = {"farming:corn"}, rarity = 3},
{items = {"farming:corn"}, rarity = 3}
}
}
minetest.register_node("farming:corn_7", table.copy(crop_def))
minetest.register_node("farming:corn_7", table.copy(def))
-- stage 8 (final)
crop_def.tiles = {"farming_corn_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_corn_8.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {"farming:corn 2"}, rarity = 1},
{items = {"farming:corn 2"}, rarity = 2},
{items = {"farming:corn 2"}, rarity = 2},
{items = {"farming:corn 2"}, rarity = 2}
}
}
minetest.register_node("farming:corn_8", table.copy(crop_def))
minetest.register_node("farming:corn_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:corn"] = {

83
crops/cotton.lua

@ -1,7 +1,7 @@
local S = farming.intllib
-- wild cotton as a source of cotton seed
-- wild cotton as a source of cotton seed and a chance of cotton itself
minetest.register_node("farming:cotton_wild", {
description = S("Wild Cotton"),
drawtype = "plantlike",
@ -14,12 +14,17 @@ minetest.register_node("farming:cotton_wild", {
walkable = false,
buildable_to = true,
groups = {snappy = 3, attached_node = 1, flammable = 4},
drop = "farming:seed_cotton",
drop = {
items = {
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:seed_cotton"}, rarity = 1}
}
},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16},
},
fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16}
}
})
-- cotton seeds
@ -37,21 +42,21 @@ minetest.register_node("farming:seed_cotton", {
selection_box = farming.select,
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:cotton_1")
end,
end
})
-- cotton / string
-- cotton
minetest.register_craftitem("farming:cotton", {
description = S("Cotton"),
inventory_image = "farming_cotton.png",
groups = {flammable = 4},
groups = {flammable = 4}
})
-- string
minetest.register_craftitem("farming:string", {
description = S("String"),
inventory_image = "farming_string.png",
groups = {flammable = 2},
groups = {flammable = 2}
})
-- cotton to wool
@ -59,7 +64,7 @@ minetest.register_craft({
output = "wool:white",
recipe = {
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"},
{"farming:cotton", "farming:cotton"}
}
})
@ -68,7 +73,7 @@ minetest.register_craft({
output = "farming:string 2",
recipe = {
{"farming:cotton"},
{"farming:cotton"},
{"farming:cotton"}
}
})
@ -76,17 +81,17 @@ minetest.register_craft({
minetest.register_craft({
type = "fuel",
recipe = "farming:string",
burntime = 1,
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:cotton",
burntime = 1,
burntime = 1
})
-- cotton definition
local crop_def = {
local def = {
drawtype = "plantlike",
tiles = {"farming_cotton_1.png"},
paramtype = "light",
@ -103,65 +108,65 @@ local crop_def = {
}
-- stage 1
minetest.register_node("farming:cotton_1", table.copy(crop_def))
minetest.register_node("farming:cotton_1", table.copy(def))
-- stage 2
crop_def.tiles = {"farming_cotton_2.png"}
minetest.register_node("farming:cotton_2", table.copy(crop_def))
def.tiles = {"farming_cotton_2.png"}
minetest.register_node("farming:cotton_2", table.copy(def))
-- stage 3
crop_def.tiles = {"farming_cotton_3.png"}
minetest.register_node("farming:cotton_3", table.copy(crop_def))
def.tiles = {"farming_cotton_3.png"}
minetest.register_node("farming:cotton_3", table.copy(def))
-- stage 4
crop_def.tiles = {"farming_cotton_4.png"}
minetest.register_node("farming:cotton_4", table.copy(crop_def))
def.tiles = {"farming_cotton_4.png"}
minetest.register_node("farming:cotton_4", table.copy(def))
-- stage 5
crop_def.tiles = {"farming_cotton_5.png"}
crop_def.drop = {
def.tiles = {"farming_cotton_5.png"}
def.drop = {
items = {
{items = {"farming:seed_cotton"}, rarity = 1},
{items = {"farming:seed_cotton"}, rarity = 1}
}
}
minetest.register_node("farming:cotton_5", table.copy(crop_def))
minetest.register_node("farming:cotton_5", table.copy(def))
-- stage 6
crop_def.tiles = {"farming_cotton_6.png"}
crop_def.drop = {
def.tiles = {"farming_cotton_6.png"}
def.drop = {
items = {
{items = {"farming:cotton"}, rarity = 1},
{items = {"farming:cotton"}, rarity = 2},
{items = {"farming:cotton"}, rarity = 2}
}
}
minetest.register_node("farming:cotton_6", table.copy(crop_def))
minetest.register_node("farming:cotton_6", table.copy(def))
-- stage 7
crop_def.tiles = {"farming_cotton_7.png"}
crop_def.drop = {
def.tiles = {"farming_cotton_7.png"}
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},
{items = {"farming:seed_cotton"}, rarity = 2}
}
}
minetest.register_node("farming:cotton_7", table.copy(crop_def))
minetest.register_node("farming:cotton_7", table.copy(def))
-- stage 8 (final)
crop_def.tiles = {"farming_cotton_8.png"}
crop_def.groups.growing = 0
crop_def.drop = {
def.tiles = {"farming_cotton_8.png"}
def.groups.growing = nil
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},
{items = {"farming:seed_cotton"}, rarity = 3}
}
}
minetest.register_node("farming:cotton_8", table.copy(crop_def))
minetest.register_node("farming:cotton_8", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:cotton"] = {
@ -172,7 +177,7 @@ farming.registered_plants["farming:cotton"] = {
steps = 8
}
--[[ Cotton (example, is already registered in cotton.lua)
--[[ Cotton using api
farming.register_plant("farming:cotton", {
description = "Cotton seed",
inventory_image = "farming_cotton_seed.png",

24
crops/cucumber.lua

@ -14,11 +14,11 @@ minetest.register_craftitem("farming:cucumber", {
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),
on_use = minetest.item_eat(4)
})
-- cucumber definition
local crop_def = {