Compare commits

...

6 Commits

33 changed files with 419 additions and 3 deletions

View File

@ -437,9 +437,9 @@ cboat.selectionbox = {-0.7, -0.15, -0.7, 0.7, 0.75, 0.7}
minetest.register_entity("mcl_boats:chest_boat", cboat)
mcl_entity_invs.register_inv("mcl_boats:chest_boat","Boat",27)
local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak", "boat_obsidian", "boat_mangrove", "chest_boat", "chest_boat_spruce", "chest_boat_birch", "chest_boat_jungle", "chest_boat_acacia", "chest_boat_dark_oak", "chest_boat_mangrove" }
local names = { S("Oak Boat"), S("Spruce Boat"), S("Birch Boat"), S("Jungle Boat"), S("Acacia Boat"), S("Dark Oak Boat"), S("Obsidian Boat"), S("Mangrove Boat"), S("Oak Chest Boat"), S("Spruce Chest Boat"), S("Birch Chest Boat"), S("Jungle Chest Boat"), S("Acacia Chest Boat"), S("Dark Oak Chest Boat"), S("Mangrove Chest Boat") }
local craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood", "mcl_core:obsidian", "mcl_mangrove:mangrove_wood" }
local boat_ids = { "boat", "boat_spruce", "boat_birch", "boat_jungle", "boat_acacia", "boat_dark_oak", "boat_obsidian", "boat_mangrove", "boat_cherry", "chest_boat", "chest_boat_spruce", "chest_boat_birch", "chest_boat_jungle", "chest_boat_acacia", "chest_boat_dark_oak", "chest_boat_mangrove", "chest_boat_cherry" }
local names = { S("Oak Boat"), S("Spruce Boat"), S("Birch Boat"), S("Jungle Boat"), S("Acacia Boat"), S("Dark Oak Boat"), S("Obsidian Boat"), S("Mangrove Boat"), S("Cherry Boat"), S("Oak Chest Boat"), S("Spruce Chest Boat"), S("Birch Chest Boat"), S("Jungle Chest Boat"), S("Acacia Chest Boat"), S("Dark Oak Chest Boat"), S("Mangrove Chest Boat"), S("Cherry Chest Boat") }
local craftstuffs = { "mcl_core:wood", "mcl_core:sprucewood", "mcl_core:birchwood", "mcl_core:junglewood", "mcl_core:acaciawood", "mcl_core:darkwood", "mcl_core:obsidian", "mcl_mangrove:mangrove_wood", "mcl_cherry_blossom:cherrywood" }
for b=1, #boat_ids do
local itemstring = "mcl_boats:"..boat_ids[b]

View File

