Merge branch 'development'
- API update. No longer uses ABM's except for the ones that are used in plants_lib ( performance increase ) - New jungle vine that spawns on jungle trunks/tree - Code reordering, file renaming an overall more structured and DRY-er approach. Conflicts: README.md
4
LICENSE.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
License
|
||||||
|
=======
|
||||||
|
- Code WTFPL
|
||||||
|
- Texture CC
|
50
README.md
@ -1,3 +1,47 @@
|
|||||||
Vines
|
# Vines
|
||||||
=====
|
|
||||||
Vines and ropebox for minetest
|
## Features
|
||||||
|
- Rope block for spawning rope that slowly drops into the deep.
|
||||||
|
- Vines are climbable and slowly grow downward.
|
||||||
|
- Shears that allow the collecting of vines.
|
||||||
|
- Spawns vines on jungletree leaves.
|
||||||
|
- Roots on the bottom of dirt and dirt with grass nodes.
|
||||||
|
- Spawns vines on trees located in swampy area.
|
||||||
|
- Jungle vines that spawn on the side of jungletrees
|
||||||
|
|
||||||
|
## API
|
||||||
|
The API is very minimal. It allows the registering of vines.
|
||||||
|
|
||||||
|
There are two types of vines. One that spawns at the bottom of nodes and uses the
|
||||||
|
plantlike drawtype, and vines that spawn on the side that use signlike
|
||||||
|
drawtype.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
*taken from mod*
|
||||||
|
|
||||||
|
```lua
|
||||||
|
|
||||||
|
vines.register_vine( name, definitions, biome )
|
||||||
|
|
||||||
|
--e.g.
|
||||||
|
|
||||||
|
vines.register_vine( 'vine', {
|
||||||
|
description = "Vines",
|
||||||
|
average_length = 9
|
||||||
|
}, biome )
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
### definitions
|
||||||
|
|key| type| description|
|
||||||
|
|---| ---| ---|
|
||||||
|
|description| string|The vine's tooltip description|
|
||||||
|
|average_length|int| The average length of vines|
|
||||||
|
|
||||||
|
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
|
||||||
|
the leaves are removed. This is done by using the override function.
|
||||||
|
Malfunctions may occur if other mods override the after_destruct of these nodes
|
||||||
|
also.
|
||||||
|
14
crafts.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
minetest.register_craft({
|
||||||
|
output = 'vines:rope_block',
|
||||||
|
recipe = vines.recipes['rope_block']
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = 'vines:shears',
|
||||||
|
recipe = vines.recipes['shears']
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craftitem("vines:vines", {
|
||||||
|
description = "Vines",
|
||||||
|
inventory_image = "vines_item.png",
|
||||||
|
})
|
@ -1,2 +1,3 @@
|
|||||||
default
|
default
|
||||||
plants_lib
|
plants_lib
|
||||||
|
moretrees?
|
||||||
|
129
functions.lua
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
vines.register_vine = function( name, defs, biome )
|
||||||
|
--different properties for bottom and side vines.
|
||||||
|
local drop_node = 'vines:'..name
|
||||||
|
local drawtype = ''
|
||||||
|
local selection_box
|
||||||
|
if ( biome.spawn_on_side ) then
|
||||||
|
selection_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
}
|
||||||
|
drawtype = 'signlike'
|
||||||
|
else
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = { -0.4, -1/2, -0.4, 0.4, 1/2, 0.4 },
|
||||||
|
}
|
||||||
|
drawtype = 'plantlike'
|
||||||
|
end
|
||||||
|
|
||||||
|
biome.spawn_plants = { "vines:"..name }
|
||||||
|
|
||||||
|
minetest.register_node( "vines:"..name, {
|
||||||
|
description = defs.description,
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
wield_image = "vines_"..name..".png",
|
||||||
|
drop = "",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
buildable_to = true,
|
||||||
|
tile_images = { "vines_"..name..".png" },
|
||||||
|
drawtype = drawtype,
|
||||||
|
inventory_image = "vines_"..name..".png",
|
||||||
|
groups = vines.groups,
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = selection_box,
|
||||||
|
on_construct = function( pos )
|
||||||
|
local timer = minetest.get_node_timer( pos )
|
||||||
|
timer:start( math.random(5, 10) )
|
||||||
|
end,
|
||||||
|
on_timer = 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 bottom_node.name == "air" then
|
||||||
|
if not ( math.random( defs.average_length ) == 1 ) then
|
||||||
|
minetest.set_node( pos, { name = node.name..'_rotten', param2 = node.param2 } )
|
||||||
|
minetest.set_node( bottom, { name = node.name, param2 = node.param2 } )
|
||||||
|
local timer = minetest.get_node_timer( bottom_node )
|
||||||
|
timer:start( math.random(5, 10) )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos, node, oldmetadata, user)
|
||||||
|
vines.dig_vine( pos, drop_node, user )
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
local name = name..'_rotten'
|
||||||
|
|
||||||
|
minetest.register_node( "vines:"..name, {
|
||||||
|
description = "Rotten "..defs.description,
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
drop = "",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted",
|
||||||
|
buildable_to = true,
|
||||||
|
tile_images = { "vines_"..name..".png" },
|
||||||
|
wield_image = "vines_"..name..".png",
|
||||||
|
drawtype = drawtype,
|
||||||
|
inventory_image = "vines_"..name..".png",
|
||||||
|
groups = vines.groups,
|
||||||
|
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") then
|
||||||
|
minetest.remove_node( bottom )
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
after_dig_node = function( pos, node, oldmetadata, user )
|
||||||
|
vines.dig_vine( pos, drop_node, user )
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
plantslib:spawn_on_surfaces( biome )
|
||||||
|
|
||||||
|
local override_nodes = function( nodes, defs )
|
||||||
|
function override( index, registered )
|
||||||
|
local node = nodes[ index ]
|
||||||
|
if index > #nodes then return registered end
|
||||||
|
if minetest.registered_nodes[node] then
|
||||||
|
print('overiding: '..node)
|
||||||
|
minetest.override_item( node, defs )
|
||||||
|
registered[#registered+1] = node
|
||||||
|
end
|
||||||
|
override( index+1, registered )
|
||||||
|
end
|
||||||
|
override( 1, {} )
|
||||||
|
end
|
||||||
|
|
||||||
|
override_nodes( biome.spawn_surfaces,{
|
||||||
|
after_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
|
||||||
|
minetest.remove_node( position )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
local inv = user:get_inventory()
|
||||||
|
if inv then
|
||||||
|
inv:add_item("main", ItemStack( node_name ))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
404
init.lua
@ -1,397 +1,15 @@
|
|||||||
vines = {}
|
vines = {
|
||||||
|
name = 'vines',
|
||||||
local mod_name = "vines"
|
groups = { vines=1, snappy=3, flammable=2 },
|
||||||
local average_height = 12
|
recipes = {}
|
||||||
local spawn_interval = 90
|
|
||||||
local vines_group = {attached_node=1,vines=1,snappy=3,flammable=2,hanging_node=1,vines_cleanup=1}
|
|
||||||
|
|
||||||
vines.growth_interval = 300
|
|
||||||
vines.growth_chance = 2
|
|
||||||
vines.rot_interval = 300
|
|
||||||
vines.rot_chance = 8
|
|
||||||
|
|
||||||
local jungle_leaves_list = {
|
|
||||||
"default:jungleleaves",
|
|
||||||
"moretrees:jungle_leaves_red",
|
|
||||||
"moretrees:jungle_leaves_yellow",
|
|
||||||
"moretrees:jungle_leaves_green"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Nodes
|
dofile( minetest.get_modpath( vines.name ) .. "/functions.lua" )
|
||||||
minetest.register_node("vines:rope_block", {
|
dofile( minetest.get_modpath( vines.name ) .. "/recipes.lua" )
|
||||||
description = "Rope",
|
dofile( minetest.get_modpath( vines.name ) .. "/crafts.lua" )
|
||||||
sunlight_propagates = true,
|
dofile( minetest.get_modpath( vines.name ) .. "/nodes.lua" )
|
||||||
paramtype = "light",
|
dofile( minetest.get_modpath( vines.name ) .. "/shear.lua" )
|
||||||
tile_images = {
|
dofile( minetest.get_modpath( vines.name ) .. "/vines.lua" )
|
||||||
"default_wood.png^vines_rope.png",
|
dofile( minetest.get_modpath( vines.name ) .. "/spawning.lua" )
|
||||||
"default_wood.png^vines_rope.png",
|
|
||||||
"default_wood.png",
|
|
||||||
"default_wood.png",
|
|
||||||
"default_wood.png^vines_rope.png",
|
|
||||||
"default_wood.png^vines_rope.png",
|
|
||||||
},
|
|
||||||
drawtype = "cube",
|
|
||||||
groups = {choppy=2,oddly_breakable_by_hand=1},
|
|
||||||
after_place_node = function(pos)
|
|
||||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
|
||||||
local n = minetest.get_node(p)
|
|
||||||
if n.name == "air" then
|
|
||||||
minetest.add_node(p, {name="vines:rope_end"})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos, node, digger)
|
|
||||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
|
||||||
local n = minetest.get_node(p)
|
|
||||||
while n.name == 'vines:rope' do
|
|
||||||
minetest.remove_node(p)
|
|
||||||
p = {x=p.x, y=p.y-1, z=p.z}
|
|
||||||
n = minetest.get_node(p)
|
|
||||||
end
|
|
||||||
if n.name == 'vines:rope_end' then
|
|
||||||
minetest.remove_node(p)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:rope", {
|
|
||||||
description = "Rope",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
drop = "",
|
|
||||||
tile_images = { "vines_rope.png" },
|
|
||||||
drawtype = "plantlike",
|
|
||||||
groups = {flammable=2, not_in_creative_inventory=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
|
||||||
},
|
|
||||||
on_destruct = function()
|
|
||||||
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:rope_end", {
|
|
||||||
description = "Rope",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
drop = "",
|
|
||||||
tile_images = { "vines_rope_end.png" },
|
|
||||||
drawtype = "plantlike",
|
|
||||||
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}
|
|
||||||
minetest.add_node(yesh, {name="vines:rope"})
|
|
||||||
end,
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:side", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drop = "",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_side.png" },
|
|
||||||
drawtype = "signlike",
|
|
||||||
inventory_image = "vines_side.png",
|
|
||||||
groups = vines_group,
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
|
||||||
local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end
|
|
||||||
if 'vines:shears' == wielded:get_name() then
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
if inv then
|
|
||||||
inv:add_item("main", ItemStack(oldnode.name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:side_rotten", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = false,
|
|
||||||
drop = "",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_side_rotten.png" },
|
|
||||||
drawtype = "signlike",
|
|
||||||
inventory_image = "vines_side.png",
|
|
||||||
groups = {snappy = 3,flammable=2, hanging_node=1,vines_cleanup=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:willow", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drop = "",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_willow.png" },
|
|
||||||
drawtype = "signlike",
|
|
||||||
inventory_image = "vines_willow.png",
|
|
||||||
groups = vines_group,
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
|
||||||
local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end
|
|
||||||
if 'vines:shears' == wielded:get_name() then
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
if inv then
|
|
||||||
inv:add_item("main", ItemStack(oldnode.name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:willow_rotten", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = false,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
drop = "",
|
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_willow_rotten.png" },
|
|
||||||
drawtype = "signlike",
|
|
||||||
inventory_image = "vines_willow.png",
|
|
||||||
groups = {snappy = 3,flammable=2, hanging_node=1,vines_cleanup=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "wallmounted",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:root", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_root.png" },
|
|
||||||
drawtype = "plantlike",
|
|
||||||
inventory_image = "vines_root.png",
|
|
||||||
groups = {vines=1,snappy = 3,flammable=2, hanging_node=1,vines_cleanup=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:vine", {
|
|
||||||
description = "Vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
drop = "",
|
|
||||||
paramtype = "light",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_vine.png" },
|
|
||||||
drawtype = "plantlike",
|
|
||||||
inventory_image = "vines_vine.png",
|
|
||||||
groups = vines_group,
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.3, -1/2, -0.3, 0.3, 1/2, 0.3},
|
|
||||||
},
|
|
||||||
after_dig_node = function(pos, oldnode, oldmetadata, user)
|
|
||||||
local wielded if user:get_wielded_item() ~= nil then wielded = user:get_wielded_item() else return end
|
|
||||||
if 'vines:shears' == wielded:get_name() then
|
|
||||||
local inv = user:get_inventory()
|
|
||||||
if inv then
|
|
||||||
inv:add_item("main", ItemStack(oldnode.name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_node("vines:vine_rotten", {
|
|
||||||
description = "Rotten vine",
|
|
||||||
walkable = false,
|
|
||||||
climbable = true,
|
|
||||||
drop = "",
|
|
||||||
sunlight_propagates = true,
|
|
||||||
paramtype = "light",
|
|
||||||
buildable_to = true,
|
|
||||||
tile_images = { "vines_vine_rotten.png" },
|
|
||||||
drawtype = "plantlike",
|
|
||||||
inventory_image = "vines_vine_rotten.png",
|
|
||||||
groups = {snappy = 3,flammable=2, hanging_node=1,vines_cleanup=1},
|
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
|
||||||
selection_box = {
|
|
||||||
type = "fixed",
|
|
||||||
fixed = {-0.3, -1/2, -0.3, 0.3, 1/2, 0.3},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- vine rotting
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"vines:vine", "vines:side", "vines:willow"},
|
|
||||||
interval = vines.rot_interval,
|
|
||||||
chance = vines.rot_chance,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
if minetest.find_node_near(pos, 5, "group:tree") == nil then
|
|
||||||
local walldir = node.param2
|
|
||||||
minetest.add_node(pos, {name=node.name.."_rotten", param2 = walldir})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- vine growth
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"vines:vine", "vines:side", "vines:willow"},
|
|
||||||
interval = vines.growth_interval,
|
|
||||||
chance = vines.growth_chance,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
|
||||||
local n = minetest.get_node(p)
|
|
||||||
if n.name == "air" then
|
|
||||||
local walldir = node.param2
|
|
||||||
minetest.add_node(p, {name=node.name, param2 = walldir})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- cleanup if the initial tree is missing entirely (e.g. has been dug away)
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"group:vines_cleanup"},
|
|
||||||
interval = 10,
|
|
||||||
chance = 5,
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
if not minetest.find_node_near(pos, 1, jungle_leaves_list) then
|
|
||||||
local p_top = {x=pos.x, y=pos.y+1, z=pos.z}
|
|
||||||
if minetest.get_item_group(minetest.get_node(p_top).name, "vines_cleanup") == 0 then
|
|
||||||
minetest.remove_node(pos)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
-- rope extension
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"vines:rope_end"},
|
|
||||||
interval = 1,
|
|
||||||
chance = 1,
|
|
||||||
drop = "",
|
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
|
||||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
|
||||||
local n = minetest.get_node(p)
|
|
||||||
--remove if top node is removed
|
|
||||||
if n.name == "air" then
|
|
||||||
minetest.set_node(pos, {name="vines:rope"})
|
|
||||||
minetest.add_node(p, {name="vines:rope_end"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
})
|
|
||||||
--Craft
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'vines:rope_block',
|
|
||||||
recipe = {
|
|
||||||
{'', 'default:wood', ''},
|
|
||||||
{'', 'vines:side', ''},
|
|
||||||
{'', 'vines:side', ''},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craftitem("vines:vines", {
|
|
||||||
description = "Vines",
|
|
||||||
inventory_image = "vines_item.png",
|
|
||||||
})
|
|
||||||
--spawning
|
|
||||||
plantslib:spawn_on_surfaces({
|
|
||||||
avoid_nodes = {"vines:vine"},
|
|
||||||
avoid_radius = 5,
|
|
||||||
spawn_delay = spawn_interval,
|
|
||||||
spawn_plants = {"vines:vine"},
|
|
||||||
spawn_chance = 10,
|
|
||||||
spawn_surfaces = {"default:dirt_with_grass","default:dirt"},
|
|
||||||
spawn_on_bottom = true,
|
|
||||||
plantlife_limit = -0.9,
|
|
||||||
})
|
|
||||||
|
|
||||||
plantslib:spawn_on_surfaces({
|
|
||||||
avoid_nodes = {"vines:vine", "vines:side"},
|
|
||||||
avoid_radius = 3,
|
|
||||||
spawn_delay = spawn_interval,
|
|
||||||
spawn_plants = {"vines:side"},
|
|
||||||
spawn_chance = 10,
|
|
||||||
spawn_surfaces = jungle_leaves_list,
|
|
||||||
spawn_on_side = true,
|
|
||||||
near_nodes = {"default:jungletree"},
|
|
||||||
near_nodes_size = 5,
|
|
||||||
plantlife_limit = -0.9,
|
|
||||||
})
|
|
||||||
|
|
||||||
plantslib:spawn_on_surfaces({
|
|
||||||
spawn_plants = {"vines:willow"},
|
|
||||||
spawn_delay = spawn_interval,
|
|
||||||
spawn_chance = 3,
|
|
||||||
spawn_surfaces = {"moretrees:willow_leaves"},
|
|
||||||
spawn_on_side = true,
|
|
||||||
near_nodes = {"default:water_source"},
|
|
||||||
near_nodes_size = 2,
|
|
||||||
near_nodes_vertical = 5,
|
|
||||||
near_nodes_count = 1,
|
|
||||||
plantlife_limit = -0.9,
|
|
||||||
})
|
|
||||||
|
|
||||||
--Shears jojoa1997's shears
|
|
||||||
minetest.register_tool("vines:shears", {
|
|
||||||
description = "Shears",
|
|
||||||
inventory_image = "shears.png",
|
|
||||||
wield_image = "shears.png",
|
|
||||||
stack_max = 1,
|
|
||||||
max_drop_level=3,
|
|
||||||
tool_capabilities = {
|
|
||||||
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}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'vines:shears',
|
|
||||||
recipe = {
|
|
||||||
{'', 'default:steel_ingot', ''},
|
|
||||||
{'default:stick', 'default:wood', 'default:steel_ingot'},
|
|
||||||
{'', '', 'default:stick'},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
print("[Vines] Loaded!")
|
print("[Vines] Loaded!")
|
||||||
|
83
nodes.lua
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
minetest.register_node("vines:rope_block", {
|
||||||
|
description = "Rope",
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
tile_images = {
|
||||||
|
"default_wood.png^vines_rope.png",
|
||||||
|
"default_wood.png^vines_rope.png",
|
||||||
|
"default_wood.png",
|
||||||
|
"default_wood.png",
|
||||||
|
"default_wood.png^vines_rope.png",
|
||||||
|
"default_wood.png^vines_rope.png",
|
||||||
|
},
|
||||||
|
groups = { flammable=2, choppy=2, oddly_breakable_by_hand=1 },
|
||||||
|
after_place_node = function(pos)
|
||||||
|
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
local n = minetest.get_node(p)
|
||||||
|
if n.name == "air" then
|
||||||
|
minetest.add_node(p, {name="vines:rope_end"})
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
after_dig_node = function(pos, node, digger)
|
||||||
|
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
local n = minetest.get_node(p)
|
||||||
|
while ( n.name == 'vines:rope' or n.name == 'vines:rope_end' ) do
|
||||||
|
minetest.remove_node(p)
|
||||||
|
p = {x=p.x, y=p.y-1, z=p.z}
|
||||||
|
n = minetest.get_node(p)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("vines:rope", {
|
||||||
|
description = "Rope",
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
drop = "",
|
||||||
|
tile_images = { "vines_rope.png" },
|
||||||
|
drawtype = "plantlike",
|
||||||
|
groups = {flammable=2, not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("vines:rope_end", {
|
||||||
|
description = "Rope",
|
||||||
|
walkable = false,
|
||||||
|
climbable = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
paramtype = "light",
|
||||||
|
drop = "",
|
||||||
|
tile_images = { "vines_rope_end.png" },
|
||||||
|
drawtype = "plantlike",
|
||||||
|
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}
|
||||||
|
minetest.add_node(yesh, {name="vines:rope"})
|
||||||
|
end,
|
||||||
|
selection_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||||
|
},
|
||||||
|
on_construct = function( pos )
|
||||||
|
local timer = minetest.get_node_timer( pos )
|
||||||
|
timer:start( 1 )
|
||||||
|
end,
|
||||||
|
on_timer = function( pos, elapsed )
|
||||||
|
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
local n = minetest.get_node(p)
|
||||||
|
if n.name == "air" then
|
||||||
|
minetest.set_node(pos, {name="vines:rope"})
|
||||||
|
minetest.add_node(p, {name="vines:rope_end"})
|
||||||
|
else
|
||||||
|
local timer = minetest.get_node_timer( pos )
|
||||||
|
timer:start( 1 )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
12
recipes.lua
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
vines.recipes['rope_block'] = {
|
||||||
|
{'', 'default:wood', ''},
|
||||||
|
{'', 'vines:side', ''},
|
||||||
|
{'', 'vines:side', ''}
|
||||||
|
}
|
||||||
|
|
||||||
|
vines.recipes['shears'] = {
|
||||||
|
{'', 'default:steel_ingot', ''},
|
||||||
|
{'default:stick', 'default:wood', 'default:steel_ingot'},
|
||||||
|
{'', '', 'default:stick'}
|
||||||
|
}
|
||||||
|
|
15
shear.lua
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
minetest.register_tool("vines:shears", {
|
||||||
|
description = "Shears",
|
||||||
|
inventory_image = "shears.png",
|
||||||
|
wield_image = "shears.png",
|
||||||
|
stack_max = 1,
|
||||||
|
max_drop_level=3,
|
||||||
|
tool_capabilities = {
|
||||||
|
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}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
Before Width: | Height: | Size: 233 B |
Before Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 223 B |
BIN
textures/vines_jungle.png
Normal file
After Width: | Height: | Size: 497 B |
BIN
textures/vines_jungle_rotten.png
Normal file
After Width: | Height: | Size: 481 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 233 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 187 B After Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 196 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 196 B |
102
vines.lua
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
vines.register_vine( 'root', {
|
||||||
|
description = "Roots",
|
||||||
|
average_length = 9,
|
||||||
|
},{
|
||||||
|
avoid_nodes = {"vines:root_rotten"},
|
||||||
|
avoid_radius = 5,
|
||||||
|
spawn_delay = 500,
|
||||||
|
spawn_chance = 10,
|
||||||
|
spawn_surfaces = {
|
||||||
|
"default:dirt_with_grass",
|
||||||
|
"default:dirt"
|
||||||
|
},
|
||||||
|
spawn_on_bottom = true,
|
||||||
|
plantlife_limit = -0.1,
|
||||||
|
temp_max = -0.6,
|
||||||
|
temp_min = 0.2,
|
||||||
|
humidity_max = -0.7,
|
||||||
|
humidity_min = 0.2,
|
||||||
|
})
|
||||||
|
|
||||||
|
vines.register_vine( 'vine', {
|
||||||
|
description = "Vines",
|
||||||
|
average_length = 5,
|
||||||
|
},{
|
||||||
|
avoid_nodes = {"group:vines"},
|
||||||
|
avoid_radius = 5,
|
||||||
|
spawn_delay = 500,
|
||||||
|
spawn_chance = 100,
|
||||||
|
spawn_surfaces = {
|
||||||
|
"default:leaves",
|
||||||
|
"default:jungleleave",
|
||||||
|
"moretrees:jungetree_leaves_red",
|
||||||
|
"moretrees:jungetree_leaves_yellow",
|
||||||
|
"moretrees:jungetree_leaves_green"
|
||||||
|
},
|
||||||
|
spawn_on_bottom = true,
|
||||||
|
plantlife_limit = -0.9,
|
||||||
|
humidity_max = -1,
|
||||||
|
humidity_min = 0.8,
|
||||||
|
temp_max = -0.5,
|
||||||
|
temp_min = 0.3,
|
||||||
|
})
|
||||||
|
|
||||||
|
vines.register_vine( 'side', {
|
||||||
|
description = "Vines",
|
||||||
|
average_length = 7,
|
||||||
|
},{
|
||||||
|
avoid_nodes = {"group:vines"},
|
||||||
|
avoid_radius = 5,
|
||||||
|
spawn_delay = 500,
|
||||||
|
spawn_chance = 100,
|
||||||
|
spawn_surfaces = {
|
||||||
|
"default:leaves",
|
||||||
|
"default:jungleleave",
|
||||||
|
"moretrees:jungetree_leaves_red",
|
||||||
|
"moretrees:jungetree_leaves_yellow",
|
||||||
|
"moretrees:jungetree_leaves_green"
|
||||||
|
},
|
||||||
|
spawn_on_side = true,
|
||||||
|
plantlife_limit = -0.9,
|
||||||
|
humidity_max = 1,
|
||||||
|
humidity_min = 0.8,
|
||||||
|
temp_min = 0.1,
|
||||||
|
temp_max = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
vines.register_vine( 'jungle', {
|
||||||
|
description = "Jungle Vines",
|
||||||
|
average_length = 7,
|
||||||
|
},{
|
||||||
|
avoid_nodes = {"group:vines"},
|
||||||
|
avoid_radius = 5,
|
||||||
|
spawn_delay = 500,
|
||||||
|
spawn_chance = 100,
|
||||||
|
spawn_surfaces = {
|
||||||
|
"default:jungletree",
|
||||||
|
"moretrees:jungletree_trunk"
|
||||||
|
},
|
||||||
|
spawn_on_side = true,
|
||||||
|
plantlife_limit = -0.9,
|
||||||
|
humidity_max = 1,
|
||||||
|
humidity_min = 0.8,
|
||||||
|
temp_min = 0.1,
|
||||||
|
temp_max = 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
vines.register_vine( 'willow', {
|
||||||
|
description = "Willow Vines",
|
||||||
|
average_length = 9,
|
||||||
|
},{
|
||||||
|
avoid_nodes = {"vines:willow", "vines:willow_rotten"},
|
||||||
|
avoid_radius = 5,
|
||||||
|
spawn_delay = 500,
|
||||||
|
spawn_chance = 100,
|
||||||
|
spawn_surfaces = {"moretrees:willow_leaves"},
|
||||||
|
spawn_on_side = true,
|
||||||
|
plantlife_limit = -0.9,
|
||||||
|
humidity_max = 1,
|
||||||
|
humidity_min = 0.8,
|
||||||
|
temp_min = 0.1,
|
||||||
|
temp_max = 1,
|
||||||
|
})
|