2013-04-08 04:09:18 +02:00
|
|
|
-- More trees! 2013-04-07
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
|
|
|
-- This mod adds more types of trees to the game
|
|
|
|
--
|
2017-06-18 12:25:20 +02:00
|
|
|
-- Some of the node definitions and textures came from cisoun's conifers mod
|
2013-01-20 00:36:13 +01:00
|
|
|
-- and bas080's jungle trees mod.
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
|
|
|
-- Brought together into one mod and made L-systems compatible by Vanessa
|
2013-01-20 07:39:00 +01:00
|
|
|
-- Ezekowitz.
|
2013-01-10 03:35:50 +01:00
|
|
|
--
|
2018-11-09 00:40:16 +01:00
|
|
|
-- Firs and Jungle tree axioms/rules by Vanessa Dannenberg, with the
|
2013-02-12 04:07:40 +01:00
|
|
|
-- latter having been tweaked by RealBadAngel, most other axioms/rules written
|
|
|
|
-- by RealBadAngel.
|
2013-01-14 02:37:05 +01:00
|
|
|
--
|
2013-02-11 18:09:17 +01:00
|
|
|
|
2013-01-19 03:35:39 +01:00
|
|
|
moretrees = {}
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
if minetest.get_modpath("default") then
|
|
|
|
minetest.override_item("default:sapling", {
|
|
|
|
description = "Sapling"
|
|
|
|
})
|
2019-06-18 20:51:50 +02:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
minetest.override_item("default:tree", {
|
|
|
|
description = "Tree"
|
|
|
|
})
|
2019-06-18 20:51:50 +02:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
minetest.override_item("default:wood", {
|
|
|
|
description = "Wooden Planks"
|
|
|
|
})
|
2019-06-18 20:51:50 +02:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
minetest.override_item("default:leaves", {
|
|
|
|
description = "Leaves"
|
|
|
|
})
|
2019-06-18 20:51:50 +02:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
minetest.override_item("default:fence_wood", {
|
|
|
|
description = "Wooden Fence"
|
|
|
|
})
|
2019-06-18 20:51:50 +02:00
|
|
|
|
2024-05-26 17:08:14 +02:00
|
|
|
minetest.override_item("default:fence_rail_wood", {
|
|
|
|
description = "Wooden Fence Rail"
|
|
|
|
})
|
|
|
|
end
|
2019-06-18 20:51:50 +02:00
|
|
|
|
|
|
|
if minetest.get_modpath("doors") then
|
|
|
|
minetest.override_item("doors:gate_wood_closed", {
|
|
|
|
description = "Wooden Fence Gate"
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.override_item("doors:gate_wood_open", {
|
|
|
|
description = "Wooden Fence Gate"
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2013-08-05 10:58:08 +02:00
|
|
|
-- Read the default config file (and if necessary, copy it to the world folder).
|
2013-04-09 06:15:24 +02:00
|
|
|
|
|
|
|
local worldpath=minetest.get_worldpath()
|
|
|
|
local modpath=minetest.get_modpath("moretrees")
|
|
|
|
|
2022-10-25 01:09:19 +02:00
|
|
|
dofile(modpath.."/settings.lua")
|
2013-04-09 06:15:24 +02:00
|
|
|
|
2015-08-15 23:15:08 +02:00
|
|
|
if io.open(worldpath.."/moretrees_settings.txt","r") then
|
|
|
|
io.close()
|
2013-04-09 06:32:15 +02:00
|
|
|
dofile(worldpath.."/moretrees_settings.txt")
|
|
|
|
end
|
2013-04-09 06:15:24 +02:00
|
|
|
|
2022-12-12 06:26:49 +01:00
|
|
|
-- Validate that if ethereal exists, that it's version is greater than 20220424.
|
|
|
|
-- Lower versions of ethereal clear registered biomes and decorations during
|
|
|
|
-- initialization which results in lost content from this mod (and others)
|
|
|
|
-- depending on where they are in the mod load order.
|
|
|
|
minetest.register_on_mods_loaded(function()
|
|
|
|
if minetest.global_exists("ethereal") then
|
|
|
|
local ethereal_ver = tonumber(ethereal.version)
|
|
|
|
if (ethereal_ver and ethereal_ver < 20220424) then
|
|
|
|
error("[moretrees] The version of ethereal detected can result " ..
|
|
|
|
"in parts of this mod and others disappearing due to mod " ..
|
|
|
|
"load order. Please update ethereal.");
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
2013-11-08 02:59:50 +01:00
|
|
|
|
|
|
|
-- infinite stacks checking
|
|
|
|
|
2018-01-09 20:01:47 +01:00
|
|
|
if minetest.get_modpath("unified_inventory") or not
|
|
|
|
minetest.settings:get_bool("creative_mode") then
|
2013-11-08 02:59:50 +01:00
|
|
|
moretrees.expect_infinite_stacks = false
|
|
|
|
else
|
|
|
|
moretrees.expect_infinite_stacks = true
|
|
|
|
end
|
2013-11-15 00:05:37 +01:00
|
|
|
|
2013-11-08 02:59:50 +01:00
|
|
|
-- tables, load other files
|
|
|
|
|
Update 2013-04-17: Got rid of horizontal jungle tree trunk, aliased it
to the one in the moreblocks mod. Got rid of jungle tree planks recipe,
default already has it. But that's not the important part...
Acorns, fir/spruce/pine cones, and coconuts are now edible!
Fir/spruce/pine cones can be cooked to extract fir/spruce/pine nuts. One cone yields 4 portions of nuts, each of which heals 1/2 heart.
Coconuts can be broken apart to get milk and raw coconut solids (e.g. the "meat"). Craft one coconut, one drinking glass, and one cutting tool (*see below). Yields one portion of coconut solids, one glass full of coconut milk, and the tool is returned. The coconut milk heals 1 heart and returns the empty glass, while one portion of coconut solids heals two hearts.
Coconut milk can be crafted with four acorns to produce acorn muffin batter. One portion of this batter can be cooked into four acorn muffins. Each muffin restores two hearts.
Enjoy :-)
-----
* Since Minetest doesn't have any default cutting tools that would normally be suitable for this purpose, the following tools may be used instead to cut the coconuts open:
Default bronze, diamond, Mese, or steel axe,
...or... glooptest Alatro or Arol axe,
...or... moreores Mithril or silver axe,
...or... titanium axe.
(note that stone and wooden axes are deliberately not usable)
2013-04-18 01:30:17 +02:00
|
|
|
moretrees.cutting_tools = {
|
|
|
|
"default:axe_mese",
|
2024-05-26 17:08:14 +02:00
|
|
|
xcompat.materials.axe_steel,
|
|
|
|
xcompat.materials.axe_diamond,
|
|
|
|
xcompat.materials.axe_bronze,
|
Update 2013-04-17: Got rid of horizontal jungle tree trunk, aliased it
to the one in the moreblocks mod. Got rid of jungle tree planks recipe,
default already has it. But that's not the important part...
Acorns, fir/spruce/pine cones, and coconuts are now edible!
Fir/spruce/pine cones can be cooked to extract fir/spruce/pine nuts. One cone yields 4 portions of nuts, each of which heals 1/2 heart.
Coconuts can be broken apart to get milk and raw coconut solids (e.g. the "meat"). Craft one coconut, one drinking glass, and one cutting tool (*see below). Yields one portion of coconut solids, one glass full of coconut milk, and the tool is returned. The coconut milk heals 1 heart and returns the empty glass, while one portion of coconut solids heals two hearts.
Coconut milk can be crafted with four acorns to produce acorn muffin batter. One portion of this batter can be cooked into four acorn muffins. Each muffin restores two hearts.
Enjoy :-)
-----
* Since Minetest doesn't have any default cutting tools that would normally be suitable for this purpose, the following tools may be used instead to cut the coconuts open:
Default bronze, diamond, Mese, or steel axe,
...or... glooptest Alatro or Arol axe,
...or... moreores Mithril or silver axe,
...or... titanium axe.
(note that stone and wooden axes are deliberately not usable)
2013-04-18 01:30:17 +02:00
|
|
|
"glooptest:axe_alatro",
|
|
|
|
"glooptest:axe_arol",
|
|
|
|
"moreores:axe_mithril",
|
|
|
|
"moreores:axe_silver",
|
|
|
|
"titanium:axe",
|
|
|
|
}
|
|
|
|
|
2013-04-09 06:15:24 +02:00
|
|
|
dofile(modpath.."/tree_models.lua")
|
|
|
|
dofile(modpath.."/node_defs.lua")
|
2016-05-18 22:54:19 +02:00
|
|
|
dofile(modpath.."/date_palm.lua")
|
2016-05-19 13:26:52 +02:00
|
|
|
dofile(modpath.."/cocos_palm.lua")
|
2013-09-15 04:44:32 +02:00
|
|
|
dofile(modpath.."/biome_defs.lua")
|
2013-04-09 06:15:24 +02:00
|
|
|
dofile(modpath.."/saplings.lua")
|
|
|
|
dofile(modpath.."/crafts.lua")
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2013-04-09 04:54:22 +02:00
|
|
|
-- tree spawning setup
|
2022-10-25 01:09:19 +02:00
|
|
|
moretrees.spawn_beech_object = moretrees.beech_model
|
|
|
|
moretrees.spawn_apple_tree_object = moretrees.apple_tree_model
|
|
|
|
moretrees.spawn_oak_object = moretrees.oak_model
|
|
|
|
moretrees.spawn_sequoia_object = moretrees.sequoia_model
|
|
|
|
moretrees.spawn_palm_object = moretrees.palm_model
|
|
|
|
moretrees.spawn_date_palm_object = moretrees.date_palm_model
|
|
|
|
moretrees.spawn_cedar_object = moretrees.cedar_model
|
|
|
|
moretrees.spawn_rubber_tree_object = moretrees.rubber_tree_model
|
|
|
|
moretrees.spawn_willow_object = moretrees.willow_model
|
|
|
|
moretrees.spawn_birch_object = "moretrees.grow_birch"
|
|
|
|
moretrees.spawn_spruce_object = "moretrees.grow_spruce"
|
|
|
|
moretrees.spawn_jungletree_object = "moretrees.grow_jungletree"
|
|
|
|
moretrees.spawn_fir_object = "moretrees.grow_fir"
|
|
|
|
moretrees.spawn_fir_snow_object = "moretrees.grow_fir_snow"
|
|
|
|
moretrees.spawn_poplar_object = moretrees.poplar_model
|
|
|
|
moretrees.spawn_poplar_small_object = moretrees.poplar_small_model
|
|
|
|
|
|
|
|
local deco_ids = {}
|
|
|
|
|
|
|
|
function translate_biome_defs(def, treename, index)
|
|
|
|
if not index then index = 1 end
|
|
|
|
local deco_def = {
|
|
|
|
name = treename .. "_" .. index,
|
|
|
|
deco_type = "simple",
|
|
|
|
place_on = def.place_on or def.surface,
|
|
|
|
sidelen = 16,
|
|
|
|
fill_ratio = def.fill_ratio or 0.001,
|
|
|
|
--biomes eventually?
|
|
|
|
y_min = def.min_elevation,
|
|
|
|
y_max = def.max_elevation,
|
|
|
|
spawn_by = def.near_nodes,
|
|
|
|
num_spawn_by = def.near_nodes_count,
|
|
|
|
decoration = "moretrees:"..treename.."_sapling_ongen"
|
|
|
|
}
|
|
|
|
|
|
|
|
deco_ids[#deco_ids+1] = treename .. ("_" .. index or "_1")
|
|
|
|
|
|
|
|
return deco_def
|
2013-09-15 04:44:32 +02:00
|
|
|
end
|
|
|
|
|
2024-05-27 18:18:58 +02:00
|
|
|
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))
|
2022-10-25 01:09:19 +02:00
|
|
|
|
2023-05-02 23:56:09 +02:00
|
|
|
--[[
|
|
|
|
this is purposefully wrapped in a on mods loaded callback to that it gets the proper ids
|
|
|
|
if other mods clear the registered decorations
|
|
|
|
]]
|
|
|
|
minetest.register_on_mods_loaded(function()
|
|
|
|
for k, v in pairs(deco_ids) do
|
|
|
|
deco_ids[k] = minetest.get_decoration_id(v)
|
|
|
|
end
|
|
|
|
minetest.set_gen_notify("decoration", deco_ids)
|
|
|
|
end)
|
2022-10-25 01:09:19 +02:00
|
|
|
|
|
|
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
|
|
|
local g = minetest.get_mapgen_object("gennotify")
|
|
|
|
local locations = {}
|
|
|
|
for _, id in pairs(deco_ids) do
|
|
|
|
local deco_locations = g["decoration#" .. id] or {}
|
|
|
|
for _, pos in pairs(deco_locations) do
|
|
|
|
locations[#locations+1] = pos
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if #locations == 0 then return end
|
|
|
|
for _, pos in ipairs(locations) do
|
|
|
|
local timer = minetest.get_node_timer({x=pos.x, y=pos.y+1, z=pos.z})
|
|
|
|
timer:start(math.random(2,10))
|
|
|
|
end
|
|
|
|
end)
|
2016-07-01 16:06:29 +02:00
|
|
|
|
2013-01-20 06:01:15 +01:00
|
|
|
-- Code to spawn a birch tree
|
|
|
|
|
2015-08-14 20:38:35 +02:00
|
|
|
function moretrees.grow_birch(pos)
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(pos, {name = "air"})
|
2013-01-20 06:01:15 +01:00
|
|
|
if math.random(1,2) == 1 then
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos, moretrees.birch_model1)
|
2013-01-20 06:01:15 +01:00
|
|
|
else
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos, moretrees.birch_model2)
|
2013-01-20 06:01:15 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Code to spawn a spruce tree
|
|
|
|
|
2015-08-14 20:38:35 +02:00
|
|
|
function moretrees.grow_spruce(pos)
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(pos, {name = "air"})
|
2013-01-20 06:01:15 +01:00
|
|
|
if math.random(1,2) == 1 then
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos, moretrees.spruce_model1)
|
2013-01-20 06:01:15 +01:00
|
|
|
else
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos, moretrees.spruce_model2)
|
2013-01-20 06:01:15 +01:00
|
|
|
end
|
|
|
|
end
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-02-12 04:07:40 +01:00
|
|
|
-- Code to spawn jungle trees
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jt_axiom1 = "FFFA"
|
|
|
|
moretrees.jt_rules_a1 = "FFF[&&-FBf[&&&Ff]^^^Ff][&&+FBFf[&&&FFf]^^^Ff][&&---FBFf[&&&Ff]^^^Ff][&&+++FBFf[&&&Ff]^^^Ff]F/A"
|
|
|
|
moretrees.jt_rules_b1 = "[-Ff&f][+Ff&f]B"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jt_axiom2 = "FFFFFA"
|
2022-10-25 01:09:19 +02:00
|
|
|
-- luacheck: no max line length
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jt_rules_a2 = "FFFFF[&&-FFFBF[&&&FFff]^^^FFf][&&+FFFBFF[&&&FFff]^^^FFf][&&---FFFBFF[&&&FFff]^^^FFf][&&+++FFFBFF[&&&FFff]^^^FFf]FF/A"
|
|
|
|
moretrees.jt_rules_b2 = "[-FFf&ff][+FFf&ff]B"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.ct_rules_a1 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
|
|
|
|
moretrees.ct_rules_b1 = "[-FBf][+FBf]"
|
2013-01-11 16:29:38 +01:00
|
|
|
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.ct_rules_a2 = "FF[FF][&&-FBF][&&+FBF][&&---FBF][&&+++FBF]F/A"
|
|
|
|
moretrees.ct_rules_b2 = "[-fB][+fB]"
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2015-08-14 20:38:35 +02:00
|
|
|
function moretrees.grow_jungletree(pos)
|
2013-01-11 16:29:38 +01:00
|
|
|
local r1 = math.random(2)
|
|
|
|
local r2 = math.random(3)
|
|
|
|
if r1 == 1 then
|
2013-01-22 02:50:41 +01:00
|
|
|
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_red"
|
2017-06-18 12:25:20 +02:00
|
|
|
else
|
2013-01-22 02:50:41 +01:00
|
|
|
moretrees.jungletree_model.leaves2 = "moretrees:jungletree_leaves_yellow"
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.leaves2_chance = math.random(25, 75)
|
2013-01-11 16:29:38 +01:00
|
|
|
|
|
|
|
if r2 == 1 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "single"
|
|
|
|
moretrees.jungletree_model.iterations = 2
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom1
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a1
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b1
|
2013-01-11 16:29:38 +01:00
|
|
|
elseif r2 == 2 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "double"
|
|
|
|
moretrees.jungletree_model.iterations = 4
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom2
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a2
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
elseif r2 == 3 then
|
2013-01-20 00:36:13 +01:00
|
|
|
moretrees.jungletree_model.trunk_type = "crossed"
|
|
|
|
moretrees.jungletree_model.iterations = 4
|
|
|
|
moretrees.jungletree_model.axiom = moretrees.jt_axiom2
|
|
|
|
moretrees.jungletree_model.rules_a = moretrees.jt_rules_a2
|
|
|
|
moretrees.jungletree_model.rules_b = moretrees.jt_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
|
2022-10-25 01:09:19 +02:00
|
|
|
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},
|
2024-05-26 17:08:14 +02:00
|
|
|
xcompat.materials.apple_leaves
|
2022-10-25 01:09:19 +02:00
|
|
|
)
|
2013-01-11 16:29:38 +01:00
|
|
|
for leaf in ipairs(leaves) do
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(leaves[leaf], {name = "air"})
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos, moretrees.jungletree_model)
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
-- code to spawn fir trees
|
2013-02-12 04:07:40 +01:00
|
|
|
|
2015-08-14 20:38:35 +02:00
|
|
|
function moretrees.grow_fir(pos)
|
2013-01-11 16:29:38 +01:00
|
|
|
if math.random(2) == 1 then
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves"
|
2013-01-11 16:29:38 +01:00
|
|
|
else
|
2013-01-22 17:29:20 +01:00
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves_bright"
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
if math.random(2) == 1 then
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a1
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b1
|
2013-01-10 03:35:50 +01:00
|
|
|
else
|
2013-01-22 02:52:04 +01:00
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a2
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b2
|
2013-01-11 16:29:38 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
moretrees.fir_model.iterations = 7
|
|
|
|
moretrees.fir_model.random_level = 5
|
|
|
|
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(pos, {name = "air"})
|
|
|
|
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},
|
2024-05-26 17:08:14 +02:00
|
|
|
xcompat.materials.apple_leaves
|
2022-10-25 01:09:19 +02:00
|
|
|
)
|
2013-01-11 16:29:38 +01:00
|
|
|
for leaf in ipairs(leaves) do
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(leaves[leaf], {name = "air"})
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos,moretrees.fir_model)
|
2013-01-10 03:35:50 +01:00
|
|
|
end
|
|
|
|
|
2013-02-23 18:34:01 +01:00
|
|
|
-- same thing, but a smaller version that grows only in snow biomes
|
2013-01-10 03:35:50 +01:00
|
|
|
|
2015-08-14 20:38:35 +02:00
|
|
|
function moretrees.grow_fir_snow(pos)
|
2013-02-23 18:34:01 +01:00
|
|
|
if math.random(2) == 1 then
|
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves"
|
|
|
|
else
|
|
|
|
moretrees.fir_model.leaves="moretrees:fir_leaves_bright"
|
|
|
|
end
|
|
|
|
if math.random(2) == 1 then
|
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a1
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b1
|
|
|
|
else
|
|
|
|
moretrees.fir_model.rules_a = moretrees.ct_rules_a2
|
|
|
|
moretrees.fir_model.rules_b = moretrees.ct_rules_b2
|
|
|
|
end
|
|
|
|
|
|
|
|
moretrees.fir_model.iterations = 2
|
|
|
|
moretrees.fir_model.random_level = 2
|
|
|
|
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(pos, {name = "air"})
|
|
|
|
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},
|
2024-05-26 17:08:14 +02:00
|
|
|
xcompat.materials.apple_leaves
|
2022-10-25 01:09:19 +02:00
|
|
|
)
|
2013-02-23 18:34:01 +01:00
|
|
|
for leaf in ipairs(leaves) do
|
2022-10-25 01:09:19 +02:00
|
|
|
minetest.swap_node(leaves[leaf], {name = "air"})
|
2013-02-23 18:34:01 +01:00
|
|
|
end
|
2013-07-01 05:55:07 +02:00
|
|
|
minetest.spawn_tree(pos,moretrees.fir_model)
|
2013-02-23 18:34:01 +01:00
|
|
|
end
|
2013-02-12 04:07:40 +01:00
|
|
|
|
2024-01-12 18:08:54 +01:00
|
|
|
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")
|