@ -0,0 +1,86 @@
-- Crafting
local planks = "mcl_cherry_blossom:cherrywood"
local logs = "mcl_cherry_blossom:cherrytree"
local stripped_logs = "mcl_cherry_blossom:stripped_cherrytree"
minetest.register_craft({
output = "mcl_cherry_blossom:cherrytree_bark 3",
recipe = {
{ logs, logs },
{ logs, logs },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:stripped_cherrytree_bark 3",
recipe = {
{ stripped_logs, stripped_logs },
{ stripped_logs, stripped_logs },
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrywood 4",
recipe = {
{ logs },
}
})
minetest.register_craft({
output = "mcl_chery_blossom:cherrydoor 3",
recipe = {
{planks, planks},
{planks, planks},
{planks, planks}
}
})
minetest.register_craft({
output = "mcl_cherry_blossom:cherrytrapdoor 2",
recipe = {
{planks, planks, planks},
{planks, planks, planks},
}
})
minetest.register_craft({
output = "mcl_fences:cherry_fence 3",
recipe = {
{planks, "mcl_core:stick", planks},
{planks, "mcl_core:stick", planks},
}
})
minetest.register_craft({
output = "mcl_fences:cherry_fence_gate",
recipe = {
{"mcl_core:stick", planks, "mcl_core:stick"},
{"mcl_core:stick", planks, "mcl_core:stick"},
}
})
mcl_signs.register_sign_craft("mcl_cherry_blossom", "mcl_cherry_blossom:cherrywood", "cherrywood")
-- Smelting
minetest.register_craft({
type = "fuel",
recipe = "mcl_cherry_blossom:cherrydoor",
burntime = 10,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_cherry_blossom:cherrytrapdoor",
burntime = 15,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_cherry_blossom:pressure_plate_cherrywood_off",
burntime = 15
})
minetest.register_craft({
type = "fuel",
recipe = "mesecons_button:button_cherrywood_off",
burntime = 5,
})

View File

@ -0,0 +1,56 @@
-- Tree Growth
-- TODO: Use better spawning behavior and wood api when wood api is finished.
function mcl_cherry_blossom.generate_cherry_tree(pos)
local pr = PseudoRandom(pos.x+pos.y+pos.z)
local r = pr:next(1,3)
local modpath = minetest.get_modpath("mcl_cherry_blossom")
local path = modpath.."/schematics/mcl_cherry_blossom_tree_"..tostring(r)..".mts"
if mcl_core.check_growth_width(pos,7,8) then
minetest.set_node(pos, {name = "air"})
if r == 1 then
minetest.place_schematic({x = pos.x-2, y = pos.y, z = pos.z-2}, path, "random", nil, false)
elseif r == 2 then
minetest.place_schematic({x = pos.x-2, y = pos.y, z = pos.z-2}, path, nil, nil, false)
elseif r == 3 then
minetest.place_schematic({x = pos.x-3, y = pos.y, z = pos.z-3}, path, nil, nil, false)
end
end
end
minetest.register_abm({
label = "Cherry Tree Growth",
nodenames = "mcl_cherry_blossom:cherrysapling",
interval = 30,
chance = 5,
action = function(pos,node)
mcl_cherry_blossom.generate_cherry_tree(pos)
end,
})
local cherry_particle = {
velocity = vector.new(0,0,0),
size = math.random(1.3,2.5),
texture = "mcl_cherry_blossom_particle.png",
collision_removal = false,
}
minetest.register_abm({
label = "Cherry Blossom Particles",
nodenames = {"mcl_cherry_blossom:cherryleaves"},
interval = 5,
chance = 10,
action = function(pos, node)
minetest.after(math.random(0.1,1.5),function()
local pt = table.copy(cherry_particle)
pt.acceleration = vector.new(0,0,0)
pt.collisiondetection = false
pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5))
minetest.add_particle(pt)
pt.acceleration = vector.new(0,-1,0)
pt.collisiondetection = true
pt.expirationtime = math.random(1.2,4.5)
minetest.add_particle(pt)
end)
end
})

View File

@ -0,0 +1,6 @@
mcl_cherry_blossom = {}
local modpath = minetest.get_modpath("mcl_cherry_blossom")
dofile(modpath.."/nodes.lua") -- Load Nodes
dofile(modpath.."/crafting.lua") -- Load Crafting Recipes
dofile(modpath.."/growth.lua") -- Load Cherry Blossom Tree Growth

View File

@ -0,0 +1,3 @@
title = mcl_cherry_blossom
author = PrairieWind
depends = mcl_sounds, mcl_util, mcl_core, mcl_doors, mcl_stairs, mcl_signs, mcl_fences, mesecons_pressureplates, mesecons_button, mcl_boats

View File

