1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

Added all cherry things from Jordach's BFD

- Added cherry trees' biomes
- Added cherry wooden plank stairs
- Added cherry nodes : sapling, log, wood, etc
- Added cherry trees' generation system
- Added cherry items' crafts
This commit is contained in:
LeMagnesium 2015-03-30 20:54:58 +02:00
parent 1df57889e8
commit 0b7251fdce
14 changed files with 256 additions and 1 deletions

View File

@ -711,6 +711,15 @@ minetest.register_craft({ -- Tool repair (combine 2 tools of the same type in th
type = "toolrepair", additional_wear = -0.15, type = "toolrepair", additional_wear = -0.15,
}) })
-- From BFD:
minetest.register_craft({
output = 'default:cherry_plank 6',
recipe = {
{'default:cherry_log'},
}
})
-- Cooking recipes: -- Cooking recipes:
minetest.register_craft({ minetest.register_craft({

View File

@ -1760,6 +1760,95 @@ minetest.register_node("default:pinewood", {
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
-- From BFD: Cherry tree
minetest.register_node("default:cherry_tree", {
description = "Cherry Log",
tiles = {"default_cherry_top.png", "default_cherry_top.png", "default_cherry_tree.png"},
is_ground_content = false,
groups = {tree=1,choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
drop = "default:cherry_log"
})
minetest.register_node("default:cherry_log", {
description = "Cherry Log",
tiles = {"default_cherry_top.png", "default_cherry_top.png", "default_cherry_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = {choppy=2,oddly_breakable_by_hand=1,flammable=2},
sounds = default.node_sound_wood_defaults(),
on_place = minetest.rotate_node,
})
minetest.register_node("default: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",
tiles = {"default_cherry_sapling.png"},
walkable = false,
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},
sounds = default.node_sound_leaves_defaults(),
})
minetest.register_node("default: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 = {'default:cherry_sapling'},
rarity = 32,
},
{
items = {'default:cherry_blossom_leaves'},
}
}
},
sounds = default.node_sound_leaves_defaults(),
on_place = function(itemstack, placer, pointed_thing)
-- place a random grass node
local stack = ItemStack("default:cherry_leaves_deco")
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("default:cherry_blossom_leaves".." "..itemstack:get_count()-(1-ret:get_count()))
end,
})
minetest.register_node("default: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 = {'default:cherry_blossom_leaves'},
})
minetest.register_node("default:cherry_plank", {
description = "Cherry Planks",
tiles = {"default_wood_cherry_planks.png"},
sounds = default.node_sound_wood_defaults(),
groups = {oddly_breakable_by_hand=1, flammable=1, choppy=3, wood=1},
})
if minetest.setting_getbool("xray") then if minetest.setting_getbool("xray") then
-- Nodes to make partially see-through: -- Nodes to make partially see-through:
minetest.override_item("default:stone_with_coal", {tiles = {"default_mineral_coal.png"}}) minetest.override_item("default:stone_with_coal", {tiles = {"default_mineral_coal.png"}})

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

View File

@ -220,7 +220,7 @@ local function add_snow(data, vi, c_air, c_ignore, c_snow)
end end
end end
function default.grow_pinet_ree(pos) function default.grow_pine_tree(pos)
local x, y, z = pos.x, pos.y, pos.z local x, y, z = pos.x, pos.y, pos.z
local maxy = y + random(9, 13) -- Trunk top local maxy = y + random(9, 13) -- Trunk top
@ -341,3 +341,130 @@ function default.grow_pinet_ree(pos)
vm:write_to_map() vm:write_to_map()
vm:update_map() vm:update_map()
end end
-- From BFD:
minetest.register_node("default:mg_cherry_sapling", {
description = "Impossible to get node.",
drawtype = "airlike",
paramtype = "light",
tiles = {"xfences_space.png"},
groups = {not_in_creative_inventory=1},
})
local c_mg_cherry_sapling = minetest.get_content_id("default:mg_cherry_sapling")
minetest.register_on_generated(function(minp, maxp, seed)
local timer = os.clock()
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new{MinEdge=emin, MaxEdge=emax}
local trees_grown = 0
for z=minp.z, maxp.z, 1 do
for y=minp.y, maxp.y, 1 do
for x=minp.x, maxp.x, 1 do
local p_pos = area:index(x,y,z)
local content_id = data[p_pos]
if content_id == c_mg_cherry_sapling then
mapgen.grow_tree({x=x, y=y, z=z}, false, "default:cherry_tree", "default:cherry_blossom_leaves")
trees_grown = trees_grown + 1
else
-- nope
end
end
end
end
local geninfo = string.format(" trees grown after: %.2fs", os.clock() - timer)
print (trees_grown..geninfo)
end)
function default.grow_cherry_tree(pos, is_apple_tree, trunk_node, leaves_node)
--[[
NOTE: Tree-placing code is currently duplicated in the engine
and in games that have saplings; both are deprecated but not
replaced yet
--]]
local x, y, z = pos.x, pos.y, pos.z
local height = random(4, 5)
local c_tree = minetest.get_content_id(trunk_node)
local c_leaves = minetest.get_content_id(leaves_node)
local vm = minetest.get_voxel_manip()
local minp, maxp = vm:read_from_map(
{x = pos.x - 2, y = pos.y, z = pos.z - 2},
{x = pos.x + 2, y = pos.y + height + 1, z = pos.z + 2}
)
local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp})
local data = vm:get_data()
add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree)
vm:set_data(data)
vm:write_to_map()
vm:update_map()
end
minetest.register_abm({
nodenames = {"default:cherry_sapling"},
interval = 80,
chance = 3,
action = function(pos, node)
local nu = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name
local is_soil = minetest.get_item_group(nu, "soil")
if is_soil == 0 then
return
end
minetest.remove_node({x=pos.x, y=pos.y, z=pos.z})
default.grow_cherry_tree(pos, false, "default:cherry_tree", "default:cherry_blossom_leaves")
end,
})
minetest.register_biome({
name = "cherry_blossom_forest",
node_shore_filler = "default:sand",
node_top = "default:grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
node_dust = "air",
node_underwater = "default:gravel",
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:grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
node_dust = "air",
node_underwater = "default:gravel",
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:grass",
depth_top = 1,
node_filler = "default:dirt",
depth_filler = 3,
node_dust = "air",
node_underwater = "default:gravel",
y_min = 1,
y_max = 42,
heat_point = 55,
humidity_point = 55,
})

