add min_light and max_light settings and amend crop registered_plants tables

This commit is contained in:
tenplus1 2020-12-09 10:22:41 +00:00
parent f7524e1449
commit 0e108c4b2a
30 changed files with 65 additions and 60 deletions

View File

@ -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, spaghetti, cabbage, korean bibimbap, code tidy
- 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, minmax light setting
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.

View File

@ -108,8 +108,8 @@ minetest.register_node("farming:barley_7", table.copy(def))
farming.registered_plants["farming:barley"] = {
crop = "farming:barley",
seed = "farming:seed_barley",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 7
}

View File

@ -226,8 +226,8 @@ minetest.register_node("farming:beanpole_5", table.copy(def))
farming.registered_plants["farming:beans"] = {
crop = "farming:beanpole",
seed = "farming:beans",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -86,7 +86,7 @@ minetest.register_node("farming:beetroot_5", table.copy(def))
farming.registered_plants["farming:beetroot"] = {
crop = "farming:beetroot",
seed = "farming:beetroot",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -88,7 +88,7 @@ minetest.register_node("farming:blueberry_4", table.copy(def))
farming.registered_plants["farming:blueberries"] = {
crop = "farming:blueberry",
seed = "farming:blueberries",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -63,7 +63,7 @@ minetest.register_node("farming:cabbage_6", table.copy(def))
farming.registered_plants["farming:cabbage"] = {
crop = "farming:cabbage",
seed = "farming:cabbage",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 6
}

View File

@ -118,7 +118,7 @@ minetest.register_node("farming:carrot_8", table.copy(def))
farming.registered_plants["farming:carrot"] = {
crop = "farming:carrot",
seed = "farming:carrot",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -95,7 +95,7 @@ minetest.register_node("farming:chili_8", table.copy(def))
farming.registered_plants["farming:chili_pepper"] = {
crop = "farming:chili",
seed = "farming:chili_pepper",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -194,8 +194,8 @@ minetest.register_node("farming:cocoa_4", table.copy(def))
farming.registered_plants["farming:cocoa_beans"] = {
crop = "farming:cocoa",
seed = "farming:cocoa_beans",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -106,7 +106,7 @@ minetest.register_node("farming:coffee_5", table.copy(def))
farming.registered_plants["farming:coffee"] = {
crop = "farming:coffee",
seed = "farming:coffee_beans",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -153,7 +153,7 @@ minetest.register_node("farming:corn_8", table.copy(def))
farming.registered_plants["farming:corn"] = {
crop = "farming:corn",
seed = "farming:corn",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -172,8 +172,8 @@ minetest.register_node("farming:cotton_8", table.copy(def))
farming.registered_plants["farming:cotton"] = {
crop = "farming:cotton",
seed = "farming:seed_cotton",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -59,7 +59,7 @@ minetest.register_node("farming:cucumber_4", table.copy(def))
farming.registered_plants["farming:cucumber"] = {
crop = "farming:cucumber",
seed = "farming:cucumber",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -129,7 +129,7 @@ minetest.register_node("farming:garlic_5", table.copy(def))
farming.registered_plants["farming:garlic"] = {
crop = "farming:garlic",
seed = "farming:garlic_clove",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -233,8 +233,8 @@ minetest.register_node("farming:grapes_8", table.copy(def))
farming.registered_plants["farming:grapes"] = {
crop = "farming:grapes",
seed = "farming:grapes",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -256,7 +256,7 @@ minetest.register_node("farming:hemp_8", table.copy(def))
farming.registered_plants["farming:hemp"] = {
crop = "farming:hemp",
seed = "farming:seed_hemp",
minlight = 13,
maxlight = 15,
mminlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -88,7 +88,7 @@ minetest.register_node("farming:melon_8", table.copy(def))
farming.registered_plants["farming:melon"] = {
crop = "farming:melon",
seed = "farming:melon_slice",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -101,7 +101,7 @@ minetest.register_node("farming:mint_4", table.copy(def))
farming.registered_plants["farming:mint"] = {
crop = "farming:mint",
seed = "farming:seed_mint",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -90,7 +90,7 @@ minetest.register_node("farming:onion_5", table.copy(def))
farming.registered_plants["farming:onion"] = {
crop = "farming:onion",
seed = "farming:onion",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -91,7 +91,7 @@ minetest.register_node("farming:pea_5", table.copy(def))
farming.registered_plants["farming:pea_pod"] = {
crop = "farming:pea",
seed = "farming:pea_pod",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -109,7 +109,7 @@ minetest.register_node("farming:pepper_5", table.copy(def))
farming.registered_plants["farming:pepper"] = {
crop = "farming:pepper",
seed = "farming:peppercorn",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}

View File

@ -135,7 +135,7 @@ minetest.register_node("farming:pineapple_8", table.copy(def))
farming.registered_plants["farming:pineapple"] = {
crop = "farming:pineapple",
seed = "farming:pineapple_top",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -106,7 +106,7 @@ minetest.register_node("farming:potato_4", table.copy(def))
farming.registered_plants["farming:potato"] = {
crop = "farming:potato",
seed = "farming:potato",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -200,7 +200,7 @@ minetest.register_alias("farming:pumpkin", "farming:pumpkin_8")
farming.registered_plants["farming:pumpkin"] = {
crop = "farming:pumpkin",
seed = "farming:pumpkin_slice",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -74,7 +74,7 @@ minetest.register_node("farming:raspberry_4", table.copy(def))
farming.registered_plants["farming:raspberries"] = {
crop = "farming:raspberry",
seed = "farming:raspberries",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 4
}

View File

@ -71,7 +71,7 @@ minetest.register_node("farming:rhubarb_3", table.copy(def))
farming.registered_plants["farming:rhubarb"] = {
crop = "farming:rhubarb",
seed = "farming:rhubarb",
minlight = 13,
maxlight = 15,
minlight = 10,
maxlight = 12,
steps = 3
}

View File

@ -83,7 +83,7 @@ minetest.register_node("farming:tomato_8", table.copy(def))
farming.registered_plants["farming:tomato"] = {
crop = "farming:tomato",
seed = "farming:tomato",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -234,8 +234,8 @@ minetest.register_node("farming:wheat_8", table.copy(def))
farming.registered_plants["farming:wheat"] = {
crop = "farming:wheat",
seed = "farming:seed_wheat",
minlight = 13,
maxlight = 15,
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 8
}

View File

@ -35,3 +35,7 @@ farming.grains = true -- true or false only
-- default rarety of crops on map (higher number = more crops)
farming.rarety = 0.002
-- default minimum and maximum light levels crops need to grow
farming.min_light = 12
farming.max_light = 15

View File

@ -7,13 +7,15 @@
farming = {
mod = "redo",
version = "20200702",
version = "20201209",
path = minetest.get_modpath("farming"),
select = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}
},
registered_plants = {}
registered_plants = {},
min_light = 12,
max_light = 15
}
@ -332,9 +334,8 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
return true
end
local MIN_LIGHT = minetest.registered_nodes[node_name].minlight or 12
local MAX_LIGHT = minetest.registered_nodes[node_name].maxlight or 15
--print ("---", MIN_LIGHT, MAX_LIGHT)
local MIN_LIGHT = minetest.registered_nodes[node_name].minlight or farming.min_light
local MAX_LIGHT = minetest.registered_nodes[node_name].maxlight or farming.max_light
if max_growth == 1 or lambda < 2.0 then