update vines mod from upstream

This commit is contained in:
Vanessa Ezekowitz 2017-03-30 23:19:39 -04:00
parent 5212a756f5
commit dd14b2cb04
11 changed files with 48 additions and 18 deletions

13
vines/.luacheckrc Normal file
View File

@ -0,0 +1,13 @@
unused_args = false
read_globals = {
"minetest",
"default",
"ItemStack",
"biome_lib",
}
globals = {
"vines",
}

View File

@ -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

18
vines/bower.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "vines",
"description": "Vines that spawn on trees and rope",
"keywords": [
"vines",
"trees",
"rope",
"jungle"
],
"homepage": "https://github.com/bas080/vines/",
"screenshots": [
"https://raw.githubusercontent.com/bas080/vines/forum/screenshot.png"
],
"authors": [
"bas080"
],
"license": "WTFPL"
}

1
vines/description.txt Normal file
View File

@ -0,0 +1 @@
Adds climbable vines that are spawned on trees.

View File

@ -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 ))

2
vines/mod.conf Normal file
View File

@ -0,0 +1,2 @@
name = vines

View File

@ -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 = {

View File

@ -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'}
}

BIN
vines/screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View File

@ -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}
}
},
})

View File

@ -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",