forked from minetest/minetest_game
Default: Add biome API tree schematics and enable growing by sapling ABMs
This commit is contained in:
parent
da9789e3ce
commit
e2033025b0
BIN
mods/default/schematics/acacia_tree.mts
Normal file
BIN
mods/default/schematics/acacia_tree.mts
Normal file
Binary file not shown.
BIN
mods/default/schematics/apple_tree.mts
Normal file
BIN
mods/default/schematics/apple_tree.mts
Normal file
Binary file not shown.
BIN
mods/default/schematics/jungle_tree.mts
Normal file
BIN
mods/default/schematics/jungle_tree.mts
Normal file
Binary file not shown.
BIN
mods/default/schematics/large_cactus.mts
Normal file
BIN
mods/default/schematics/large_cactus.mts
Normal file
Binary file not shown.
BIN
mods/default/schematics/pine_tree.mts
Normal file
BIN
mods/default/schematics/pine_tree.mts
Normal file
Binary file not shown.
|
@ -30,7 +30,11 @@ minetest.register_abm({
|
||||||
|
|
||||||
minetest.log("action", "A sapling grows into a tree at "..
|
minetest.log("action", "A sapling grows into a tree at "..
|
||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
|
if minetest.get_mapgen_params().mgname == "v6" then
|
||||||
default.grow_tree(pos, random(1, 4) == 1)
|
default.grow_tree(pos, random(1, 4) == 1)
|
||||||
|
else
|
||||||
|
default.grow_new_apple_tree(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -45,7 +49,11 @@ minetest.register_abm({
|
||||||
|
|
||||||
minetest.log("action", "A jungle sapling grows into a tree at "..
|
minetest.log("action", "A jungle sapling grows into a tree at "..
|
||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
|
if minetest.get_mapgen_params().mgname == "v6" then
|
||||||
default.grow_jungle_tree(pos)
|
default.grow_jungle_tree(pos)
|
||||||
|
else
|
||||||
|
default.grow_new_jungle_tree(pos)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -60,7 +68,26 @@ minetest.register_abm({
|
||||||
|
|
||||||
minetest.log("action", "A pine sapling grows into a tree at "..
|
minetest.log("action", "A pine sapling grows into a tree at "..
|
||||||
minetest.pos_to_string(pos))
|
minetest.pos_to_string(pos))
|
||||||
|
if minetest.get_mapgen_params().mgname == "v6" then
|
||||||
default.grow_pine_tree(pos)
|
default.grow_pine_tree(pos)
|
||||||
|
else
|
||||||
|
default.grow_new_pine_tree(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"default:acacia_sapling"},
|
||||||
|
interval = 13,
|
||||||
|
chance = 50,
|
||||||
|
action = function(pos, node)
|
||||||
|
if not can_grow(pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.log("action", "An acacia sapling grows into a tree at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
default.grow_new_acacia_tree(pos)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -346,3 +373,34 @@ function default.grow_pine_tree(pos)
|
||||||
vm:update_map()
|
vm:update_map()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- New tree
|
||||||
|
|
||||||
|
function default.grow_new_apple_tree(pos)
|
||||||
|
local path = minetest.get_modpath("default") .. "/schematics/apple_tree.mts"
|
||||||
|
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||||
|
path, 0, nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- New jungle tree
|
||||||
|
|
||||||
|
function default.grow_new_jungle_tree(pos)
|
||||||
|
local path = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts"
|
||||||
|
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||||
|
path, 0, nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- New pine tree
|
||||||
|
|
||||||
|
function default.grow_new_pine_tree(pos)
|
||||||
|
local path = minetest.get_modpath("default") .. "/schematics/pine_tree.mts"
|
||||||
|
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||||
|
path, 0, nil, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- New acacia tree
|
||||||
|
|
||||||
|
function default.grow_new_acacia_tree(pos)
|
||||||
|
local path = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts"
|
||||||
|
minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4},
|
||||||
|
path, random, nil, false)
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user