Merge remote-tracking branch 'upstream/master'

This commit is contained in:
bri cassa 2024-09-15 09:35:20 +02:00
commit 9560970515
13 changed files with 230 additions and 550 deletions

View File

@ -21,8 +21,8 @@ read_globals = {
string = {fields = {"split"}},
table = {fields = {"copy", "getn"}},
"biome_lib",
"stairsplus",
"stairs",
"doors",
"xcompat",
}

View File

@ -8,4 +8,5 @@ jungle trees mod, and big contributions by RealBadAngel.
Brought together into one mod and made L-systems compatible by Vanessa
Ezekowitz.
Dependencies: `default`
Dependencies: `xcompat`
see mod.conf for more

View File

@ -1,313 +1,156 @@
moretrees.beech_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 8,
seed_diff = 2,
rarity = 50,
max_count = 20,
surface = xcompat.materials.dirt_with_grass,
}
moretrees.palm_biome = {
surface = "default:sand",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 5,
seed_diff = 330,
surface = xcompat.materials.sand,
min_elevation = -1,
max_elevation = 1,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 10,
temp_min = 0.25,
temp_max = -0.15,
rarity = 50,
max_count = 10,
}
moretrees.date_palm_biome = {
surface = "default:desert_sand",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 339,
surface = xcompat.materials.desert_sand,
min_elevation = -1,
max_elevation = 10,
near_nodes = {"default:water_source"},
near_nodes_size = 20,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 100,
near_nodes_vertical = 20,
temp_min = -0.20,
humidity_max = 0.20,
rarity = 10,
max_count = 30,
}
moretrees.date_palm_biome_2 = {
surface = "default:desert_sand",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 340,
surface = xcompat.materials.desert_sand,
min_elevation = 11,
max_elevation = 30,
near_nodes = {"default:water_source"},
near_nodes_size = 1,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 1,
near_nodes_vertical = 30,
temp_min = -0.20,
humidity_max = 0.20,
rarity = 10,
max_count = 30,
}
moretrees.apple_tree_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 331,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 1,
max_elevation = 10,
temp_min = 0.1,
temp_max = -0.15,
rarity = 75,
max_count = 5,
place_on = {"default:dirt_with_grass"},
place_on = {xcompat.materials.dirt_with_grass},
biomes = {"deciduous_forest"},
fill_ratio = 0.0001,
}
moretrees.oak_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 15,
seed_diff = 332,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 10,
temp_min = 0.4,
temp_max = 0.2,
rarity = 50,
max_count = 5,
fill_ratio = 0.0003
}
moretrees.sequoia_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 333,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 10,
temp_min = 1,
temp_max = -0.4,
rarity = 90,
max_count = 5,
fill_ratio = 0.0001,
}
moretrees.birch_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 5,
seed_diff = 334,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 10,
max_elevation = 15,
temp_min = 0.9,
temp_max = 0.3,
rarity = 50,
max_count = 10,
fill_ratio = 0.001,
}
moretrees.willow_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 337,
surface = xcompat.materials.dirt_with_grass,
min_elevation = -5,
max_elevation = 5,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 5,
rarity = 75,
max_count = 5,
}
moretrees.rubber_tree_biome = {
surface = {
"default:dirt_with_grass",
"default:sand",
},
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 338,
surface = xcompat.materials.dirt_with_grass,
min_elevation = -5,
max_elevation = 5,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 10,
temp_min = -0.15,
rarity = 75,
max_count = 10,
}
moretrees.jungletree_biome = {
surface = {
"default:dirt",
"default:dirt_with_grass",
xcompat.materials.dirt,
xcompat.materials.dirt_with_grass,
"woodsoils:dirt_with_leaves_1",
"woodsoils:grass_with_leaves_1",
"woodsoils:grass_with_leaves_2",
"default:dirt_with_rainforest_litter",
},
avoid_nodes = {"moretrees:jungletree_trunk"},
max_count = 12,
avoid_radius = 3,
rarity = 85,
seed_diff = 329,
min_elevation = 1,
near_nodes = {"default:jungletree"},
near_nodes_size = 6,
near_nodes_vertical = 2,
near_nodes_count = 1,
plantlife_limit = -0.9,
near_nodes = minetest.get_modpath("default") and {"default:jungletree"} or nil,
near_nodes_count = minetest.get_modpath("default") and 1 or nil,
biomes = {"rainforest", "rainforest_swamp"},
}
moretrees.spruce_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 335,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 20,
temp_min = 0.9,
temp_max = 0.7,
rarity = 50,
max_count = 5,
}
moretrees.cedar_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 336,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0, --Added to solve an issue where cedar trees would sometimes spawn deep underground
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 5,
rarity = 50,
max_count = 10,
}
-- Poplar requires a lot of water.
moretrees.poplar_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 6,
seed_diff = 341,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 50,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes_vertical = 5,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 1,
humidity_min = -0.7,
humidity_max = -1,
rarity = 50,
max_count = 15,
}
-- The humidity requirement it quite restrictive (apparently).
-- Spawn an occasional poplar elsewhere.
moretrees.poplar_biome_2 = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 6,
seed_diff = 341,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 50,
near_nodes = {"default:water_source"},
near_nodes_size = 15,
near_nodes_vertical = 4,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 10,
humidity_min = 0.1,
humidity_max = -0.6,
rarity = 50,
max_count = 1,
}
-- Subterranean lakes provide enough water for poplars to grow
moretrees.poplar_biome_3 = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 6,
seed_diff = 342,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 50,
near_nodes = {"default:water_source"},
near_nodes_size = 1,
near_nodes_vertical = 25,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 1,
humidity_min = -0.5,
humidity_max = -1,
rarity = 0,
max_count = 30,
}
moretrees.poplar_small_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 4,
seed_diff = 343,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 50,
near_nodes = {"default:water_source"},
near_nodes_size = 10,
near_nodes_vertical = 5,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 1,
humidity_min = -0.7,
humidity_max = -1,
rarity = 50,
max_count = 10,
}
moretrees.poplar_small_biome_2 = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 4,
seed_diff = 343,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 0,
max_elevation = 50,
near_nodes = {"default:water_source"},
near_nodes_size = 10,
near_nodes_vertical = 4,
near_nodes = {xcompat.materials.water_source},
near_nodes_count = 5,
humidity_min = 0.1,
humidity_max = -0.6,
rarity = 50,
max_count = 3,
}
moretrees.fir_biome = {
surface = "default:dirt_with_grass",
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 359,
surface = xcompat.materials.dirt_with_grass,
min_elevation = 25,
temp_min = 0.9,
temp_max = 0.3,
rarity = 50,
max_count = 10,
}
moretrees.fir_biome_snow = {
surface = {"snow:dirt_with_snow", "snow:snow"},
below_nodes = {"default:dirt", "default:dirt_with_grass", "snow:dirt_with_snow"},
avoid_nodes = moretrees.avoidnodes,
avoid_radius = 10,
seed_diff = 359,
rarity = 50,
max_count = 10,
check_air = false,
delete_above = true,
spawn_replace_node = true
below_nodes = {xcompat.materials.dirt, xcompat.materials.dirt_with_grass, "snow:dirt_with_snow"},
}

