From 0e108c4b2ab7bc4a269f273747bf263d61896181 Mon Sep 17 00:00:00 2001 From: tenplus1 Date: Wed, 9 Dec 2020 10:22:41 +0000 Subject: [PATCH] add min_light and max_light settings and amend crop registered_plants tables --- README.md | 2 +- crops/barley.lua | 4 ++-- crops/beans.lua | 4 ++-- crops/beetroot.lua | 4 ++-- crops/blueberry.lua | 4 ++-- crops/cabbage.lua | 4 ++-- crops/carrot.lua | 4 ++-- crops/chili.lua | 4 ++-- crops/cocoa.lua | 4 ++-- crops/coffee.lua | 4 ++-- crops/corn.lua | 4 ++-- crops/cotton.lua | 4 ++-- crops/cucumber.lua | 4 ++-- crops/garlic.lua | 4 ++-- crops/grapes.lua | 4 ++-- crops/hemp.lua | 4 ++-- crops/melon.lua | 4 ++-- crops/mint.lua | 4 ++-- crops/onion.lua | 4 ++-- crops/peas.lua | 4 ++-- crops/pepper.lua | 4 ++-- crops/pineapple.lua | 4 ++-- crops/potato.lua | 4 ++-- crops/pumpkin.lua | 4 ++-- crops/raspberry.lua | 4 ++-- crops/rhubarb.lua | 4 ++-- crops/tomato.lua | 4 ++-- crops/wheat.lua | 4 ++-- farming.conf_example | 4 ++++ init.lua | 11 ++++++----- 30 files changed, 65 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 353d6f9..7afd0e7 100644 --- a/README.md +++ b/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, 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. diff --git a/crops/barley.lua b/crops/barley.lua index 69b3056..65d1f03 100644 --- a/crops/barley.lua +++ b/crops/barley.lua @@ -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 } diff --git a/crops/beans.lua b/crops/beans.lua index b469d08..38d8fa9 100644 --- a/crops/beans.lua +++ b/crops/beans.lua @@ -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 } diff --git a/crops/beetroot.lua b/crops/beetroot.lua index f20cfea..ef57986 100644 --- a/crops/beetroot.lua +++ b/crops/beetroot.lua @@ -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 } diff --git a/crops/blueberry.lua b/crops/blueberry.lua index 38053ad..e8d83c3 100644 --- a/crops/blueberry.lua +++ b/crops/blueberry.lua @@ -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 } diff --git a/crops/cabbage.lua b/crops/cabbage.lua index 4a3c2e2..4e75d63 100644 --- a/crops/cabbage.lua +++ b/crops/cabbage.lua @@ -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 } diff --git a/crops/carrot.lua b/crops/carrot.lua index f19338c..8be1f4e 100644 --- a/crops/carrot.lua +++ b/crops/carrot.lua @@ -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 } diff --git a/crops/chili.lua b/crops/chili.lua index 867c945..4334556 100644 --- a/crops/chili.lua +++ b/crops/chili.lua @@ -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 } diff --git a/crops/cocoa.lua b/crops/cocoa.lua index 9e8a404..72e37d0 100644 --- a/crops/cocoa.lua +++ b/crops/cocoa.lua @@ -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 } diff --git a/crops/coffee.lua b/crops/coffee.lua index f234573..f64369c 100644 --- a/crops/coffee.lua +++ b/crops/coffee.lua @@ -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 } diff --git a/crops/corn.lua b/crops/corn.lua index 4835281..0999fb9 100644 --- a/crops/corn.lua +++ b/crops/corn.lua @@ -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 } diff --git a/crops/cotton.lua b/crops/cotton.lua index 067b444..6ea2e6f 100644 --- a/crops/cotton.lua +++ b/crops/cotton.lua @@ -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 } diff --git a/crops/cucumber.lua b/crops/cucumber.lua index fc15e47..c5e70de 100644 --- a/crops/cucumber.lua +++ b/crops/cucumber.lua @@ -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 } diff --git a/crops/garlic.lua b/crops/garlic.lua index 7fe7565..162bace 100644 --- a/crops/garlic.lua +++ b/crops/garlic.lua @@ -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 } diff --git a/crops/grapes.lua b/crops/grapes.lua index 5d13dc6..8c5e458 100644 --- a/crops/grapes.lua +++ b/crops/grapes.lua @@ -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 } diff --git a/crops/hemp.lua b/crops/hemp.lua index 03ed4d2..f8dfd0b 100644 --- a/crops/hemp.lua +++ b/crops/hemp.lua @@ -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 } diff --git a/crops/melon.lua b/crops/melon.lua index 6495a13..0549dd3 100644 --- a/crops/melon.lua +++ b/crops/melon.lua @@ -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 } diff --git a/crops/mint.lua b/crops/mint.lua index ae0e670..5bc4021 100644 --- a/crops/mint.lua +++ b/crops/mint.lua @@ -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 } diff --git a/crops/onion.lua b/crops/onion.lua index 30c9bc3..2a8c63f 100644 --- a/crops/onion.lua +++ b/crops/onion.lua @@ -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 } diff --git a/crops/peas.lua b/crops/peas.lua index 0c8e40c..7c6a83d 100644 --- a/crops/peas.lua +++ b/crops/peas.lua @@ -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 } diff --git a/crops/pepper.lua b/crops/pepper.lua index 4d5baf8..848c2ae 100644 --- a/crops/pepper.lua +++ b/crops/pepper.lua @@ -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 } diff --git a/crops/pineapple.lua b/crops/pineapple.lua index f57ccf0..839a627 100644 --- a/crops/pineapple.lua +++ b/crops/pineapple.lua @@ -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 } diff --git a/crops/potato.lua b/crops/potato.lua index 8c087d0..a55ab29 100644 --- a/crops/potato.lua +++ b/crops/potato.lua @@ -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 } diff --git a/crops/pumpkin.lua b/crops/pumpkin.lua index 1b0b8c4..5e29c01 100644 --- a/crops/pumpkin.lua +++ b/crops/pumpkin.lua @@ -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 } diff --git a/crops/raspberry.lua b/crops/raspberry.lua index 0914aa4..df1d3d9 100644 --- a/crops/raspberry.lua +++ b/crops/raspberry.lua @@ -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 } diff --git a/crops/rhubarb.lua b/crops/rhubarb.lua index bd44a71..073cc18 100644 --- a/crops/rhubarb.lua +++ b/crops/rhubarb.lua @@ -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 } diff --git a/crops/tomato.lua b/crops/tomato.lua index 7905828..47879b6 100644 --- a/crops/tomato.lua +++ b/crops/tomato.lua @@ -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 } diff --git a/crops/wheat.lua b/crops/wheat.lua index 7a8f19b..e21d7f6 100644 --- a/crops/wheat.lua +++ b/crops/wheat.lua @@ -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 } diff --git a/farming.conf_example b/farming.conf_example index 68a7bcb..e5837b2 100644 --- a/farming.conf_example +++ b/farming.conf_example @@ -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 diff --git a/init.lua b/init.lua index fd2aa21..04ee74f 100644 --- a/init.lua +++ b/init.lua @@ -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