From e474194daf2dd2456cc950c7a2a4ffc9a4d5685c Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 18:41:03 -0400 Subject: [PATCH 1/6] speed up sapling growth. they're just too damned slow also sped up the on_gen ones they were slower than they needed to be --- default_settings.txt | 4 ++-- saplings.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/default_settings.txt b/default_settings.txt index 6aa64b5..3b7ce86 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -122,8 +122,8 @@ moretrees.dates_item_drop_ichance = 10 -- inverse probability of ripe dates dr -- Sapling settings -moretrees.sapling_interval = 500 -moretrees.sapling_chance = 20 +moretrees.sapling_interval = 100 +moretrees.sapling_chance = 5 -- If this variable is set to true, drop leaves out as entities during leaf -- decay, rather than just disappearing them. diff --git a/saplings.lua b/saplings.lua index bd20988..eae0c17 100644 --- a/saplings.lua +++ b/saplings.lua @@ -19,7 +19,7 @@ for i in ipairs(moretrees.treelist) do if moretrees.spawn_saplings then biome_lib:grow_plants({ grow_delay = 2, - grow_chance = 30, + grow_chance = 2, grow_plant = "moretrees:"..treename.."_sapling_ongen", grow_nodes = moretrees[tree_biome].surface, grow_function = moretrees[tree_model], From a27af10d2eb18956f773f8b9b5b09dca12054d63 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 18:43:04 -0400 Subject: [PATCH 2/6] put on_gen saplings into creative inv, adjust description --- node_defs.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node_defs.lua b/node_defs.lua index b33dede..84e9b55 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -212,7 +212,7 @@ for i in ipairs(moretrees.treelist) do end minetest.register_node("moretrees:"..treename.."_sapling_ongen", { - description = S(treedesc.." Sapling (on-generated)"), + description = S(treedesc.." Sapling (fast growth)"), drawtype = "plantlike", tiles = {saptex}, inventory_image = saptex, @@ -224,7 +224,7 @@ for i in ipairs(moretrees.treelist) do type = "fixed", fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3} }, - groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,not_in_creative_inventory=1,sapling=1}, + groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1}, sounds = default.node_sound_defaults(), drop = "moretrees:"..treename.."_sapling" }) From 7161cfbdeef30ef5b652494e711a754897c42b6f Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 19:09:41 -0400 Subject: [PATCH 3/6] rework how sapling growth is defined if on-gen, saplings grow per their biome_defs.lua settings if placed, they grow on the surfaces given in the tables: * anything but palms will grow on the dirt surfaces * conifers can also grow on a cold surface, but other trees will not * only palms can grow on sand, but they will not grow on dirt or cold --- saplings.lua | 147 ++++++++++++++++++++++----------------------------- 1 file changed, 62 insertions(+), 85 deletions(-) diff --git a/saplings.lua b/saplings.lua index eae0c17..68bd687 100644 --- a/saplings.lua +++ b/saplings.lua @@ -1,98 +1,75 @@ -- sapling growth +-- these tables only affect hand-placed saplings +-- mapgen-placed always use their biome def settings, which are much more +-- limited, in the interest of speed. + +local dirt_surfaces = { + "default:dirt", + "default:dirt_with_grass", + "default:dirt_with_dry_grass", + "default:dirt_with_coniferous_litter", + "default:dirt_with_rainforest_litter", + "default:dirt_with_snow", + "woodsoils:dirt_with_leaves_1", + "woodsoils:dirt_with_leaves_2", + "woodsoils:grass_with_leaves_1", + "woodsoils:grass_with_leaves_2" +} + +local cold_surfaces = { + "default:dirt_with_snow" +} + +local sand_surfaces = { + "default:sand", + "default:desert_sand", + "cottages:loam", + -- note, no silver sand here. + -- too cold for a palm, too... well... sandy for anything else. +} for i in ipairs(moretrees.treelist) do local treename = moretrees.treelist[i][1] local tree_model = treename.."_model" local tree_biome = treename.."_biome" + local surfaces + local grow_function = moretrees[tree_model] - if treename ~= "birch" and treename ~= "spruce" and treename ~= "fir" and treename ~= "jungletree" then + if treename == "spruce" + or treename == "fir" + or treename == "cedar" + or treename == "pine" then + surfaces = cold_surfaces + elseif string.find(treename, "palm") then + surfaces = sand_surfaces + else + surfaces = dirt_surfaces + end - biome_lib:dbg(dump(moretrees[tree_biome].surface)) + if treename == "spruce" + or treename == "fir" + or treename == "birch" + or treename == "jungletree" then + grow_function = "moretrees.grow_"..treename + end + + biome_lib:dbg(dump(moretrees[tree_biome].surface)) + + biome_lib:grow_plants({ + grow_delay = moretrees.sapling_interval, + grow_chance = moretrees.sapling_chance, + grow_plant = "moretrees:"..treename.."_sapling", + grow_nodes = surfaces, + grow_function = grow_function, + }) + + if moretrees.spawn_saplings then biome_lib:grow_plants({ - grow_delay = moretrees.sapling_interval, - grow_chance = moretrees.sapling_chance, - grow_plant = "moretrees:"..treename.."_sapling", + grow_delay = 2, + grow_chance = 2, + grow_plant = "moretrees:"..treename.."_sapling_ongen", grow_nodes = moretrees[tree_biome].surface, - grow_function = moretrees[tree_model], + grow_function = grow_function, }) - - if moretrees.spawn_saplings then - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 2, - grow_plant = "moretrees:"..treename.."_sapling_ongen", - grow_nodes = moretrees[tree_biome].surface, - grow_function = moretrees[tree_model], - }) - end - end end - -biome_lib:grow_plants({ - grow_delay = moretrees.sapling_interval, - grow_chance = moretrees.sapling_chance, - grow_plant = "moretrees:birch_sapling", - grow_nodes = moretrees.birch_biome.surface, - grow_function = "moretrees.grow_birch" -}) - - -biome_lib:grow_plants({ - grow_delay = moretrees.sapling_interval, - grow_chance = moretrees.sapling_chance, - grow_plant = "moretrees:spruce_sapling", - grow_nodes = moretrees.spruce_biome.surface, - grow_function = "moretrees.grow_spruce" -}) - -biome_lib:grow_plants({ - grow_delay = moretrees.sapling_interval, - grow_chance = moretrees.sapling_chance, - grow_plant = "moretrees:fir_sapling", - grow_nodes = moretrees.fir_biome.surface, - grow_function = "moretrees.grow_fir" -}) - -biome_lib:grow_plants({ - grow_delay = moretrees.sapling_interval, - grow_chance = moretrees.sapling_chance, - grow_plant = "default:junglesapling", - grow_nodes = moretrees.jungletree_biome.surface, - grow_function = "moretrees.grow_jungletree" -}) - -if moretrees.spawn_saplings then - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 30, - grow_plant = "moretrees:jungletree_sapling_ongen", - grow_nodes = moretrees.jungletree_biome.surface, - grow_function = "moretrees.grow_jungletree" - }) - - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 30, - grow_plant = "moretrees:fir_sapling_ongen", - grow_nodes = moretrees.fir_biome.surface, - grow_function = "moretrees.grow_fir" - }) - - - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 30, - grow_plant = "moretrees:spruce_sapling_ongen", - grow_nodes = moretrees.spruce_biome.surface, - grow_function = "moretrees.grow_spruce" - }) - - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 30, - grow_plant = "moretrees:birch_sapling_ongen", - grow_nodes = moretrees.birch_biome.surface, - grow_function = "moretrees.grow_birch" - }) -end From e912fba6c8f62662409112984325a44aaa87fcd4 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 19:16:30 -0400 Subject: [PATCH 4/6] tweak on-gen to be faster still --- saplings.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/saplings.lua b/saplings.lua index 68bd687..68e5de8 100644 --- a/saplings.lua +++ b/saplings.lua @@ -66,7 +66,7 @@ for i in ipairs(moretrees.treelist) do if moretrees.spawn_saplings then biome_lib:grow_plants({ grow_delay = 2, - grow_chance = 2, + grow_chance = 1, grow_plant = "moretrees:"..treename.."_sapling_ongen", grow_nodes = moretrees[tree_biome].surface, grow_function = grow_function, From f45ffc09bf77282c69869f69ae98e7216e854b7a Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 20:03:00 -0400 Subject: [PATCH 5/6] Use a "set" for surface list rather than a plain table (requires biome_lib from commit a96f015c or later) --- saplings.lua | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/saplings.lua b/saplings.lua index 68e5de8..a004923 100644 --- a/saplings.lua +++ b/saplings.lua @@ -4,26 +4,25 @@ -- limited, in the interest of speed. local dirt_surfaces = { - "default:dirt", - "default:dirt_with_grass", - "default:dirt_with_dry_grass", - "default:dirt_with_coniferous_litter", - "default:dirt_with_rainforest_litter", - "default:dirt_with_snow", - "woodsoils:dirt_with_leaves_1", - "woodsoils:dirt_with_leaves_2", - "woodsoils:grass_with_leaves_1", - "woodsoils:grass_with_leaves_2" + set = true, + ["default:dirt"] = true, + ["default:dirt_with_grass"] = true, + ["default:dirt_with_dry_grass"] = true, + ["default:dirt_with_coniferous_litter"] = true, + ["default:dirt_with_rainforest_litter"] = true, + ["default:dirt_with_snow"] = true, + ["woodsoils:dirt_with_leaves_1"] = true, + ["woodsoils:dirt_with_leaves_2"] = true, + ["woodsoils:grass_with_leaves_1"] = true, + ["woodsoils:grass_with_leaves_2"] = true } -local cold_surfaces = { - "default:dirt_with_snow" -} +local cold_surfaces = "default:dirt_with_snow" local sand_surfaces = { - "default:sand", - "default:desert_sand", - "cottages:loam", + ["default:sand"] = true, + ["default:desert_sand"] = true, + ["cottages:loam"] = true, -- note, no silver sand here. -- too cold for a palm, too... well... sandy for anything else. } From acb534d8d07c4ed531b8dac0e920b043cfb4949d Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 22 May 2019 21:05:04 -0400 Subject: [PATCH 6/6] fix derps in tables --- saplings.lua | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/saplings.lua b/saplings.lua index a004923..7239275 100644 --- a/saplings.lua +++ b/saplings.lua @@ -10,16 +10,28 @@ local dirt_surfaces = { ["default:dirt_with_dry_grass"] = true, ["default:dirt_with_coniferous_litter"] = true, ["default:dirt_with_rainforest_litter"] = true, - ["default:dirt_with_snow"] = true, ["woodsoils:dirt_with_leaves_1"] = true, ["woodsoils:dirt_with_leaves_2"] = true, ["woodsoils:grass_with_leaves_1"] = true, ["woodsoils:grass_with_leaves_2"] = true } -local cold_surfaces = "default:dirt_with_snow" +local conifer_surfaces = { + set = true, + ["default:dirt"] = true, + ["default:dirt_with_grass"] = true, + ["default:dirt_with_dry_grass"] = true, + ["default:dirt_with_coniferous_litter"] = true, + ["default:dirt_with_rainforest_litter"] = true, + ["woodsoils:dirt_with_leaves_1"] = true, + ["woodsoils:dirt_with_leaves_2"] = true, + ["woodsoils:grass_with_leaves_1"] = true, + ["woodsoils:grass_with_leaves_2"] = true, + ["default:dirt_with_snow"] = true +} local sand_surfaces = { + set = true, ["default:sand"] = true, ["default:desert_sand"] = true, ["cottages:loam"] = true, @@ -38,7 +50,7 @@ for i in ipairs(moretrees.treelist) do or treename == "fir" or treename == "cedar" or treename == "pine" then - surfaces = cold_surfaces + surfaces = conifer_surfaces elseif string.find(treename, "palm") then surfaces = sand_surfaces else @@ -62,13 +74,11 @@ for i in ipairs(moretrees.treelist) do grow_function = grow_function, }) - if moretrees.spawn_saplings then - biome_lib:grow_plants({ - grow_delay = 2, - grow_chance = 1, - grow_plant = "moretrees:"..treename.."_sapling_ongen", - grow_nodes = moretrees[tree_biome].surface, - grow_function = grow_function, - }) - end + biome_lib:grow_plants({ + grow_delay = 2, + grow_chance = 1, + grow_plant = "moretrees:"..treename.."_sapling_ongen", + grow_nodes = surfaces, + grow_function = grow_function, + }) end