View File

@ -177,10 +177,11 @@ for _,suffix in ipairs({"_0", "_1", "_2", "_3", ""}) do
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
groups = { fleshy=3, dig_immediate=3, flammable=2, moretrees_coconut=coco_group },
inventory_image = tile.."^[transformR180",
wield_image = tile.."^[transformR180",
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
drop = drop,
selection_box = {
type = "fixed",

View File

@ -3,13 +3,15 @@ local S = minetest.get_translator("moretrees")
for i in ipairs(moretrees.treelist) do
local treename = moretrees.treelist[i][1]
minetest.register_craft({
type = "shapeless",
output = "moretrees:"..treename.."_planks 4",
recipe = {
"moretrees:"..treename.."_trunk"
}
})
if moretrees.enable_planks then
minetest.register_craft({
type = "shapeless",
output = "moretrees:"..treename.."_planks 4",
recipe = {
"moretrees:"..treename.."_trunk"
}
})
end
minetest.register_craft({
type = "fuel",

View File

@ -723,10 +723,11 @@ for _,suffix in ipairs({"f0", "f1", "f2", "f3", "f4", "m0", "fn", "n"}) do
paramtype = "light",
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
groups = { fleshy=3, dig_immediate=3, flammable=2, moretrees_dates=1 },
inventory_image = "moretrees_dates_"..suffix..".png^[transformR0",
wield_image = "moretrees_dates_"..suffix..".png^[transformR90",
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
drop = dropfn,
selection_box = {
type = "fixed",

View File

@ -1,136 +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
-- 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

146
init.lua
View File

@ -15,29 +15,31 @@
moretrees = {}
minetest.override_item("default:sapling", {
description = "Sapling"
})
if minetest.get_modpath("default") then
minetest.override_item("default:sapling", {
description = "Sapling"
})
minetest.override_item("default:tree", {
description = "Tree"
})
minetest.override_item("default:tree", {
description = "Tree"
})
minetest.override_item("default:wood", {
description = "Wooden Planks"
})
minetest.override_item("default:wood", {
description = "Wooden Planks"
})
minetest.override_item("default:leaves", {
description = "Leaves"
})
minetest.override_item("default:leaves", {
description = "Leaves"
})
minetest.override_item("default:fence_wood", {
description = "Wooden Fence"
})
minetest.override_item("default:fence_wood", {
description = "Wooden Fence"
})
minetest.override_item("default:fence_rail_wood", {
description = "Wooden Fence Rail"
})
minetest.override_item("default:fence_rail_wood", {
description = "Wooden Fence Rail"
})
end
if minetest.get_modpath("doors") then
minetest.override_item("doors:gate_wood_closed", {
@ -89,10 +91,10 @@ end
-- tables, load other files
moretrees.cutting_tools = {
"default:axe_bronze",
"default:axe_diamond",
"default:axe_mese",
"default:axe_steel",
xcompat.materials.axe_steel,
xcompat.materials.axe_diamond,
xcompat.materials.axe_bronze,
"glooptest:axe_alatro",
"glooptest:axe_arol",
"moreores:axe_mithril",
@ -149,69 +151,30 @@ 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.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"))
if minetest.get_modpath("default") 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.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
@ -313,7 +276,7 @@ function moretrees.grow_jungletree(pos)
minetest.swap_node(pos, {name = "air"})
local leaves = minetest.find_nodes_in_area(
{x = pos.x-1, y = pos.y, z = pos.z-1}, {x = pos.x+1, y = pos.y+10, z = pos.z+1},
"default:leaves"
xcompat.materials.apple_leaves
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
@ -344,7 +307,7 @@ function moretrees.grow_fir(pos)
local leaves = minetest.find_nodes_in_area(
{x = pos.x, y = pos.y, z = pos.z},
{x = pos.x, y = pos.y+5, z = pos.z},
"default:leaves"
xcompat.materials.apple_leaves
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
@ -375,7 +338,7 @@ function moretrees.grow_fir_snow(pos)
local leaves = minetest.find_nodes_in_area(
{x = pos.x, y = pos.y, z = pos.z},
{x = pos.x, y = pos.y+5, z = pos.z},
"default:leaves"
xcompat.materials.apple_leaves
)
for leaf in ipairs(leaves) do
minetest.swap_node(leaves[leaf], {name = "air"})
@ -383,4 +346,17 @@ function moretrees.grow_fir_snow(pos)
minetest.spawn_tree(pos,moretrees.fir_model)
end
print("[Moretrees] Loaded (2013-02-11)")
if moretrees.grow_legacy_saplings then
minetest.register_lbm({
name = "moretrees:grow_ongen_saplings",
label = "Grow legacy ongen saplings",
nodenames = {"group:moretrees_ongen"},
run_at_every_load = true,
action = function(pos)
minetest.log("info", "[moretrees] Starting growth timer for legacy ongen sapling at "..minetest.pos_to_string(pos, 0))
minetest.get_node_timer(pos):start(math.random(2, 10))
end
})
end
minetest.log("info", "[moretrees] Loading done")

View File

@ -1,4 +1,4 @@
name = moretrees
depends = default, vessels
optional_depends = doors, stairs, moreblocks, farming
depends = xcompat
optional_depends = doors, stairs, moreblocks, farming, default, vessels
min_minetest_version = 5.2.0

View File

@ -2,6 +2,9 @@ local S = minetest.get_translator("moretrees")
moretrees.avoidnodes = {}
local jungle_sapling_texture = minetest.get_modpath("default") and "default_junglesapling.png"
or "moretrees_cedar_sapling.png"
moretrees.treelist = {
{"beech", S("Beech Tree")},
{"apple_tree", S("Apple Tree")},
@ -17,7 +20,7 @@ moretrees.treelist = {
{"willow", S("Willow Tree")},
{"rubber_tree", S("Rubber Tree")},
{"fir", S("Douglas Fir"), "fir_cone", S("Fir Cone"), {-0.2, -0.5, -0.2, 0.2, 0, 0.2}, 0.8 },
{"jungletree", S("Jungle Tree"), nil, nil, nil, nil, "default_junglesapling.png" },
{"jungletree", S("Jungle Tree"), nil, nil, nil, nil, jungle_sapling_texture },
}
moretrees.treedesc = {
@ -224,8 +227,8 @@ end
-- redefine default leaves to handle plantlike and/or leaf decay options
if moretrees.plantlike_leaves then
minetest.override_item("default:leaves", {
if minetest.get_modpath("default") and moretrees.plantlike_leaves then
minetest.override_item(xcompat.materials.apple_leaves, {
inventory_image = minetest.inventorycube("default_leaves.png"),
drawtype = "plantlike",
visual_scale = math.sqrt(2)
@ -234,8 +237,8 @@ end
-- redefine default jungle leaves for same
if moretrees.plantlike_leaves then
minetest.override_item("default:jungleleaves", {
if minetest.get_modpath("default") and moretrees.plantlike_leaves then
minetest.override_item(xcompat.materials.jungle_leaves, {
inventory_image = minetest.inventorycube("default_jungleleaves.png"),
drawtype = "plantlike",
visual_scale = math.sqrt(2)
@ -281,17 +284,19 @@ for i in ipairs(moretrees.treelist) do
paramtype2 = "facedir",
is_ground_content = false,
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
sounds = xcompat.sounds.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
})
minetest.register_node("moretrees:"..treename.."_planks", {
description = moretrees.treedesc[treename].planks,
tiles = {"moretrees_"..treename.."_wood.png"},
is_ground_content = false,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
sounds = default.node_sound_wood_defaults(),
})
if moretrees.enable_planks then
minetest.register_node("moretrees:"..treename.."_planks", {
description = moretrees.treedesc[treename].planks,
tiles = {"moretrees_"..treename.."_wood.png"},
is_ground_content = false,
groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
sounds = xcompat.sounds.node_sound_wood_defaults(),
})
end
local moretrees_leaves_inventory_image = nil
@ -309,7 +314,7 @@ for i in ipairs(moretrees.treelist) do
paramtype = "light",
is_ground_content = false,
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 1},
sounds = default.node_sound_leaves_defaults(),
sounds = xcompat.sounds.node_sound_leaves_defaults(),
drop = {
max_items = 1,
@ -320,27 +325,25 @@ 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(
"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",
}
)
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.."_planks",
@ -352,20 +355,22 @@ for i in ipairs(moretrees.treelist) do
drop = treename.."_planks",
}
)
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,
default.node_sound_wood_defaults()
)
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
stairs.register_stair_and_slab(
"moretrees_"..treename.."_planks",
"moretrees:"..treename.."_planks",
@ -373,13 +378,13 @@ for i in ipairs(moretrees.treelist) do
{ "moretrees_"..treename.."_wood.png" },
moretrees.treedesc[treename].planks_stair,
moretrees.treedesc[treename].planks_slab,
default.node_sound_wood_defaults()
xcompat.sounds.node_sound_wood_defaults()
)
end
end
if moretrees.enable_fences 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", {
@ -391,7 +396,7 @@ for i in ipairs(moretrees.treelist) do
"^default_fence_overlay.png^[makealpha:255,126,126",
material = planks_name,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
sounds = xcompat.sounds.node_sound_wood_defaults()
})
default.register_fence_rail("moretrees:" .. treename .. "_fence_rail", {
description = moretrees.treedesc[treename].fence_rail,
@ -402,7 +407,7 @@ for i in ipairs(moretrees.treelist) do
"^default_fence_rail_overlay.png^[makealpha:255,126,126",
material = planks_name,
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults()
sounds = xcompat.sounds.node_sound_wood_defaults()
})
if minetest.global_exists("doors") then
doors.register_fencegate("moretrees:" .. treename .. "_gate", {
@ -436,9 +441,9 @@ for i in ipairs(moretrees.treelist) do
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = regular_groups,
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
itemstack = xcompat.functions.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
@ -469,7 +474,15 @@ for i in ipairs(moretrees.treelist) do
})
end
local ongen_groups = {snappy=2,dig_immediate=3,flammable=2,attached_node=1,sapling=1,not_in_creative_inventory=1}
local ongen_groups = {
snappy = 2,
dig_immediate = 3,
flammable = 2,
attached_node = 1,
sapling = 1,
moretrees_ongen = 1,
not_in_creative_inventory = 1
}
if minetest.settings:get_bool("creative_mode", false) then
ongen_groups["not_in_creative_inventory"]=nil
end
@ -487,10 +500,10 @@ for i in ipairs(moretrees.treelist) do
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
},
groups = ongen_groups,
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
drop = "moretrees:"..treename.."_sapling",
on_place = function(itemstack, placer, pointed_thing)
itemstack = default.sapling_on_place(itemstack, placer, pointed_thing,
itemstack = xcompat.functions.sapling_on_place(itemstack, placer, pointed_thing,
"moretrees:" ..treename.. "_sapling_ongen",
-- minp, maxp to be checked, relative to sapling pos
-- minp_relative.y = 1 because sapling pos has been checked
@ -539,7 +552,7 @@ for i in ipairs(moretrees.treelist) do
fixed = selbox
},
groups = {fleshy=3,dig_immediate=3,flammable=2, attached_node=1, leafdecay = 1, leafdecay_drop = 1},
sounds = default.node_sound_defaults(),
sounds = xcompat.sounds.node_sound_default(),
after_place_node = function(pos, placer)
if placer:is_player() then
minetest.set_node(pos, {name = "moretrees:"..fruit, param2 = 1})
@ -550,7 +563,8 @@ for i in ipairs(moretrees.treelist) do
if treename ~= "jungletree"
and treename ~= "poplar_small"
and treename ~= "pine" then
and treename ~= "pine"
and minetest.get_modpath("default") then
default.register_leafdecay({
trunks = { "moretrees:"..treename.."_trunk" },
leaves = { "moretrees:"..treename.."_leaves", fruitname },
@ -613,30 +627,31 @@ for color = 1, #jungleleaves do
paramtype = "light",
is_ground_content = false,
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 3 },
drop = {
drop = minetest.get_modpath("default") and {
max_items = 1,
items = {
{items = {"default:junglesapling"}, rarity = 100 },
{items = {"moretrees:jungletree_leaves_"..jungleleaves[color]} }
}
},
sounds = default.node_sound_leaves_defaults(),
} or nil,
sounds = xcompat.sounds.node_sound_leaves_defaults(),
})
end
-- To get Moretrees to generate its own jungle trees among the default mapgen
-- we need our own copy of that node, which moretrees will match against.
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
jungle_tree.drop = jungle_tree.drop or { items = {} }
table.insert(jungle_tree.drop.items, { items = {"default:jungletree"}})
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
if minetest.get_modpath("default") then
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
jungle_tree.drop = "default:jungletree"
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
default.register_leafdecay({
trunks = { "default:jungletree", "moretrees:jungletree_trunk" },
leaves = { "default:jungleleaves", "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" },
radius = moretrees.leafdecay_radius,
})
default.register_leafdecay({
trunks = { "default:jungletree", "moretrees:jungletree_trunk" },
leaves = { xcompat.materials.jungle_leaves, "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" },
radius = moretrees.leafdecay_radius,
})
end
-- Extra needles for firs
@ -663,17 +678,19 @@ minetest.register_node("moretrees:fir_leaves_bright", {
{items = {'moretrees:fir_leaves_bright'} }
}
},
sounds = default.node_sound_leaves_defaults()
sounds = xcompat.sounds.node_sound_leaves_defaults()
})
default.register_leafdecay({
trunks = { "moretrees:fir_trunk" },
leaves = { "moretrees:fir_leaves", "moretrees:fir_leaves_bright" },
radius = moretrees.leafdecay_radius,
})
if minetest.get_modpath("default") then
default.register_leafdecay({
trunks = { "moretrees:fir_trunk" },
leaves = { "moretrees:fir_leaves", "moretrees:fir_leaves_bright" },
radius = moretrees.leafdecay_radius,
})
end
if moretrees.enable_redefine_apple then
if minetest.get_modpath("default") and moretrees.enable_redefine_apple then
local appledef = table.copy(minetest.registered_nodes["default:apple"])
appledef.groups.attached_node = 1
minetest.register_node(":default:apple", appledef)
@ -701,7 +718,7 @@ minetest.register_node("moretrees:rubber_tree_trunk_empty", {
"moretrees_rubber_tree_trunk_empty.png"
},
groups = {tree=1,snappy=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
sounds = xcompat.sounds.node_sound_wood_defaults(),
paramtype2 = "facedir",
is_ground_content = false,
on_place = minetest.rotate_node,
@ -747,7 +764,7 @@ minetest.register_alias("conifers:sapling", "moretrees:fir_sapling")
minetest.register_alias("moretrees:jungletree_sapling", "default:junglesapling")
minetest.register_alias("moretrees:jungletree_trunk_sideways", "moreblocks:horizontal_jungle_tree")
minetest.register_alias("moretrees:jungletree_planks", "default:junglewood")
minetest.register_alias("moretrees:jungletree_leaves_green", "default:jungleleaves")
minetest.register_alias("moretrees:jungletree_leaves_green", xcompat.materials.jungle_leaves)
minetest.register_alias("moretrees:acacia_trunk", "default:acacia_tree")
minetest.register_alias("moretrees:acacia_planks", "default:acacia_wood")

View File

@ -5,11 +5,8 @@
local dirt_surfaces = {
set = true,
["default:dirt"] = true,
["default:dirt_with_snow"] = true,
["default:dry_dirt"] = true,
["default:dry_dirt_with_dry_grass"] = true,
["default:dirt_with_grass"] = true,
[xcompat.materials.dirt] = true,
[xcompat.materials.dirt_with_grass] = true,
["default:dirt_with_dry_grass"] = true,
["default:dirt_with_coniferous_litter"] = true,
["default:dirt_with_rainforest_litter"] = true,
@ -22,8 +19,8 @@ local dirt_surfaces = {
local conifer_surfaces = {
set = true,
["default:dirt"] = true,
["default:dirt_with_grass"] = true,
[xcompat.materials.dirt] = true,
[xcompat.materials.dirt_with_grass] = true,
["default:dirt_with_dry_grass"] = true,
["default:dirt_with_coniferous_litter"] = true,
["default:dirt_with_rainforest_litter"] = true,
@ -37,8 +34,8 @@ local conifer_surfaces = {
local sand_surfaces = {
set = true,
["default:sand"] = true,
["default:desert_sand"] = true,
[xcompat.materials.sand] = true,
[xcompat.materials.desert_sand] = true,
["cottages:loam"] = true,
["darkage:mud"] = true,
-- note, no silver sand here.

View File

@ -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)
@ -74,6 +41,17 @@ moretrees.dates_item_drop_ichance = tonumber(stg:get("moretrees.dates_item_drop_
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 = stg:get_bool("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 = stg:get_bool("moretrees.decay_leaves_as_items", false)
-- this is an internal setting for games that only have one type of planks
if type(minetest.get_game_info) == "function" then
moretrees.enable_planks = minetest.get_game_info().id~="voxelgarden"
else
moretrees.enable_planks = true
end

View File

@ -25,8 +25,8 @@ moretrees.apple_tree_model={
random_level=0,
trunk_type="single",
thin_branches=true,
fruit="default:apple",
fruit_chance=15,
fruit=minetest.get_modpath("default") and "default:apple" or nil,
fruit_chance=minetest.get_modpath("default") and 15 or nil,
}
moretrees.oak_model={
@ -252,7 +252,7 @@ moretrees.jungletree_model={
rules_a=nil,
rules_b=nil,
trunk="moretrees:jungletree_trunk",
leaves="default:jungleleaves",
leaves=xcompat.materials.jungle_leaves,
leaves2=nil,
leaves2_chance=nil,
angle=45,