- Initial commit
- Use of LBM and schematics for trees and logs
This commit is contained in:
parent
7935312a6d
commit
abc4cbce4c
4
.gitignore
vendored
Executable file
4
.gitignore
vendored
Executable file
@ -0,0 +1,4 @@
|
||||
*~
|
||||
*.autosave
|
||||
#*
|
||||
.dir-locals.el
|
1
depends.txt
Normal file
1
depends.txt
Normal file
@ -0,0 +1 @@
|
||||
default
|
316
init.lua
Normal file
316
init.lua
Normal file
@ -0,0 +1,316 @@
|
||||
--[[
|
||||
cherry_tree:cherry_tree
|
||||
cherry_tree:cherry_plank
|
||||
cherry_tree:cherry_blossom_leaves
|
||||
cherry_tree:cherry_sapling
|
||||
--]]
|
||||
|
||||
local random = math.random
|
||||
|
||||
-- Cherry tree growing
|
||||
-- Sapling ABM
|
||||
|
||||
-- Cherry tree generation
|
||||
local function grow_cherry_tree(pos)
|
||||
local path = minetest.get_modpath("cherry_tree") ..
|
||||
"/schematics/cherry_tree_from_sapling.mts"
|
||||
minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2},
|
||||
path, "random", nil, false)
|
||||
end
|
||||
|
||||
local function grow_sapling(pos)
|
||||
if not default.can_grow(pos) then
|
||||
minetest.get_node_timer(pos):start(random(240, 600))
|
||||
return
|
||||
end
|
||||
|
||||
local node = minetest.get_node(pos)
|
||||
|
||||
if node.name == "cherry_tree:cherry_sapling" then
|
||||
minetest.log("action", "A cherry sapling grows into a tree at "..
|
||||
minetest.pos_to_string(pos))
|
||||
grow_cherry_tree(pos)
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_lbm(
|
||||
{
|
||||
name = "cherry_tree:convert_saplings_to_node_timer",
|
||||
nodenames = {"cherry_tree:cherry_sapling"},
|
||||
action = function(pos)
|
||||
minetest.get_node_timer(pos):start(random(1200, 2400))
|
||||
end
|
||||
})
|
||||
|
||||
-- From BFD, cherry tree
|
||||
minetest.register_node(
|
||||
"cherry_tree:cherry_tree",
|
||||
{
|
||||
description = "Cherry Tree",
|
||||
tiles = {
|
||||
"default_cherry_top.png",
|
||||
"default_cherry_top.png",
|
||||
"default_cherry_tree.png"
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = minetest.rotate_node
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"cherry_tree:cherry_plank",
|
||||
{
|
||||
description = "Cherry Planks",
|
||||
paramtype2 = "facedir",
|
||||
place_param2 = 0,
|
||||
tiles = {"default_wood_cherry_planks.png"},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, wood=1},
|
||||
})
|
||||
|
||||
minetest.register_node(
|
||||
"cherry_tree:cherry_blossom_leaves",
|
||||
{
|
||||
description = "Cherry Blossom Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_cherry_blossom_leaves.png"},
|
||||
paramtype = "light",
|
||||
waving = 1,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, leafdecay=3, flammable=2, leaves=1},
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {'cherry_tree:cherry_sapling'},
|
||||
rarity = 32,
|
||||
},
|
||||
{
|
||||
items = {'cherry_tree:cherry_blossom_leaves'},
|
||||
}
|
||||
}
|
||||
},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = default.after_place_leaves,
|
||||
})
|
||||
|
||||
--[[minetest.register_node("cherry_tree:cherry_leaves_deco", {
|
||||
description = "Cherry Leaves",
|
||||
drawtype = "allfaces_optional",
|
||||
visual_scale = 1.3,
|
||||
tiles = {"default_cherry_blossom_leaves.png"},
|
||||
paramtype = "light",
|
||||
waving=1,
|
||||
is_ground_content = false,
|
||||
groups = {snappy=3, flammable=2, leaves=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = {'cherry_tree:cherry_blossom_leaves'},
|
||||
})
|
||||
--]]
|
||||
|
||||
minetest.register_node(
|
||||
"cherry_tree:cherry_sapling",
|
||||
{
|
||||
description = "Cherry Sapling",
|
||||
waving = 1,
|
||||
visual_scale = 1.0,
|
||||
inventory_image = "default_cherry_sapling.png",
|
||||
wield_image = "default_cherry_sapling.png",
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
tiles = {"default_cherry_sapling.png"},
|
||||
walkable = false,
|
||||
on_timer = grow_sapling,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0.35, 0.3}
|
||||
},
|
||||
groups = {snappy = 2, dig_immediate = 3, flammable = 2,
|
||||
attached_node = 1, sapling = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(random(2400,4800))
|
||||
end,
|
||||
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
itemstack = default.sapling_on_place(
|
||||
itemstack, placer, pointed_thing,
|
||||
"cherry_tree:cherry_sapling",
|
||||
-- minp, maxp to be checked, relative to sapling pos
|
||||
-- minp_relative.y = 1 because sapling pos has been checked
|
||||
{x = -2, y = 1, z = -2},
|
||||
{x = 2, y = 6, z = 2},
|
||||
-- maximum interval of interior volume check
|
||||
4)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
default.register_leafdecay(
|
||||
{
|
||||
trunks = {"cherry_tree:cherry_tree"},
|
||||
leaves = {"default:apple", "cherry_tree:cherry_blossom_leaves"},
|
||||
radius = 3,
|
||||
})
|
||||
|
||||
-- Aliases
|
||||
minetest.register_alias("default:cherry_tree", "cherry_tree:cherry_tree")
|
||||
minetest.register_alias("default:cherry_log", "cherry_tree:cherry_tree")
|
||||
minetest.register_alias("default:cherry_plank", "cherry_tree:cherry_plank")
|
||||
minetest.register_alias("default:cherry_blossom_leaves", "cherry_tree:cherry_blossom_leaves")
|
||||
minetest.register_alias("default:cherry_leaves_deco", "cherry_tree:cherry_blossom_leaves")
|
||||
minetest.register_alias("default:cherry_leaves", "cherry_tree:cherry_blossom_leaves")
|
||||
minetest.register_alias("default:cherry_sapling", "cherry_tree:cherry_sapling")
|
||||
minetest.register_alias("default:mg_cherry_sapling", "cherry_tree:cherry_sapling")
|
||||
|
||||
-- Crafting
|
||||
minetest.register_craft(
|
||||
{
|
||||
output = 'cherry_tree:cherry_plank 4',
|
||||
recipe = {
|
||||
{'cherry_tree:cherry_tree'},
|
||||
}
|
||||
})
|
||||
|
||||
-- Mapgen
|
||||
minetest.register_biome(
|
||||
{
|
||||
name = "cherry_blossom_forest",
|
||||
--node_shore_filler = "default:sand",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 3,
|
||||
--node_dust = "air",
|
||||
--node_underwater = "default:gravel",
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 40,
|
||||
heat_point = 50,
|
||||
humidity_point = 55,
|
||||
})
|
||||
|
||||
minetest.register_biome(
|
||||
{
|
||||
name = "cherry_blossom_forest_floral",
|
||||
--node_shore_filler = "default:sand",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 3,
|
||||
--node_dust = "air",
|
||||
--node_underwater = "default:gravel",
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 40,
|
||||
heat_point = 47,
|
||||
humidity_point = 50,
|
||||
})
|
||||
|
||||
minetest.register_biome(
|
||||
{
|
||||
name = "cherry_blossom_forest_grassy",
|
||||
--node_shore_filler = "default:sand",
|
||||
node_top = "default:dirt_with_grass",
|
||||
depth_top = 1,
|
||||
node_filler = "default:dirt",
|
||||
depth_filler = 3,
|
||||
--node_dust = "air",
|
||||
--node_underwater = "default:gravel",
|
||||
node_riverbed = "default:sand",
|
||||
depth_riverbed = 2,
|
||||
y_min = 1,
|
||||
y_max = 42,
|
||||
heat_point = 55,
|
||||
humidity_point = 55,
|
||||
})
|
||||
|
||||
-- Decoration
|
||||
-- Cherry tree and log
|
||||
|
||||
minetest.register_decoration(
|
||||
{
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0.036,
|
||||
scale = 0.022,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {
|
||||
"cherry_blossom_forest",
|
||||
"cherry_blossom_forest_floral",
|
||||
"cherry_blossom_forest_grassy"
|
||||
},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
schematic = minetest.get_modpath("cherry_tree") ..
|
||||
"/schematics/cherry_tree.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration(
|
||||
{
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0.0009,
|
||||
scale = 0.0006,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {
|
||||
"deciduous_forest",
|
||||
"cherry_blossom_forest",
|
||||
"cherry_blossom_forest_floral",
|
||||
"cherry_blossom_forest_grassy"
|
||||
},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
schematic = minetest.get_modpath("cherry_tree") ..
|
||||
"/schematics/cherry_tree.mts",
|
||||
flags = "place_center_x, place_center_z",
|
||||
rotation = "random",
|
||||
})
|
||||
|
||||
minetest.register_decoration(
|
||||
{
|
||||
deco_type = "schematic",
|
||||
place_on = {"default:dirt_with_grass"},
|
||||
sidelen = 16,
|
||||
noise_params = {
|
||||
offset = 0.0018,
|
||||
scale = 0.0011,
|
||||
spread = {x = 250, y = 250, z = 250},
|
||||
seed = 2,
|
||||
octaves = 3,
|
||||
persist = 0.66
|
||||
},
|
||||
biomes = {
|
||||
"deciduous_forest",
|
||||
"cherry_blossom_forest",
|
||||
"cherry_blossom_forest_floral",
|
||||
"cherry_blossom_forest_grassy"
|
||||
},
|
||||
y_min = 1,
|
||||
y_max = 31000,
|
||||
schematic = minetest.get_modpath("cherry_tree") ..
|
||||
"/schematics/cherry_log.mts",
|
||||
flags = "place_center_x",
|
||||
rotation = "random",
|
||||
})
|
BIN
schematics/cherry_log.mts
Normal file
BIN
schematics/cherry_log.mts
Normal file
Binary file not shown.
BIN
schematics/cherry_tree.mts
Normal file
BIN
schematics/cherry_tree.mts
Normal file
Binary file not shown.
BIN
schematics/cherry_tree_from_sapling.mts
Normal file
BIN
schematics/cherry_tree_from_sapling.mts
Normal file
Binary file not shown.
BIN
textures/default_cherry_blossom_leaves.png
Executable file
BIN
textures/default_cherry_blossom_leaves.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 571 B |
BIN
textures/default_cherry_sapling.png
Executable file
BIN
textures/default_cherry_sapling.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 167 B |
BIN
textures/default_cherry_top.png
Executable file
BIN
textures/default_cherry_top.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 627 B |
BIN
textures/default_cherry_tree.png
Executable file
BIN
textures/default_cherry_tree.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 632 B |
BIN
textures/default_wood_cherry_planks.png
Executable file
BIN
textures/default_wood_cherry_planks.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 555 B |
Loading…
Reference in New Issue
Block a user