From 3e424b2797723640a4c915da664f30fbd9e80934 Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Mon, 27 May 2024 12:18:58 -0400 Subject: [PATCH] culls settings (#41) * load all trees * remove now sorta duplicate settings * remove dead settings * prune useless file * prune dead settings --- default_settings.txt | 140 ------------------------------------------- init.lua | 83 +++++++------------------ node_defs.lua | 98 +++++++++++++++--------------- settings.lua | 33 ---------- 4 files changed, 68 insertions(+), 286 deletions(-) delete mode 100644 default_settings.txt diff --git a/default_settings.txt b/default_settings.txt deleted file mode 100644 index 55de6a7..0000000 --- a/default_settings.txt +++ /dev/null @@ -1,140 +0,0 @@ --- 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 --- where the mapgen conflicts with the tree generator. - -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. - -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 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/node_defs.lua b/node_defs.lua index 9c406ed..979656a 100644 --- a/node_defs.lua +++ b/node_defs.lua @@ -327,70 +327,66 @@ for i in ipairs(moretrees.treelist) do }, }) - if moretrees.enable_stairs then - if minetest.get_modpath("moreblocks") then - - -- stairsplus:register_all(modname, subname, recipeitem, {fields}) + if minetest.get_modpath("moreblocks") then + + 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 78e4f7c..62b4c14 100644 --- a/settings.lua +++ b/settings.lua @@ -1,30 +1,8 @@ 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) ---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) @@ -32,22 +10,11 @@ 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 --- 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)