update moretrees and plantlife (upstream vines mod updated, + bugfix)

This commit is contained in:
Vanessa Ezekowitz 2017-03-30 23:20:05 -04:00
parent e932a8478a
commit 2fa2867eb7
7 changed files with 35 additions and 27 deletions

@ -337,7 +337,6 @@ minetest.override_item("moretrees:poplar_leaves", {
}
})
-- Extra nodes for jungle trees:
local jungleleaves = {"yellow","red"}
@ -362,7 +361,7 @@ for color = 1, #jungleleaves do
inventory_image = moretrees_leaves_inventory_image,
paramtype = "light",
is_ground_content = false,
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = moretrees.leafdecay_radius },
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 3 },
drop = {
max_items = 1,
items = {
@ -374,6 +373,18 @@ for color = 1, #jungleleaves do
})
end
-- To get Moretrees to generate its own jungle trees among the default mapgen
-- we need our own copy of that node, which moretrees will match against.
local jungle_tree = table.copy(minetest.registered_nodes["default:jungletree"])
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
default.register_leafdecay({
trunks = { "default:jungletree", "moretrees:jungletree_trunk" },
leaves = { "default:jungleleaves", "moretrees:jungletree_leaves_yellow", "moretrees:jungletree_leaves_red" },
radius = moretrees.leafdecay_radius,
})
-- Extra needles for firs
local moretrees_leaves_inventory_image = nil
@ -391,7 +402,7 @@ minetest.register_node("moretrees:fir_leaves_bright", {
inventory_image = moretrees_leaves_inventory_image,
paramtype = "light",
is_ground_content = false,
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = moretrees.leafdecay_radius },
groups = {snappy = 3, flammable = 2, leaves = 1, moretrees_leaves = 1, leafdecay = 3 },
drop = {
max_items = 1,
items = {
@ -402,6 +413,13 @@ minetest.register_node("moretrees:fir_leaves_bright", {
sounds = default.node_sound_leaves_defaults()
})
default.register_leafdecay({
trunks = { "moretrees:fir_trunk" },
leaves = { "moretrees:fir_leaves", "moretrees:fir_leaves_bright" },
radius = moretrees.leafdecay_radius,
})
if moretrees.enable_redefine_apple then
local appledef = moretrees.clone_node("default:apple")
appledef.groups.attached_node = 1
@ -449,12 +467,6 @@ minetest.register_abm({
end,
})
-- To get Moretrees to generate its own jungle trees among the default mapgen
-- we need our own copy of that node, which moretrees will match against.
local jungle_tree = moretrees.clone_node("default:jungletree")
minetest.register_node("moretrees:jungletree_trunk", jungle_tree)
-- For compatibility with old nodes, recently-changed nodes, and default nodes
minetest.register_alias("technic:rubber_tree_full", "moretrees:rubber_tree_trunk")

@ -47,7 +47,7 @@ table.
|description| string|The vine's tooltip description|
|average_length|int| The average length of vines|
For biome definitions please see the [biome_lib API documentation](https://github.com/VanessaE/biome_lib/blob/master/API.txt)
For biome definitions please see the [plants_lib API documentation](https://github.com/VanessaE/plantlife_modpack/blob/master/API.txt)
## Notice
Vines use after_destruct on registered leave nodes to remove vines from which

@ -1,5 +1,4 @@
vines.register_vine = function( name, defs, biome )
local biome = biome
local groups = { vines=1, snappy=3, flammable=2 }
local vine_name_end = 'vines:'..name..'_end'
@ -61,7 +60,6 @@ vines.register_vine = function( name, defs, biome )
end
})
minetest.register_node( vine_name_middle, {
description = "Matured "..defs.description,
walkable = false,
@ -79,12 +77,9 @@ vines.register_vine = function( name, defs, biome )
sounds = default.node_sound_leaves_defaults(),
selection_box = selection_box,
on_destruct = function( pos )
local node = minetest.get_node( pos )
local bottom = {x=pos.x, y=pos.y-1, z=pos.z}
local bottom_node = minetest.get_node( bottom )
if minetest.get_item_group( bottom_node.name, "vines") > 0 then
-- Calling `remove_node` directly would cause
-- a stack overflow for really long vines.
minetest.after( 0, minetest.remove_node, bottom )
end
end,
@ -95,12 +90,12 @@ vines.register_vine = function( name, defs, biome )
biome_lib:spawn_on_surfaces( biome )
local override_nodes = function( nodes, defs )
local function override( index, registered )
local override_nodes = function( nodes, def )
local function override( index, registered )
local node = nodes[ index ]
if index > #nodes then return registered end
if minetest.registered_nodes[node] then
minetest.override_item( node, defs )
minetest.override_item( node, def )
registered[#registered+1] = node
end
override( index+1, registered )
@ -109,7 +104,7 @@ vines.register_vine = function( name, defs, biome )
end
override_nodes( biome.spawn_surfaces,{
after_destruct = function( pos )
on_destruct = function( pos )
local pos_min = { x = pos.x -1, y = pos.y - 1, z = pos.z - 1 }
local pos_max = { x = pos.x +1, y = pos.y + 1, z = pos.z + 1 }
local positions = minetest.find_nodes_in_area( pos_min, pos_max, "group:vines" )
@ -125,7 +120,7 @@ vines.dig_vine = function( pos, node_name, user )
--only dig give the vine if shears are used
if not user then return false end
local wielded = user:get_wielded_item()
if 'vines:shears' == wielded:get_name() then
if 'vines:shears' == wielded:get_name() then
local inv = user:get_inventory()
if inv then
inv:add_item("main", ItemStack( node_name ))

@ -58,7 +58,7 @@ minetest.register_node("vines:rope_end", {
groups = {flammable=2, not_in_creative_inventory=1},
sounds = default.node_sound_leaves_defaults(),
after_place_node = function(pos)
yesh = {x = pos.x, y= pos.y-1, z=pos.z}
local yesh = {x = pos.x, y= pos.y-1, z=pos.z}
minetest.add_node(yesh, {name="vines:rope"})
end,
selection_box = {

@ -1,12 +1,12 @@
vines.recipes['rope_block'] = {
{'', 'default:wood', ''},
{'', 'group:wood', ''},
{'', 'group:vines', ''},
{'', 'group:vines', ''}
}
vines.recipes['shears'] = {
{'', 'default:steel_ingot', ''},
{'default:stick', 'default:wood', 'default:steel_ingot'},
{'', '', 'default:stick'}
{'group:stick', 'group:wood', 'default:steel_ingot'},
{'', '', 'group:stick'}
}

@ -8,8 +8,8 @@ minetest.register_tool("vines:shears", {
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
snappy={times={[3]=0.2}, maxwear=0.05, maxlevel=3},
wool={times={[3]=0.2}, maxwear=0.05, maxlevel=3}
snappy={times={[3]=0.2}, uses=60, maxlevel=3},
wool={times={[3]=0.2}, uses=60, maxlevel=3}
}
},
})

@ -26,6 +26,7 @@ vines.register_vine( 'vine', {
spawn_delay = 500,
spawn_chance = 100,
spawn_surfaces = {
"default:leaves",
"default:jungleleaves",
"moretrees:jungletree_leaves_red",
"moretrees:jungletree_leaves_yellow",
@ -42,11 +43,11 @@ vines.register_vine( 'side', {
},{
choose_random_wall = true,
avoid_nodes = {"group:vines", "default:apple"},
choose_random_wall = true,
avoid_radius = 3,
spawn_delay = 500,
spawn_chance = 100,
spawn_surfaces = {
"default:leaves",
"default:jungleleaves",
"moretrees:jungletree_leaves_red",
"moretrees:jungletree_leaves_yellow",