From 84d148790b95fc417eebe8945f0d9a1fad46db7d Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 10:35:08 -0400 Subject: [PATCH 1/6] load all trees --- default_settings.txt | 17 --------- init.lua | 83 +++++++++++--------------------------------- settings.lua | 16 --------- 3 files changed, 21 insertions(+), 95 deletions(-) diff --git a/default_settings.txt b/default_settings.txt index 55de6a7..9700bba 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -1,22 +1,5 @@ -- Global configuration variables --- Enable the various kinds of trees. - -moretrees.enable_apple_tree = true -moretrees.enable_oak = true -moretrees.enable_sequoia = true -moretrees.enable_palm = true -moretrees.enable_date_palm = true -moretrees.enable_cedar = true -moretrees.enable_rubber_tree = true -moretrees.enable_willow = true -moretrees.enable_birch = true -moretrees.enable_spruce = true -moretrees.enable_jungle_tree = true -moretrees.enable_fir = true -moretrees.enable_poplar = true -moretrees.enable_beech = false - -- set this to true to make moretrees spawn saplings at mapgen time instead -- of fully-grown trees, which will grow into full trees after a very short -- delay. This reduces mapgen lag in some situations, and fixes situations diff --git a/init.lua b/init.lua index 459b4da..11e3760 100644 --- a/init.lua +++ b/init.lua @@ -151,69 +151,28 @@ function translate_biome_defs(def, treename, index) return deco_def end -if moretrees.enable_beech then - minetest.register_decoration(translate_biome_defs(moretrees.beech_biome, "beech")) -end - -if moretrees.enable_apple_tree then - minetest.register_decoration(translate_biome_defs(moretrees.apple_tree_biome, "apple_tree")) -end - -if moretrees.enable_oak then - minetest.register_decoration(translate_biome_defs(moretrees.oak_biome, "oak")) -end - -if moretrees.enable_sequoia then - minetest.register_decoration(translate_biome_defs(moretrees.sequoia_biome, "sequoia")) -end - -if moretrees.enable_palm then - minetest.register_decoration(translate_biome_defs(moretrees.palm_biome, "palm")) -end - -if moretrees.enable_date_palm then - minetest.register_decoration(translate_biome_defs(moretrees.date_palm_biome, "date_palm", 1)) - minetest.register_decoration(translate_biome_defs(moretrees.date_palm_biome_2, "date_palm", 2)) -end - -if moretrees.enable_cedar then - minetest.register_decoration(translate_biome_defs(moretrees.cedar_biome, "cedar")) -end - -if moretrees.enable_rubber_tree then - minetest.register_decoration(translate_biome_defs(moretrees.rubber_tree_biome, "rubber_tree")) -end - -if moretrees.enable_willow then - minetest.register_decoration(translate_biome_defs(moretrees.willow_biome, "willow")) -end - -if moretrees.enable_birch then - minetest.register_decoration(translate_biome_defs(moretrees.birch_biome, "birch")) -end - -if moretrees.enable_spruce then - minetest.register_decoration(translate_biome_defs(moretrees.spruce_biome, "spruce")) -end - -if moretrees.enable_jungle_tree then - minetest.register_decoration(translate_biome_defs(moretrees.jungletree_biome, "jungletree")) -end - -if moretrees.enable_fir then - minetest.register_decoration(translate_biome_defs(moretrees.fir_biome, "fir", 1)) - if minetest.get_modpath("snow") then - minetest.register_decoration(translate_biome_defs(moretrees.fir_biome_snow, "fir", 2)) - end -end - -if moretrees.enable_poplar then - minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome, "poplar", 1)) - minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome_2, "poplar", 2)) - minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome_3, "poplar", 3)) - minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome, "poplar_small", 4)) - minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome_2, "poplar_small", 5)) +minetest.register_decoration(translate_biome_defs(moretrees.beech_biome, "beech")) +minetest.register_decoration(translate_biome_defs(moretrees.apple_tree_biome, "apple_tree")) +minetest.register_decoration(translate_biome_defs(moretrees.oak_biome, "oak")) +minetest.register_decoration(translate_biome_defs(moretrees.sequoia_biome, "sequoia")) +minetest.register_decoration(translate_biome_defs(moretrees.palm_biome, "palm")) +minetest.register_decoration(translate_biome_defs(moretrees.date_palm_biome, "date_palm", 1)) +minetest.register_decoration(translate_biome_defs(moretrees.date_palm_biome_2, "date_palm", 2)) +minetest.register_decoration(translate_biome_defs(moretrees.cedar_biome, "cedar")) +minetest.register_decoration(translate_biome_defs(moretrees.rubber_tree_biome, "rubber_tree")) +minetest.register_decoration(translate_biome_defs(moretrees.willow_biome, "willow")) +minetest.register_decoration(translate_biome_defs(moretrees.birch_biome, "birch")) +minetest.register_decoration(translate_biome_defs(moretrees.spruce_biome, "spruce")) +minetest.register_decoration(translate_biome_defs(moretrees.jungletree_biome, "jungletree")) +minetest.register_decoration(translate_biome_defs(moretrees.fir_biome, "fir", 1)) +if minetest.get_modpath("snow") then + minetest.register_decoration(translate_biome_defs(moretrees.fir_biome_snow, "fir", 2)) end +minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome, "poplar", 1)) +minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome_2, "poplar", 2)) +minetest.register_decoration(translate_biome_defs(moretrees.poplar_biome_3, "poplar", 3)) +minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome, "poplar_small", 4)) +minetest.register_decoration(translate_biome_defs(moretrees.poplar_small_biome_2, "poplar_small", 5)) --[[ this is purposefully wrapped in a on mods loaded callback to that it gets the proper ids diff --git a/settings.lua b/settings.lua index 78e4f7c..425fa00 100644 --- a/settings.lua +++ b/settings.lua @@ -1,21 +1,5 @@ local stg = minetest.settings ---enable/disable different trees -moretrees.enable_apple_tree = stg:get_bool("moretrees.enable_apple_tree", true) -moretrees.enable_oak = stg:get_bool("moretrees.enable_oak", true) -moretrees.enable_sequoia = stg:get_bool("moretrees.enable_sequoia", true) -moretrees.enable_palm = stg:get_bool("moretrees.enable_palm", true) -moretrees.enable_date_palm = stg:get_bool("moretrees.enable_date_palm", true) -moretrees.enable_cedar = stg:get_bool("moretrees.enable_cedar", true) -moretrees.enable_rubber_tree = stg:get_bool("moretrees.enable_rubber_tree", true) -moretrees.enable_willow = stg:get_bool("moretrees.enable_willow", true) -moretrees.enable_birch = stg:get_bool("moretrees.enable_birch", true) -moretrees.enable_spruce = stg:get_bool("moretrees.enable_spruce", true) -moretrees.enable_jungle_tree = stg:get_bool("moretrees.enable_jungle_tree", true) -moretrees.enable_fir = stg:get_bool("moretrees.enable_fir", true) -moretrees.enable_poplar = stg:get_bool("moretrees.enable_poplar", true) -moretrees.enable_beech = stg:get_bool("moretrees.enable_beech", false) - --spawns tree on mapgen as saplings, legacy setting moretrees.spawn_saplings = stg:get_bool("moretrees.spawn_saplings", true) From e9ee39be5b277a6da35dd699a7ffe9bf79b4be0e Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 10:38:44 -0400 Subject: [PATCH 2/6] remove now sorta duplicate settings --- default_settings.txt | 10 ----- node_defs.lua | 98 ++++++++++++++++++++++---------------------- settings.lua | 6 --- 3 files changed, 48 insertions(+), 66 deletions(-) diff --git a/default_settings.txt b/default_settings.txt index 9700bba..c31509b 100644 --- a/default_settings.txt +++ b/default_settings.txt @@ -7,16 +7,6 @@ moretrees.spawn_saplings = true --- Set this to true to allow defining stairs/slabs/etc. If Moreblocks is --- installed, this will use that mod's Stairs Plus component. Otherwise, it --- will use the default stairs mod in minetest_game, if present - -moretrees.enable_stairs = true - --- If this variable is set to true, register fences for moretrees wood - -moretrees.enable_fences = false - -- Set this to true if you want the plantlike drawtype for leaves, which -- improves some peoples' framerates without resorting to making leaf nodes opaque. -- Affects default leaves and default jungle leaves also. diff --git a/node_defs.lua b/node_defs.lua index 9c406ed..b14502b 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -327,70 +327,68 @@ for i in ipairs(moretrees.treelist) do }, }) - if moretrees.enable_stairs then - if minetest.get_modpath("moreblocks") then + if minetest.get_modpath("moreblocks") then - -- stairsplus:register_all(modname, subname, recipeitem, {fields}) +-- stairsplus:register_all(modname, subname, recipeitem, {fields}) + stairsplus:register_all( + "moretrees", + treename.."_trunk", + "moretrees:"..treename.."_trunk", + { + groups = { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2, not_in_creative_inventory=1 }, + tiles = { + "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk.png" + }, + description = moretrees.treedesc[treename].trunk, + drop = treename.."_trunk", + } + ) + + if moretrees.enable_planks then stairsplus:register_all( "moretrees", - treename.."_trunk", - "moretrees:"..treename.."_trunk", + treename.."_planks", + "moretrees:"..treename.."_planks", { - groups = { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2, not_in_creative_inventory=1 }, - tiles = { - "moretrees_"..treename.."_trunk_top.png", - "moretrees_"..treename.."_trunk_top.png", - "moretrees_"..treename.."_trunk.png" - }, - description = moretrees.treedesc[treename].trunk, - drop = treename.."_trunk", + groups = { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1 }, + tiles = { "moretrees_"..treename.."_wood.png" }, + description = moretrees.treedesc[treename].planks, + drop = treename.."_planks", } ) + end + elseif minetest.get_modpath("stairs") then + stairs.register_stair_and_slab( + "moretrees_"..treename.."_trunk", + "moretrees:"..treename.."_trunk", + { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2 }, + { "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk_top.png", + "moretrees_"..treename.."_trunk.png" + }, + moretrees.treedesc[treename].trunk_stair, + moretrees.treedesc[treename].trunk_slab, + xcompat.sounds.node_sound_wood_defaults() + ) - if moretrees.enable_planks then - stairsplus:register_all( - "moretrees", - treename.."_planks", - "moretrees:"..treename.."_planks", - { - groups = { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3, not_in_creative_inventory=1 }, - tiles = { "moretrees_"..treename.."_wood.png" }, - description = moretrees.treedesc[treename].planks, - drop = treename.."_planks", - } - ) - end - elseif minetest.get_modpath("stairs") then + if moretrees.enable_planks then stairs.register_stair_and_slab( - "moretrees_"..treename.."_trunk", - "moretrees:"..treename.."_trunk", - { snappy=1, choppy=2, oddly_breakable_by_hand=1, flammable=2 }, - { "moretrees_"..treename.."_trunk_top.png", - "moretrees_"..treename.."_trunk_top.png", - "moretrees_"..treename.."_trunk.png" - }, - moretrees.treedesc[treename].trunk_stair, - moretrees.treedesc[treename].trunk_slab, + "moretrees_"..treename.."_planks", + "moretrees:"..treename.."_planks", + { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3 }, + { "moretrees_"..treename.."_wood.png" }, + moretrees.treedesc[treename].planks_stair, + moretrees.treedesc[treename].planks_slab, xcompat.sounds.node_sound_wood_defaults() ) - - if moretrees.enable_planks then - stairs.register_stair_and_slab( - "moretrees_"..treename.."_planks", - "moretrees:"..treename.."_planks", - { snappy=1, choppy=2, oddly_breakable_by_hand=2, flammable=3 }, - { "moretrees_"..treename.."_wood.png" }, - moretrees.treedesc[treename].planks_stair, - moretrees.treedesc[treename].planks_slab, - xcompat.sounds.node_sound_wood_defaults() - ) - end - end + end - if minetest.get_modpath("default") and moretrees.enable_fences and moretrees.enable_planks then + if minetest.get_modpath("default") and moretrees.enable_planks then local planks_name = "moretrees:" .. treename .. "_planks" local planks_tile = "moretrees_" .. treename .. "_wood.png" default.register_fence("moretrees:" .. treename .. "_fence", { diff --git a/settings.lua b/settings.lua index 425fa00..d59f90c 100644 --- a/settings.lua +++ b/settings.lua @@ -3,12 +3,6 @@ local stg = minetest.settings --spawns tree on mapgen as saplings, legacy setting moretrees.spawn_saplings = stg:get_bool("moretrees.spawn_saplings", true) ---turn on/off stair varients of nodes via moreblocks or the stair api -moretrees.enable_stairs = stg:get_bool("moretrees.enable_stairs", true) - --- If this variable is set to true, register fences for moretrees wood -moretrees.enable_fences = stg:get_bool("moretrees.enable_fences", true) - --enable plantlike drawtype for leaves moretrees.plantlike_leaves = stg:get_bool("moretrees.plantlike_leaves", false) From 63837eda93aef4ceced9a790aec0b082b6648e56 Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 10:40:01 -0400 Subject: [PATCH 3/6] remove dead settings --- settings.lua | 5 ----- 1 file changed, 5 deletions(-) diff --git a/settings.lua b/settings.lua index d59f90c..69f47da 100644 --- a/settings.lua +++ b/settings.lua @@ -10,12 +10,7 @@ moretrees.plantlike_leaves = stg:get_bool("moretrees.plantlike_leaves", false) -- fall when leaves decay/are dug. moretrees.enable_redefine_apple = stg:get_bool("moretrees.enable_redefine_apple", true) --- Set this to true to enable leaf decay of all trees except the default ones. -moretrees.enable_leafdecay = stg:get_bool("moretrees.enable_leafdecay", true) - -- various related settings to configure leaf decay. -moretrees.leafdecay_delay = tonumber(stg:get("moretrees.leafdecay_delay")) or 2 -moretrees.leafdecay_chance = tonumber(stg:get("moretrees.leafdecay_chance")) or 5 moretrees.leafdecay_radius = tonumber(stg:get("moretrees.leafdecay_radius")) or 5 moretrees.palm_leafdecay_radius = tonumber(stg:get("moretrees.palm_leafdecay_radius")) or 10 moretrees.date_palm_leafdecay_radius = tonumber(stg:get("moretrees.date_palm_leafdecay_radius")) or 14 From 961f49b4025577d3d7412d31a80509ce90e0c8e7 Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 10:40:18 -0400 Subject: [PATCH 4/6] prune useless file --- default_settings.txt | 113 ------------------------------------------- 1 file changed, 113 deletions(-) delete mode 100644 default_settings.txt diff --git a/default_settings.txt b/default_settings.txt deleted file mode 100644 index c31509b..0000000 --- a/default_settings.txt +++ /dev/null @@ -1,113 +0,0 @@ --- Global configuration variables - --- set this to true to make moretrees spawn saplings at mapgen time instead --- of fully-grown trees, which will grow into full trees after a very short --- delay. This reduces mapgen lag in some situations, and fixes situations --- where the mapgen conflicts with the tree generator. - -moretrees.spawn_saplings = true - --- Set this to true if you want the plantlike drawtype for leaves, which --- improves some peoples' framerates without resorting to making leaf nodes opaque. --- Affects default leaves and default jungle leaves also. - -moretrees.plantlike_leaves = false - --- Enable this if you want moretrees to redefine default apples so that they --- fall when leaves decay/are dug. - -moretrees.enable_redefine_apple = true - --- Set this to true to enable leaf decay of all trees except the default ones. - -moretrees.enable_leafdecay = true - --- various related settings to configure leaf decay. - -moretrees.leafdecay_delay = 2 -moretrees.leafdecay_chance = 5 -moretrees.leafdecay_radius = 5 -moretrees.palm_leafdecay_radius = 10 -moretrees.date_palm_leafdecay_radius = 14 - --- Change these settings if you want default trees to be gradually cut down --- above the elevation where firs normally generate. - -moretrees.firs_remove_default_trees = false -moretrees.firs_remove_interval = 2 -moretrees.firs_remove_chance = 150 - --- Cocos palm settings - -moretrees.coconuts_regrow = true -moretrees.coconuts_convert_existing_palms = true -- Converting existing palm trees will make coconuts regrow on them as well - -- Else, they will only regrow on newly-spawned palms - -- However, conversion is not an exact science, and although an attempt is - -- made to detect whether a trunk belongs to an actual palm, some coconut trunks - -- and some coconuts may be incorrectly converted. -moretrees.coconut_flower_interval = 59 -moretrees.coconut_flower_chance = 67 -moretrees.coconut_grow_interval = 2 * moretrees.coconut_flower_interval * moretrees.coconut_flower_chance - -- Actual interval will randomly vary between 67% and 133% of this value - -- 2 * 59 * 67 ~ 2 hours. So flowers become coconuts in about 6 hours -moretrees.coconut_item_drop_ichance = 10 -- inverse probability of ripe coconuts dropping as items (instead of disappearing) - --- Date palm settings - --- Suggested configuration alternatives: --- - Dates grow only when pollinated: --- - Set dates_regrow_pollinated to true --- - Set dates_regrow_unpollinated_percent to 0 --- - Dates grow without pollination. Pollination disabled: --- - Set dates_regrow_pollinated to false --- - Set dates_regrow_unpollinated_percent to some larger positive value, e.g. 95 --- - Dates grow, but more and faster if male flowers are nearby --- - Set dates_regrow_pollinated to true --- - Set dates_regrow_unpollinated_percent to some small positive value, e.g. 33 --- - Optional but recommended: Reduce the pollination distance, e.g. to 30 - --- Note that it should not be necessary to disable pollination for performance --- reasons. A lot of effort has gone into ensuring that date growing will not cause lag. --- --- If lag is suspected, use the chat command '/dates_stats' to obtain the male dates --- search time, as well as the counts of total number of searches requested and the --- number of searches actually performed. - -moretrees.dates_regrow_pollinated = true -- Enable pollination. If enabled, male trees are required for dates to grow. - -- If disabled, dates_regrow_unpollinated_percent must be non-zero for dates to regrow. -moretrees.dates_regrow_unpollinated_percent = 0 -- Percentage of female dates becoming dates without being pollinated. - -- If 0, dates_regrow_pollinated must be enabled for dates to grow. -moretrees.dates_female_percent = 57 -- Ratio of female to male trees - tune this to improve # of generated trees that actually bear fruit - -- ~57% gives near optimal results for groups of 3 random trees, while it is only slightly suboptimal - -- for groups of 2 and 4 random trees (~2% less fruit than optimal). - -- Optimal values per group size: 2: 50%, 3: 57.78%, 4: 63%, 5: 66.9%, 6: 69.9%, [...], 12: 79.8% - -- So 57% is optimal for small groups of trees. As larger groups have more female palms anyway, a - -- less than optimal proportion of female to male trees is not a problem. -moretrees.dates_pollination_distance = 120 -moretrees.dates_blossom_search_time_treshold = 1000 -- If average male blossom search time (in microseconds) exceeds this, start limiting the search load. -moretrees.dates_blossom_search_iload = 10 -- Inverse fraction of CPU time that male blossom searching search may consume. - -- As searching a large area (radius: dates_pollination_distance/3 per attempt) can cause lag, - -- this limits the search frequency server-wide so that the impact on server lag is minimised - -- For personal servers, this can be set lower, or even to 1 or 0 (0 disables load limiting). - -- Obtain the current average search time using /dates_stats -moretrees.dates_flower_interval = 59 -moretrees.dates_flower_chance = 181 -moretrees.dates_grow_interval = 2 * moretrees.dates_flower_interval * moretrees.dates_flower_chance - -- As date palms have a high yield, don't grow dates too fast - -- The actual interval will vary randomly between 67% and 133% of this value. - -- 2 * 59 * 181 ~ 6 hours. So by default flowers become dates in about one (human) day. -moretrees.dates_item_drop_ichance = 10 -- inverse probability of ripe dates dropping as items (instead of disappearing) - --- Sapling settings - -moretrees.sapling_interval = 100 -moretrees.sapling_chance = 5 - --- Enable this only if you have used an old moretrees version which was using biome_lib --- and when you notice large areas with ongen saplings that don't grow -moretrees.grow_legacy_saplings = false - --- If this variable is set to true, drop leaves out as entities during leaf --- decay, rather than just disappearing them. - -moretrees.decay_leaves_as_items = false From 8fcebaf5273679d4cf1e4419295853cc99f7f94f Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 10:41:52 -0400 Subject: [PATCH 5/6] prune dead settings --- settings.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/settings.lua b/settings.lua index 69f47da..62b4c14 100644 --- a/settings.lua +++ b/settings.lua @@ -15,12 +15,6 @@ moretrees.leafdecay_radius = tonumber(stg:get("moretrees.leafdecay_radius")) or moretrees.palm_leafdecay_radius = tonumber(stg:get("moretrees.palm_leafdecay_radius")) or 10 moretrees.date_palm_leafdecay_radius = tonumber(stg:get("moretrees.date_palm_leafdecay_radius")) or 14 --- Change these settings if you want default trees to be gradually cut down --- above the elevation where firs normally generate. -moretrees.firs_remove_default_trees = stg:get_bool("moretrees.firs_remove_default_trees", false) -moretrees.firs_remove_interval = tonumber(stg:get("moretrees.firs_remove_interval")) or 2 -moretrees.firs_remove_chance = tonumber(stg:get("moretrees.firs_remove_chance")) or 150 - -- Cocos palm settings moretrees.coconuts_regrow = stg:get_bool("moretrees.coconuts_regrow", true) moretrees.coconuts_convert_existing_palms = stg:get_bool("moretrees.coconuts_convert_existing_palms", true) From 10b317d3f19c137a66cd31135a10ec4c1171f72d Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 12:18:36 -0400 Subject: [PATCH 6/6] address review --- node_defs.lua | 2 -- 1 file changed, 2 deletions(-) diff --git a/node_defs.lua b/node_defs.lua index b14502b..979656a 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -329,8 +329,6 @@ for i in ipairs(moretrees.treelist) do if minetest.get_modpath("moreblocks") then --- stairsplus:register_all(modname, subname, recipeitem, {fields}) - stairsplus:register_all( "moretrees", treename.."_trunk",