Update vines mod

master
vlapsley 2017-08-19 20:29:06 +10:00
parent 8e67a9e7b2
commit c63ce93374
31 changed files with 95 additions and 55 deletions

13
mods/MAPGEN/vines/.luacheckrc Executable 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
mods/MAPGEN/vines/bower.json Executable 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"
}

View File

@ -1,3 +1,6 @@
-- support for i18n
local S = plantlife_i18n.gettext
minetest.register_craft({
output = 'vines:rope_block',
recipe = vines.recipes['rope_block']
@ -9,6 +12,6 @@ minetest.register_craft({
})
minetest.register_craftitem("vines:vines", {
description = "Vines",
description = S("Vines"),
inventory_image = "vines_item.png",
})

View File

@ -1,4 +1,4 @@
default
biome_lib
australia
plantlife_i18n
moretrees?

View File

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

View File

@ -1,5 +1,7 @@
-- support for i18n
local S = plantlife_i18n.gettext
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,9 +63,8 @@ vines.register_vine = function( name, defs, biome )
end
})
minetest.register_node( vine_name_middle, {
description = "Matured "..defs.description,
description = S("Matured").." "..defs.description,
walkable = false,
climbable = true,
drop = "",
@ -79,11 +80,10 @@ 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
minetest.remove_node( bottom )
if minetest.get_item_group( bottom_node.name, "vines") > 0 then
minetest.after( 0, minetest.remove_node, bottom )
end
end,
after_dig_node = function( pos, node, oldmetadata, user )
@ -93,12 +93,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 )
@ -107,14 +107,12 @@ 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" )
for index, position in pairs(positions) do
-- Calling `remove_node` directly would cause
-- a stack overflow for really long vines.
minetest.after( 0, minetest.remove_node, position )
minetest.remove_node( position )
end
end
})
@ -125,7 +123,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 ))

17
mods/MAPGEN/vines/init.lua Executable file
View File

@ -0,0 +1,17 @@
vines = {
name = 'vines',
recipes = {}
}
-- support for i18n
local S = plantlife_i18n.gettext
dofile( minetest.get_modpath( vines.name ) .. "/functions.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/aliases.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/recipes.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/crafts.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/nodes.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/shear.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/vines.lua" )
print(S("[Vines] Loaded!"))

1
mods/MAPGEN/vines/mod.conf Executable file
View File

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

View File

@ -1,5 +1,8 @@
-- support for i18n
local S = plantlife_i18n.gettext
minetest.register_node("vines:rope_block", {
description = "Rope",
description = S("Rope"),
sunlight_propagates = true,
paramtype = "light",
tiles = {
@ -30,7 +33,7 @@ minetest.register_node("vines:rope_block", {
})
minetest.register_node("vines:rope", {
description = "Rope",
description = S("Rope"),
walkable = false,
climbable = true,
sunlight_propagates = true,
@ -47,7 +50,7 @@ minetest.register_node("vines:rope", {
})
minetest.register_node("vines:rope_end", {
description = "Rope",
description = S("Rope"),
walkable = false,
climbable = true,
sunlight_propagates = true,
@ -58,7 +61,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
mods/MAPGEN/vines/screenshot.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

View File

@ -1,5 +1,8 @@
-- support for i18n
local S = plantlife_i18n.gettext
minetest.register_tool("vines:shears", {
description = "Shears",
description = S("Shears"),
inventory_image = "vines_shears.png",
wield_image = "vines_shears.png",
stack_max = 1,
@ -8,8 +11,8 @@ minetest.register_tool("vines:shears", {
full_punch_interval = 1.0,
max_drop_level=0,
groupcaps={
snappy={times={[3]=0.2}, uses=20, maxlevel=3},
wool={times={[3]=0.2}, uses=20, maxlevel=3}
snappy={times={[3]=0.2}, uses=60, maxlevel=3},
wool={times={[3]=0.2}, uses=60, maxlevel=3}
}
},
})

View File

Before

Width:  |  Height:  |  Size: 167 B

After

Width:  |  Height:  |  Size: 167 B

View File

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 497 B

View File

Before

Width:  |  Height:  |  Size: 481 B

After

Width:  |  Height:  |  Size: 481 B

View File

Before

Width:  |  Height:  |  Size: 215 B

After

Width:  |  Height:  |  Size: 215 B

View File

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 201 B

View File

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 106 B

View File

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 194 B

View File

Before

Width:  |  Height:  |  Size: 247 B

After

Width:  |  Height:  |  Size: 247 B

View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

View File

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

View File

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 187 B

View File

@ -1,6 +1,9 @@
-- support for i18n
local S = plantlife_i18n.gettext
vines.register_vine( 'root', {
description = "Roots",
average_length = 8,
description = S("Roots"),
average_length = 9,
},{
choose_random_wall = true,
avoid_nodes = {"vines:root_middle"},
@ -17,7 +20,7 @@ vines.register_vine( 'root', {
})
vines.register_vine( 'vine', {
description = "Vines",
description = S("Vines"),
average_length = 5,
},{
choose_random_wall = true,
@ -30,15 +33,15 @@ vines.register_vine( 'vine', {
},
spawn_on_bottom = true,
plantlife_limit = -0.9,
humidity_min = 0.7,
})
vines.register_vine( 'side', {
description = "Vines",
description = S("Vines"),
average_length = 6,
},{
choose_random_wall = true,
avoid_nodes = {"group:vines", "default:apple"},
choose_random_wall = true,
avoid_radius = 3,
spawn_delay = 500,
spawn_chance = 100,
@ -47,10 +50,11 @@ vines.register_vine( 'side', {
},
spawn_on_side = true,
plantlife_limit = -0.9,
humidity_min = 0.4,
})
vines.register_vine( "merbau", {
description = "Rainforest Vines",
description = S("Rainforest Vines"),
average_length = 7,
},{
choose_random_wall = true,
@ -71,3 +75,4 @@ vines.register_vine( "merbau", {
plantlife_limit = -0.9,
humidity_min = 0.2,
})

View File

@ -1,22 +0,0 @@
-----------------------------------------------------------------------------------------------
local title = "Vines"
local version = "2015-10-24"
local mname = "vines"
-----------------------------------------------------------------------------------------------
vines = {
name = 'vines',
recipes = {}
}
dofile( minetest.get_modpath( vines.name ) .. "/functions.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/aliases.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/recipes.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/crafts.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/nodes.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/shear.lua" )
dofile( minetest.get_modpath( vines.name ) .. "/vines.lua" )
-----------------------------------------------------------------------------------------------
minetest.log("MOD: "..title.." ["..version.."] ["..mname.."] loaded...")
-----------------------------------------------------------------------------------------------

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 196 B