View File

@ -350,6 +350,26 @@ minetest.register_craft({
} }
}) })
-- From BFD: Cherry planks doors
doors.register_door("doors:door_cherry", {
description = "Cherry Door",
inventory_image = "door_wood_cherry.png",
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
tiles_bottom = {"door_wood_cherry_b.png", "default_wood_cherry_planks.png"},
tiles_top = {"door_wood_cherry_a.png", "default_wood_cherry_planks.png"},
sounds = default.node_sound_wood_defaults(),
sunlight = false,
})
minetest.register_craft({
output = "doors:door_cherry",
recipe = {
{"default:cherry_plank", "default:cherry_plank"},
{"default:cherry_plank", "default:cherry_plank"},
{"default:cherry_plank", "default:cherry_plank"}
}
})
----trapdoor---- ----trapdoor----

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

View File

@ -309,3 +309,13 @@ stairs.register_stair_and_slab("obsidianbrick", "default:obsidianbrick",
"Obsidian Brick Stair", "Obsidian Brick Stair",
"Obsidian Brick Slab", "Obsidian Brick Slab",
default.node_sound_stone_defaults()) default.node_sound_stone_defaults())
-- From BFD:
stairs.register_stair_and_slab("cherry_wood", "default:cherry_plank",
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
{"default_wood_cherry_planks.png"},
"Cherry Plank Stair",
"Cherry Plank Slab",
"Cherry Plank Corner Stair",
default.node_sound_wood_defaults())