add spawn rate for each crop in settings

This commit is contained in:
TenPlus1 2019-04-27 08:34:29 +01:00
parent 1c8dfd0cba
commit 561d0d01a1
4 changed files with 64 additions and 58 deletions

View File

@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
### Changelog: ### Changelog:
- 1.41 - Each crop has it's own spawn rate (can be changed in farming.conf)
- 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click. Added Hoe's for MoreOres with Toolrank support. - 1.40 - Added Mithril Scythe to quick harvest and replant crops on right-click. Added Hoe's for MoreOres with Toolrank support.
- 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread. - 1.39 - Added Rice, Rye and Oats thanks to Ademants Grains mod. Added Jaffa Cake and multigrain bread.
- 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.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

View File

@ -5,31 +5,32 @@
world folder for map specific settings. world folder for map specific settings.
--]] --]]
-- true to enable crop/food in-game and on mapgen -- true to enable crop/food in-game and on mapgen set spawn rarety
farming.carrot = true farming.carrot = 0.001
farming.potato = true farming.potato = 0.001
farming.tomato = true farming.tomato = 0.001
farming.cucumber = true farming.cucumber = 0.001
farming.corn = true farming.corn = 0.001
farming.coffee = true farming.coffee = 0.001
farming.melon = true farming.melon = 0.001
farming.pumpkin = true farming.pumpkin = 0.001
farming.cocoa = true farming.cocoa = true -- true or false only
farming.raspberry = true farming.raspberry = 0.001
farming.blueberry = true farming.blueberry = 0.001
farming.rhubarb = true farming.rhubarb = 0.001
farming.beans = true farming.beans = 0.001
farming.grapes = true farming.grapes = 0.001
farming.barley = true farming.barley = true -- true or false only
farming.chili = true farming.chili = 0.002
farming.hemp = true farming.hemp = 0.002
farming.onion = true farming.garlic = 0.001
farming.garlic = true farming.onion = 0.001
farming.pepper = true farming.pepper = 0.002
farming.pineapple = true farming.pineapple = 0.001
farming.peas = true farming.peas = 0.001
farming.beetroot = true farming.beetroot = 0.001
farming.grains = true farming.grains = true -- true or false only
farming.rarety = 0.002
-- rarety of crops on map, default is 0.001 (higher number = more crops)
-- rarety of crops on map, default is 0.002 (higher number = more crops)
farming.rarety = 0.002 farming.rarety = 0.002

View File

@ -7,7 +7,7 @@
farming = { farming = {
mod = "redo", mod = "redo",
version = "20190111", version = "20190427",
path = minetest.get_modpath("farming"), path = minetest.get_modpath("farming"),
select = { select = {
type = "fixed", type = "fixed",
@ -599,31 +599,31 @@ end
-- default settings -- default settings
farming.carrot = true farming.carrot = 0.001
farming.potato = true farming.potato = 0.001
farming.tomato = true farming.tomato = 0.001
farming.cucumber = true farming.cucumber = 0.001
farming.corn = true farming.corn = 0.001
farming.coffee = true farming.coffee = 0.001
farming.melon = true farming.melon = 0.001
farming.pumpkin = true farming.pumpkin = 0.001
farming.cocoa = true farming.cocoa = true
farming.raspberry = true farming.raspberry = 0.001
farming.blueberry = true farming.blueberry = 0.001
farming.rhubarb = true farming.rhubarb = 0.001
farming.beans = true farming.beans = 0.001
farming.grapes = true farming.grapes = 0.001
farming.barley = true farming.barley = true
farming.chili = true farming.chili = 0.002
farming.hemp = true farming.hemp = 0.002
farming.garlic = true farming.garlic = 0.001
farming.onion = true farming.onion = 0.001
farming.pepper = true farming.pepper = 0.002
farming.pineapple = true farming.pineapple = 0.001
farming.peas = true farming.peas = 0.001
farming.beetroot = true farming.beetroot = 0.001
farming.grains = true farming.grains = true
farming.rarety = 0.002 -- 0.006 farming.rarety = 0.002
-- Load new global settings if found inside mod folder -- Load new global settings if found inside mod folder

View File

@ -1,18 +1,22 @@
-- decoration function -- decoration function
local function register_plant(name, min, max, spawnon, spawnby, num, enabled) local function register_plant(name, min, max, spawnon, spawnby, num, rarety)
if enabled ~= true then -- do not place on mapgen if no value given (or not true)
if not rarety then
return return
end end
-- set rarety value or default to farming.rarety if not a number
rarety = tonumber(rarety) or farming.rarety
minetest.register_decoration({ minetest.register_decoration({
deco_type = "simple", deco_type = "simple",
place_on = spawnon or {"default:dirt_with_grass"}, place_on = spawnon or {"default:dirt_with_grass"},
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = farming.rarety, -- 0.006, scale = rarety,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 329, seed = 329,
octaves = 3, octaves = 3,
@ -55,7 +59,7 @@ else
register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot) register_plant("carrot_8", 1, 15, nil, "", -1, farming.carrot)
register_plant("cucumber_4", 1, 10, nil, "", -1, farming.cucumber) register_plant("cucumber_4", 1, 10, nil, "", -1, farming.cucumber)
register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass", register_plant("melon_8", 1, 6, {"default:dirt_with_dry_grass",
"default:dirt_with_rainforest_litter"}, "", -1, farming.melon) "default:dirt_with_rainforest_litter"}, "", -1, farming.melon)
register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin) register_plant("pumpkin_8", 1, 6, nil, "", -1, farming.pumpkin)
end end
@ -66,7 +70,7 @@ minetest.register_decoration({
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = farming.rarety, -- 0.06, scale = tonumber(farming.hemp) or farming.rarety,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 420, seed = 420,
octaves = 3, octaves = 3,
@ -87,7 +91,7 @@ minetest.register_decoration({
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = farming.rarety, -- 0.06, scale = tonumber(farming.chili) or farming.rarety,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 760, seed = 760,
octaves = 3, octaves = 3,
@ -108,7 +112,7 @@ minetest.register_decoration({
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = farming.rarety, -- 0.06, scale = tonumber(farming.pepper) or farming.rarety,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 933, seed = 933,
octaves = 3, octaves = 3,
@ -129,7 +133,7 @@ minetest.register_decoration({
sidelen = 16, sidelen = 16,
noise_params = { noise_params = {
offset = 0, offset = 0,
scale = farming.rarety, -- 0.06, scale = tonumber(farming.pineapple) or farming.rarety,
spread = {x = 100, y = 100, z = 100}, spread = {x = 100, y = 100, z = 100},
seed = 917, seed = 917,
octaves = 3, octaves = 3,