@ -0,0 +1,264 @@
local S = minetest.get_translator(minetest.get_current_modname())
-- Logs
minetest.register_node("mcl_cherry_blossom:cherrytree", {
description = S("Cherry Log"),
_doc_items_longdesc = S("The trunk of an cherry blossom tree."),
_doc_items_hidden = false,
tiles = {"mcl_cherry_blossom_log_top.png", "mcl_cherry_blossom_log_top.png", "mcl_cherry_blossom_log.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_cherry_blossom:stripped_cherrytree",
})
minetest.register_node("mcl_cherry_blossom:stripped_cherrytree", {
description = S("Stripped Cherry Log"),
_doc_items_longdesc = S("The stripped trunk of an cherry blossom tree."),
_doc_items_hidden = false,
tiles = {"mcl_cherry_blossom_log_top_stripped.png", "mcl_cherry_blossom_log_top_stripped.png", "mcl_cherry_blossom_log_stripped.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
-- Bark
minetest.register_node("mcl_cherry_blossom:cherrytree_bark", {
description = S("Cherry Bark"),
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {"mcl_cherry_blossom_log.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_cherry_blossom:stripped_cherrytree_bark",
})
minetest.register_node("mcl_cherry_blossom:stripped_cherrytree_bark", {
description = S("Stripped Cherry Wood"),
_doc_items_longdesc = S("The stripped wood of an cherry blossom tree."),
tiles = {"mcl_cherry_blossom_log_stripped.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
--Planks
minetest.register_node("mcl_cherry_blossom:cherrywood", {
description = S("Cherry Wood Planks"),
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = {"mcl_cherry_blossom_planks.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 2,
})
-- Leaves
local stick_chances = {50, 45, 30, 35, 10}
local sapling_chances = {20, 16, 12, 10}
local function get_drops(fortune_level)
local drop = {
max_items = 1,
items = {
{
items = {"mcl_cherry_blossom:cherrysapling"},
rarity = sapling_chances[fortune_level + 1] or sapling_chances[fortune_level]
},
{
items = {"mcl_core:stick 1"},
rarity = stick_chances[fortune_level + 1]
},
{
items = {"mcl_core:stick 2"},
rarity = stick_chances[fortune_level + 1]
},
}
}
return drop
end
local l_def = {
description = S("Cherry Leaves"),
_doc_items_longdesc = S("Cherry blossom leaves are grown from cherry blossom trees."),
_doc_items_hidden = false,
drawtype = "allfaces_optional",
waving = 2,
tiles = {"mcl_cherry_blossom_leaves.png"},
color = color,
paramtype = "light",
stack_max = 64,
groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
leaves = 1, deco_block = 1, compostability = 30
},
drop = get_drops(0),
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
after_place_node = function(pos)
mcl_core.make_player_leaves(pos) -- Leaves placed by the player should always be player leaves.
end,
}
minetest.register_node("mcl_cherry_blossom:cherryleaves", l_def)
local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false
o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_cherry_blossom:cherryleaves"}
o_def._mcl_silk_touch_drop = {"mcl_cherry_blossom:cherryleaves"}
minetest.register_node("mcl_cherry_blossom:cherryleaves" .. "_orphan", o_def)
-- Sapling
minetest.register_node("mcl_cherry_blossom:cherrysapling", {
description = S("Cherry Sapling"),
_tt_help = tt_help,
_doc_items_longdesc = S("Cherry blossom sapling can be planted to grow cherry trees"),
_doc_items_hidden = false,
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {"mcl_cherry_blossom_sapling.png"},
inventory_image = "mcl_cherry_blossom_sapling.png",
wield_image = "mcl_cherry_blossom_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4/16, -0.5, -4/16, 4/16, 0.25, 4/16}
},
stack_max = 64,
groups = {
plant = 1, sapling = 1, attached_node = 1,
deco_block = 1, dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
destroy_by_lava_flow = 1, compostability = 30
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
--local meta = minetest.get_meta(pos)
--meta:set_int("stage", 0)
-- TODO Uncomment above when wood api is implemented with the current mcl_core tree growth code.
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return minetest.get_item_group(nn, "grass_block") == 1 or
nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or
nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt"
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
-- Door and Trapdoor
mcl_doors:register_door("mcl_cherry_blossom:cherrydoor", {
description = S("Cherry Door"),
_doc_items_longdesc = S("Wooden doors are 2-block high barriers which can be opened or closed by hand and by a redstone signal."),
_doc_items_usagehelp = S("To open or close a wooden door, rightclick it or supply its lower half with a redstone signal."),
inventory_image = "mcl_cherry_blossom_door_inv.png",
groups = {handy=1,axey=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
tiles_bottom = {"mcl_cherry_blossom_door_bottom.png", "mcl_cherry_blossom_door_side_bottom.png"},
tiles_top = {"mcl_cherry_blossom_door_top.png", "mcl_cherry_blossom_door_side_top.png"},
sounds = mcl_sounds.node_sound_wood_defaults(),
})
mcl_doors:register_trapdoor("mcl_cherry_blossom:cherrytrapdoor", {
description = S("Cherry Trapdoor"),
_doc_items_longdesc = S("Wooden trapdoors are horizontal barriers which can be opened and closed by hand or a redstone signal. They occupy the upper or lower part of a block, depending on how they have been placed. When open, they can be climbed like a ladder."),
_doc_items_usagehelp = S("To open or close the trapdoor, rightclick it or send a redstone signal to it."),
tile_front = "mcl_cherry_blossom_trapdoor.png",
tile_side = "mcl_cherry_blossom_trapdoor_side.png",
wield_image = "mcl_cherry_blossom_trapdoor.png",
groups = {handy=1,axey=1, mesecon_effector_on=1, material_wood=1, flammable=-1},
_mcl_hardness = 3,
_mcl_blast_resistance = 3,
sounds = mcl_sounds.node_sound_wood_defaults(),
})
-- Stairs and Slabs
mcl_stairs.register_stair("cherrywood", "mcl_cherry_blossom:cherrywood",
{handy=1,axey=1, flammable=3,wood_stairs=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{"mcl_cherry_blossom_planks.png"},
S("Cherry Stairs"),
mcl_sounds.node_sound_wood_defaults(), 3, 2,
"woodlike")
mcl_stairs.register_slab("cherrywood", "mcl_cherry_blossom:cherrywood",
{handy=1,axey=1, flammable=3,wood_slab=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
{"mcl_cherry_blossom_planks.png"},
S("Cherry Slab"),
mcl_sounds.node_sound_wood_defaults(), 3, 2,
S("Double Cherry Slab"))
-- Signs
mcl_signs.register_sign_custom("mcl_cherry_blossom", "cherrywood",
"mcl_cherry_blossom_sign.png", nil,
"mcl_cherry_blossom_sign_inv.png", "mcl_cherry_blossom_sign_inv.png", "Cherry Sign")
-- Fences & Gates
mcl_fences.register_fence_and_fence_gate("cherry_fence", S("Cherry Fence"), S("Cherry Gate"),
"mcl_cherry_blossom_planks.png", {handy=1, axey=1, flammable=2, fence_wood=1, fire_encouragement=5, fire_flammability=20}, 2, 15,
{"group:fence_wood"}, mcl_sounds.node_sound_wood_defaults())
-- Redstone
mesecon.register_pressure_plate(
"mcl_cherry_blossom:pressure_plate_cherrywood",
S("Cherry Pressure Plate"),
{"mcl_cherry_blossom_planks.png"},
{"mcl_cherry_blossom_planks.png"},
"mcl_cherry_blossom_planks.png",
nil,
{{"mcl_cherry_blossom:cherrywood", "mcl_cherry_blossom:cherrywood"}},
mcl_sounds.node_sound_wood_defaults(),
{axey=1, material_wood=1},
nil,
S("A wooden pressure plate is a redstone component which supplies its surrounding blocks with redstone power while any movable object (including dropped items, players and mobs) rests on top of it."))
mesecon.register_button(
"cherrywood",
S("Cherry Button"),
"mcl_cherry_blossom_planks.png",
"mcl_cherry_blossom:cherrywood",
mcl_sounds.node_sound_wood_defaults(),
{material_wood=1,handy=1,axey=1},
1.5,
true,
S("A wooden button is a redstone component made out of wood which can be pushed to provide redstone power. When pushed, it powers adjacent redstone components for 1.5 seconds. Wooden buttons may also be pushed by arrows."),
"mesecons_button_push_wood")

View File

@ -89,6 +89,7 @@ local loottable =
items = {
{ itemstring = "mcl_farming:wheat_item", weight = 20, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:bread", weight = 20 },
{ itemstring = "mcl_cherry_blossom:cherrysapling", weight = 15, amount_min = 1, amount_max = 4 }, -- FIXME: Remove when cherry blossom map generation is implemented.
{ itemstring = "mcl_core:coal_lump", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mesecons:redstone", weight = 15, amount_min = 1, amount_max = 4 },
{ itemstring = "mcl_farming:beetroot_seeds", weight = 10, amount_min = 2, amount_max = 4 },

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB