Splitting the vines and ropes mod. This is the ropes side, removing all vine-related content.
54
README.md
@ -1,57 +1,5 @@
|
||||
# Vines
|
||||
# Ropes
|
||||
|
||||
## Features
|
||||
- Rope blocks for spawning rope that slowly drops into the deep.
|
||||
- Rope ladder that similarly descends into the deep.
|
||||
- Vines are climbable and slowly grow downward.
|
||||
- Shears that allow the collecting of vines and the trimming of ropes
|
||||
- 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 and the spawning of
|
||||
existing vines on nodes of your own.
|
||||
|
||||
If you want vines to spawn on a certain node then you can choose which vine by
|
||||
adding to the node groups the unique group of that vine. This is determined by
|
||||
the name of the vine ( see vines.lua ) appended with '_vines'.
|
||||
An example would be.
|
||||
|
||||
"willow_vines" or "jungle_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. The type is determined by the spawn_on_side property in the biome
|
||||
table.
|
||||
|
||||
### 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.
|
||||
|
11
aliases.lua
@ -1,11 +0,0 @@
|
||||
-- used to remove the old vine nodes. This gives room for the new nodes
|
||||
minetest.register_alias( 'vines:root', 'air' )
|
||||
minetest.register_alias( 'vines:root_rotten', 'air' )
|
||||
minetest.register_alias( 'vines:vine', 'air' )
|
||||
minetest.register_alias( 'vines:vine_rotten', 'air' )
|
||||
minetest.register_alias( 'vines:side', 'air' )
|
||||
minetest.register_alias( 'vines:side_rotten', 'air' )
|
||||
minetest.register_alias( 'vines:jungle', 'air' )
|
||||
minetest.register_alias( 'vines:jungle_rotten', 'air' )
|
||||
minetest.register_alias( 'vines:willow', 'air' )
|
||||
minetest.register_alias( 'vines:willow_rotten', 'air' )
|
18
bower.json
@ -1,18 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
}
|
29
crafts.lua
@ -1,7 +1,7 @@
|
||||
-- Misc
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'vines:ropesegment',
|
||||
output = 'ropes:ropesegment',
|
||||
recipe = {
|
||||
{'farming:cotton',},
|
||||
{'farming:cotton',},
|
||||
@ -9,10 +9,27 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("vines:ropesegment", {
|
||||
minetest.register_craftitem("ropes:ropesegment", {
|
||||
description = "Rope",
|
||||
_doc_items_longdesc = vines.doc.ropesegment_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.ropesegment_usage,
|
||||
groups = {vines = 1},
|
||||
inventory_image = "vines_item.png",
|
||||
_doc_items_longdesc = ropes.doc.ropesegment_longdesc,
|
||||
_doc_items_usagehelp = ropes.doc.ropesegment_usage,
|
||||
groups = {ropes = 1},
|
||||
inventory_image = "ropes_item.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ropes:ropeladder_top",
|
||||
recipe = {
|
||||
{'group:ropes','default:stick','group:ropes'},
|
||||
{'group:ropes','default:stick','group:ropes'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ropes:1rope_block",
|
||||
recipe = {
|
||||
{'default:wood',},
|
||||
{'group:ropes',},
|
||||
{'group:ropes'}
|
||||
}
|
||||
})
|
@ -1,4 +1,2 @@
|
||||
default
|
||||
biome_lib
|
||||
moretrees?
|
||||
doc?
|
35
doc.lua
@ -1,32 +1,25 @@
|
||||
vines.doc = {}
|
||||
ropes.doc = {}
|
||||
|
||||
if not minetest.get_modpath("doc") then
|
||||
return
|
||||
end
|
||||
|
||||
vines.doc.vines_longdesc = "Sinuous plants that grows on other plants for support."
|
||||
vines.doc.roots_longdesc = "Plant structures that provide structural support and draw nutrients from the soil."
|
||||
vines.doc.vines_usage = "These grow over time. When harvested with shears they provide useful crafting materials."
|
||||
ropes.doc.ropesegment_longdesc = "Rope segments are bundles of fibre twisted into robust cables."
|
||||
ropes.doc.ropesegment_usage = "This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon."
|
||||
|
||||
vines.doc.shears_longdesc = "A tool for harvesting vines."
|
||||
vines.doc.shears_usage = "Using shears to dig vines will give vine materials useful for crafting. Other tools lack the necessary finesse. Shears can also sever hanging ropes."
|
||||
ropes.doc.ropeladder_longdesc = "A hanging rope ladder that automatically extends downward"
|
||||
ropes.doc.ropeladder_usage = "After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (" .. tostring(ropes.ropeLadderLength) .. "m). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before."
|
||||
|
||||
vines.doc.ropesegment_longdesc = "Rope segments are bundles of fibre twisted into robust cables."
|
||||
vines.doc.ropesegment_usage = "This craft item is useful for creating rope ladders, or for spooling on wooden spindles to hang and climb upon."
|
||||
|
||||
vines.doc.ropeladder_longdesc = "A hanging rope ladder that automatically extends downward"
|
||||
vines.doc.ropeladder_usage = "After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (" .. tostring(vines.ropeLadderLength) .. "m). If the rope ladder is removed all of the ladder below the point of removal will disappear. A rope ladder can be severed partway down using an axe or similar tool, and the ladder below the point where it is cut will collapse. No rope is actually lost in the process, though, and if the uppermost section of the ladder is removed and replaced the ladder will re-extend to the same maximum length as before."
|
||||
|
||||
vines.doc.ropebox_longdesc = "Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut."
|
||||
vines.doc.ropebox_usage = "Rope boxes have a certain amount of rope contained within them specified in the name of the node. They come in five standard lengths " ..
|
||||
string.format("(%dm, %dm, %dm, %dm and %dm)", vines.ropeLength, vines.ropeLength*2, vines.ropeLength*3, vines.ropeLength*4, vines.ropeLength*5) ..
|
||||
" that can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a " .. tostring(vines.ropeLength*2) .. "m rope box by combining two " .. tostring(vines.ropeLength) .. "m rope boxes, and the two " .. tostring(vines.ropeLength) .. "m rope boxes can be recovered by splitting it back up in the crafting grid.\n\n" ..
|
||||
ropes.doc.ropebox_longdesc = "Ropes are hung by placing rope boxes, which automatically lower a rope of fixed length below them. They can be climbed and cut."
|
||||
ropes.doc.ropebox_usage = "Rope boxes have a certain amount of rope contained within them specified in the name of the node. They come in five standard lengths " ..
|
||||
string.format("(%dm, %dm, %dm, %dm and %dm)", ropes.ropeLength, ropes.ropeLength*2, ropes.ropeLength*3, ropes.ropeLength*4, ropes.ropeLength*5) ..
|
||||
" that can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a " .. tostring(ropes.ropeLength*2) .. "m rope box by combining two " .. tostring(ropes.ropeLength) .. "m rope boxes, and the two " .. tostring(ropes.ropeLength) .. "m rope boxes can be recovered by splitting it back up in the crafting grid.\n\n" ..
|
||||
"When a rope box is placed the rope will immediately begin lowering from it at one meter per second. The rope will only descend when its end is in the vicinity of an active player, suspending its journey when no players are nearby, so a long descent may require a player to climb down the rope as it goes. Take care not to fall off the end! The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.\n\n" ..
|
||||
"A rope can be severed midway using an axe or other similar tools. The section of rope below the cut will collapse and disappear, potentially causing players who were hanging on to it to fall. The remaining rope will not resume descent on its own, but the rope box at the top of the rope \"remembers\" how long the rope was and if it is deconstructed and replaced it will still have the same maximum length of rope as before - no rope is permnanently lost when a rope is severed like this."
|
||||
|
||||
doc.add_entry_alias("nodes", "vines:ropeladder_top", "nodes", "vines:ropeladder")
|
||||
doc.add_entry_alias("nodes", "vines:ropeladder_top", "nodes", "vines:ropeladder_bottom")
|
||||
doc.add_entry_alias("nodes", "vines:ropeladder_top", "nodes", "vines:ropeladder_falling")
|
||||
doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder")
|
||||
doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom")
|
||||
doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_falling")
|
||||
|
||||
doc.add_entry_alias("nodes", "vines:rope", "nodes", "vines:rope_bottom")
|
||||
doc.add_entry_alias("nodes", "vines:rope", "nodes", "vines:rope_top")
|
||||
doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_bottom")
|
||||
doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_top")
|
147
functions.lua
@ -1,145 +1,6 @@
|
||||
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'
|
||||
local vine_name_middle = 'vines:'..name..'_middle'
|
||||
|
||||
local vine_image_end = "vines_"..name.."_end.png"
|
||||
local vine_image_middle = "vines_"..name.."_middle.png"
|
||||
|
||||
local drop_node = vine_name_end
|
||||
|
||||
biome.spawn_plants = { vine_name_end }
|
||||
|
||||
local vine_group = 'group:'..name..'_vines'
|
||||
biome.spawn_surfaces[ #biome.spawn_surfaces + 1 ] = vine_group
|
||||
|
||||
local selection_box = { type = "wallmounted", }
|
||||
local drawtype = 'signlike'
|
||||
if ( not biome.spawn_on_side ) then
|
||||
--different properties for bottom and side vines.
|
||||
selection_box = { type = "fixed", fixed = { -0.4, -1/2, -0.4, 0.4, 1/2, 0.4 }, }
|
||||
drawtype = 'plantlike'
|
||||
end
|
||||
|
||||
minetest.register_node( vine_name_end, {
|
||||
description = defs.description,
|
||||
_doc_items_longdesc = defs._doc_items_longdesc,
|
||||
_doc_items_usagehelp = defs._doc_items_usagehelp,
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
wield_image = vine_image_end,
|
||||
drop = "",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
buildable_to = false,
|
||||
tiles = { vine_image_end },
|
||||
drawtype = drawtype,
|
||||
inventory_image = vine_image_end,
|
||||
groups = 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 = vine_name_middle, 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
|
||||
})
|
||||
|
||||
minetest.register_node( vine_name_middle, {
|
||||
description = "Matured "..defs.description,
|
||||
_doc_items_create_entry = false,
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
drop = "",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
buildable_to = false,
|
||||
tiles = { vine_image_middle },
|
||||
wield_image = vine_image_middle,
|
||||
drawtype = drawtype,
|
||||
inventory_image = vine_image_middle,
|
||||
groups = 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.after( 0, minetest.remove_node, bottom )
|
||||
end
|
||||
end,
|
||||
after_dig_node = function( pos, node, oldmetadata, user )
|
||||
vines.dig_vine( pos, drop_node, user )
|
||||
end
|
||||
})
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
doc.add_entry_alias("nodes", vine_name_end, "nodes", vine_name_middle)
|
||||
end
|
||||
|
||||
biome_lib:spawn_on_surfaces( biome )
|
||||
|
||||
local override_nodes = function( nodes, defs )
|
||||
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 )
|
||||
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
|
||||
|
||||
local c_air = minetest.get_content_id("air")
|
||||
|
||||
vines.destroy_rope_starting = function(pos, targetnode, bottomnode, topnode )
|
||||
ropes.destroy_rope_starting = function(pos, targetnode, bottomnode, topnode )
|
||||
local node_name = minetest.get_node(pos).name
|
||||
if node_name ~= targetnode and node_name ~= bottomnode then
|
||||
return
|
||||
@ -183,7 +44,7 @@ vines.destroy_rope_starting = function(pos, targetnode, bottomnode, topnode )
|
||||
end
|
||||
end
|
||||
|
||||
vines.hanging_after_destruct = function(pos, top_node, middle_node, bottom_node)
|
||||
ropes.hanging_after_destruct = function(pos, top_node, middle_node, bottom_node)
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == top_node or node.name == middle_node or node.name == bottom_node then
|
||||
return -- this was done by another ladder node changing this one, don't react
|
||||
@ -198,8 +59,8 @@ vines.hanging_after_destruct = function(pos, top_node, middle_node, bottom_node)
|
||||
pos.y = pos.y - 2 -- one down
|
||||
local node_below = minetest.get_node(pos)
|
||||
if node_below.name == middle_node then
|
||||
vines.destroy_rope_starting(pos, middle_node, bottom_node, top_node)
|
||||
--minetest.swap_node(pos, {name="vines:ropeladder_falling", param2=node_below.param2})
|
||||
ropes.destroy_rope_starting(pos, middle_node, bottom_node, top_node)
|
||||
--minetest.swap_node(pos, {name="ropes:ropeladder_falling", param2=node_below.param2})
|
||||
--minetest.get_node_timer(pos):start(0)
|
||||
elseif node_below.name == bottom_node then
|
||||
minetest.swap_node(pos, {name="air"})
|
||||
|
27
init.lua
@ -1,26 +1,23 @@
|
||||
vines = {
|
||||
name = 'vines',
|
||||
ropes = {
|
||||
name = 'ropes',
|
||||
}
|
||||
|
||||
local rope_length = minetest.setting_get("vines_rope_length")
|
||||
local rope_length = minetest.setting_get("ropes_rope_length")
|
||||
if not rope_length then
|
||||
rope_length = 50
|
||||
end
|
||||
vines.ropeLength = rope_length
|
||||
ropes.ropeLength = rope_length
|
||||
|
||||
local rope_ladder_length = minetest.setting_get("vines_rope_ladder_length")
|
||||
local rope_ladder_length = minetest.setting_get("ropes_rope_ladder_length")
|
||||
if not rope_ladder_length then
|
||||
rope_ladder_length = 50
|
||||
end
|
||||
vines.ropeLadderLength = rope_ladder_length
|
||||
ropes.ropeLadderLength = rope_ladder_length
|
||||
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/doc.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/functions.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/aliases.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/crafts.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/ropeboxes.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/ladder.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/shear.lua" )
|
||||
dofile( minetest.get_modpath( vines.name ) .. "/vines.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/doc.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/crafts.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/ropeboxes.lua" )
|
||||
dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" )
|
||||
|
||||
print("[Vines] Loaded!")
|
||||
print("[Ropes] Loaded!")
|
||||
|
60
ladder.lua
@ -1,12 +1,12 @@
|
||||
minetest.register_node("vines:ropeladder_top", {
|
||||
minetest.register_node("ropes:ropeladder_top", {
|
||||
description = "Rope ladder",
|
||||
_doc_items_longdesc = vines.doc.ropeladder_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.ropeladder_usage,
|
||||
_doc_items_longdesc = ropes.doc.ropeladder_longdesc,
|
||||
_doc_items_usagehelp = ropes.doc.ropeladder_usage,
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_ladder_wood.png^vines_ropeladder_top.png"},
|
||||
tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"},
|
||||
is_ground_content = false,
|
||||
inventory_image = "default_ladder_wood.png^vines_ropeladder_top.png",
|
||||
wield_image = "default_ladder_wood.png^vines_ropeladder_top.png",
|
||||
inventory_image = "default_ladder_wood.png^ropes_ropeladder_top.png",
|
||||
wield_image = "default_ladder_wood.png^ropes_ropeladder_top.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
@ -28,34 +28,26 @@ minetest.register_node("vines:ropeladder_top", {
|
||||
local this_node = minetest.get_node(pos)
|
||||
-- param2 holds the facing direction of this node. If it's 0 or 1 the node is "flat" and we don't want the ladder to extend.
|
||||
if node_below.name == "air" and this_node.param2 > 1 then
|
||||
minetest.add_node(pos_below, {name="vines:ropeladder_bottom", param2=this_node.param2})
|
||||
minetest.add_node(pos_below, {name="ropes:ropeladder_bottom", param2=this_node.param2})
|
||||
local meta = minetest.get_meta(pos_below)
|
||||
meta:set_int("length_remaining", vines.ropeLadderLength)
|
||||
meta:set_int("length_remaining", ropes.ropeLadderLength)
|
||||
end
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
vines.destroy_rope_starting(pos_below, "vines:ropeladder", "vines:ropeladder_bottom", "vines:ropeladder_falling")
|
||||
ropes.destroy_rope_starting(pos_below, "ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "vines:ropeladder_top",
|
||||
recipe = {
|
||||
{'group:vines','default:stick','group:vines'},
|
||||
{'group:vines','default:stick','group:vines'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("vines:ropeladder", {
|
||||
minetest.register_node("ropes:ropeladder", {
|
||||
description = "Rope ladder",
|
||||
_doc_items_create_entry = false,
|
||||
drop = "",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_ladder_wood.png^vines_ropeladder.png"},
|
||||
tiles = {"default_ladder_wood.png^ropes_ropeladder.png"},
|
||||
is_ground_content = false,
|
||||
inventory_image = "default_ladder_wood.png^vines_ropeladder.png",
|
||||
wield_image = "default_ladder_wood.png^vines_ropeladder.png",
|
||||
inventory_image = "default_ladder_wood.png^ropes_ropeladder.png",
|
||||
wield_image = "default_ladder_wood.png^ropes_ropeladder.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
@ -71,19 +63,19 @@ minetest.register_node("vines:ropeladder", {
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
|
||||
after_destruct = function(pos)
|
||||
vines.hanging_after_destruct(pos, "vines:ropeladder_falling", "vines:ropeladder", "vines:ropeladder_bottom")
|
||||
ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:ropeladder_bottom", {
|
||||
minetest.register_node("ropes:ropeladder_bottom", {
|
||||
description = "Rope ladder",
|
||||
_doc_items_create_entry = false,
|
||||
drop = "",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_ladder_wood.png^vines_ropeladder_bottom.png"},
|
||||
tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"},
|
||||
is_ground_content = false,
|
||||
inventory_image = "default_ladder_wood.png^vines_ropeladder_bottom.png",
|
||||
wield_image = "default_ladder_wood.png^vines_ropeladder_bottom.png",
|
||||
inventory_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png",
|
||||
wield_image = "default_ladder_wood.png^ropes_ropeladder_bottom.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
@ -111,10 +103,10 @@ minetest.register_node("vines:ropeladder_bottom", {
|
||||
local oldnode = minetest.get_node(pos)
|
||||
if currentlength > 1 then
|
||||
if newnode.name == "air" then
|
||||
minetest.add_node(newpos, {name="vines:ropeladder_bottom", param2=oldnode.param2})
|
||||
minetest.add_node(newpos, {name="ropes:ropeladder_bottom", param2=oldnode.param2})
|
||||
local newmeta = minetest.get_meta(newpos)
|
||||
newmeta:set_int("length_remaining", currentlength-1)
|
||||
minetest.set_node(pos, {name="vines:ropeladder", param2=oldnode.param2})
|
||||
minetest.set_node(pos, {name="ropes:ropeladder", param2=oldnode.param2})
|
||||
else
|
||||
local timer = minetest.get_node_timer( pos )
|
||||
timer:start( 1 )
|
||||
@ -123,19 +115,19 @@ minetest.register_node("vines:ropeladder_bottom", {
|
||||
end,
|
||||
|
||||
after_destruct = function(pos)
|
||||
vines.hanging_after_destruct(pos, "vines:ropeladder_falling", "vines:ropeladder", "vines:ropeladder_bottom")
|
||||
ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:ropeladder_falling", {
|
||||
minetest.register_node("ropes:ropeladder_falling", {
|
||||
description = "Rope ladder",
|
||||
_doc_items_create_entry = false,
|
||||
drop = "",
|
||||
drawtype = "signlike",
|
||||
tiles = {"default_ladder_wood.png^vines_ropeladder.png"},
|
||||
tiles = {"default_ladder_wood.png^ropes_ropeladder.png"},
|
||||
is_ground_content = false,
|
||||
inventory_image = "default_ladder_wood.png^vines_ropeladder.png",
|
||||
wield_image = "default_ladder_wood.png^vines_ropeladder.png",
|
||||
inventory_image = "default_ladder_wood.png^ropes_ropeladder.png",
|
||||
wield_image = "default_ladder_wood.png^ropes_ropeladder.png",
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
walkable = false,
|
||||
@ -159,7 +151,7 @@ minetest.register_node("vines:ropeladder_falling", {
|
||||
local node_below = minetest.get_node(pos_below)
|
||||
|
||||
if (node_below.name ~= "ignore") then
|
||||
vines.destroy_rope_starting(pos_below, 'vines:ropeladder', 'vines:ropeladder_bottom', 'vines:ropeladder_falling')
|
||||
ropes.destroy_rope_starting(pos_below, 'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling')
|
||||
minetest.swap_node(pos, {name="air"})
|
||||
else
|
||||
local timer = minetest.get_node_timer( pos )
|
||||
|
1
mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = ropes
|
@ -1,18 +1,18 @@
|
||||
local function register_rope_block(multiple, pixels)
|
||||
minetest.register_node(string.format("vines:%irope_block", multiple), {
|
||||
description = string.format("Rope %im", vines.ropeLength*multiple),
|
||||
minetest.register_node(string.format("ropes:%irope_block", multiple), {
|
||||
description = string.format("Rope %im", ropes.ropeLength*multiple),
|
||||
_doc_items_create_entry = false,
|
||||
drawtype="nodebox",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
tiles = {
|
||||
string.format("default_wood.png^vines_%irope.png", multiple),
|
||||
string.format("default_wood.png^vines_%irope.png", multiple),
|
||||
"default_wood.png^vines_side.png",
|
||||
"default_wood.png^vines_side.png",
|
||||
string.format("default_wood.png^vines_%irope_frontback.png", multiple),
|
||||
string.format("default_wood.png^vines_%irope_frontback.png", multiple),
|
||||
string.format("default_wood.png^ropes_%irope.png", multiple),
|
||||
string.format("default_wood.png^ropes_%irope.png", multiple),
|
||||
"default_wood.png^ropes_side.png",
|
||||
"default_wood.png^ropes_side.png",
|
||||
string.format("default_wood.png^ropes_%irope_frontback.png", multiple),
|
||||
string.format("default_wood.png^ropes_%irope_frontback.png", multiple),
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -33,48 +33,39 @@ local function register_rope_block(multiple, pixels)
|
||||
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local node_below = minetest.get_node(pos_below)
|
||||
if node_below.name == "air" then
|
||||
minetest.add_node(pos_below, {name="vines:rope_bottom"})
|
||||
minetest.add_node(pos_below, {name="ropes:rope_bottom"})
|
||||
local meta = minetest.get_meta(pos_below)
|
||||
meta:set_int("length_remaining", vines.ropeLength*multiple)
|
||||
meta:set_int("length_remaining", ropes.ropeLength*multiple)
|
||||
end
|
||||
end,
|
||||
after_destruct = function(pos)
|
||||
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
vines.destroy_rope_starting(pos_below, 'vines:rope', 'vines:rope_bottom', 'vines:rope_top')
|
||||
ropes.destroy_rope_starting(pos_below, 'ropes:rope', 'ropes:rope_bottom', 'ropes:rope_top')
|
||||
end
|
||||
})
|
||||
|
||||
if (multiple == 1) then
|
||||
minetest.register_craft({
|
||||
output = "vines:1rope_block",
|
||||
recipe = {
|
||||
{'default:wood',},
|
||||
{'group:vines',},
|
||||
{'group:vines'}
|
||||
}
|
||||
})
|
||||
else
|
||||
if (multiple ~= 1) then
|
||||
local rec = {}
|
||||
for i=1,multiple,1 do
|
||||
rec[i] = "vines:1rope_block"
|
||||
rec[i] = "ropes:1rope_block"
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
output = string.format("vines:%irope_block", multiple),
|
||||
output = string.format("ropes:%irope_block", multiple),
|
||||
type = "shapeless",
|
||||
recipe = rec
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = string.format("vines:1rope_block %i", multiple),
|
||||
output = string.format("ropes:1rope_block %i", multiple),
|
||||
recipe = {
|
||||
{string.format('vines:%irope_block', multiple)}
|
||||
{string.format('ropes:%irope_block', multiple)}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("doc") then
|
||||
doc.add_entry_alias("nodes", "vines:rope", "nodes", string.format("vines:%irope_block", multiple))
|
||||
doc.add_entry_alias("nodes", "ropes:rope", "nodes", string.format("ropes:%irope_block", multiple))
|
||||
end
|
||||
end
|
||||
|
||||
@ -86,16 +77,16 @@ register_rope_block(3, 10)
|
||||
register_rope_block(4, 10)
|
||||
register_rope_block(5, 12)
|
||||
|
||||
minetest.register_node("vines:rope", {
|
||||
minetest.register_node("ropes:rope", {
|
||||
description = "Rope",
|
||||
_doc_items_longdesc = vines.doc.ropebox_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.ropebox_usage,
|
||||
_doc_items_longdesc = ropes.doc.ropebox_longdesc,
|
||||
_doc_items_usagehelp = ropes.doc.ropebox_usage,
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drop = "",
|
||||
tiles = { "vines_rope.png" },
|
||||
tiles = { "ropes_rope.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {choppy=2, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
@ -104,11 +95,11 @@ minetest.register_node("vines:rope", {
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
after_destruct = function(pos)
|
||||
vines.hanging_after_destruct(pos, "vines:rope_top", "vines:rope", "vines:rope_bottom")
|
||||
ropes.hanging_after_destruct(pos, "ropes:rope_top", "ropes:rope", "ropes:rope_bottom")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope_bottom", {
|
||||
minetest.register_node("ropes:rope_bottom", {
|
||||
description = "Rope",
|
||||
_doc_items_create_entry = false,
|
||||
walkable = false,
|
||||
@ -116,7 +107,7 @@ minetest.register_node("vines:rope_bottom", {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drop = "",
|
||||
tiles = { "vines_rope_bottom.png" },
|
||||
tiles = { "ropes_rope_bottom.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {choppy=2, flammable=2, not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
@ -137,10 +128,10 @@ minetest.register_node("vines:rope_bottom", {
|
||||
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local node_below = minetest.get_node(pos_below)
|
||||
if node_below.name == "air" and (currentlength > 1) then
|
||||
minetest.add_node(pos_below, {name="vines:rope_bottom"})
|
||||
minetest.add_node(pos_below, {name="ropes:rope_bottom"})
|
||||
local newmeta = minetest.get_meta(pos_below)
|
||||
newmeta:set_int("length_remaining", currentlength-1)
|
||||
minetest.set_node(pos, {name="vines:rope"})
|
||||
minetest.set_node(pos, {name="ropes:rope"})
|
||||
else
|
||||
local timer = minetest.get_node_timer( pos )
|
||||
timer:start( 1 )
|
||||
@ -148,11 +139,11 @@ minetest.register_node("vines:rope_bottom", {
|
||||
end,
|
||||
|
||||
after_destruct = function(pos)
|
||||
vines.hanging_after_destruct(pos, "vines:rope_top", "vines:rope", "vines:rope_bottom")
|
||||
ropes.hanging_after_destruct(pos, "ropes:rope_top", "ropes:rope", "ropes:rope_bottom")
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope_top", {
|
||||
minetest.register_node("ropes:rope_top", {
|
||||
description = "Rope",
|
||||
_doc_items_create_entry = false,
|
||||
walkable = false,
|
||||
@ -160,7 +151,7 @@ minetest.register_node("vines:rope_top", {
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drop = "",
|
||||
tiles = { "vines_rope_top.png" },
|
||||
tiles = { "ropes_rope_top.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
@ -179,7 +170,7 @@ minetest.register_node("vines:rope_top", {
|
||||
local n = minetest.get_node(p)
|
||||
|
||||
if (n.name ~= "ignore") then
|
||||
vines.destroy_rope_starting(p, 'vines:rope', 'vines:rope_bottom', 'vines:rope_top')
|
||||
ropes.destroy_rope_starting(p, 'ropes:rope', 'ropes:rope_bottom', 'ropes:rope_top')
|
||||
minetest.swap_node(pos, {name="air"})
|
||||
else
|
||||
local timer = minetest.get_node_timer( pos )
|
||||
|
59
shear.lua
@ -1,59 +0,0 @@
|
||||
local USES = 200
|
||||
|
||||
minetest.register_tool("vines:shears", {
|
||||
description = "Shears",
|
||||
_doc_items_longdesc = vines.doc.shears_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.shears_usage,
|
||||
inventory_image = "vines_shears.png",
|
||||
wield_image = "vines_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}, uses=60, maxlevel=3},
|
||||
wool={times={[3]=0.2}, uses=60, maxlevel=3}
|
||||
}
|
||||
},
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
local pos = pointed_thing.under
|
||||
if minetest.is_protected(pos, user:get_player_name()) then
|
||||
minetest.record_protection_violation(pos, user:get_player_name())
|
||||
return
|
||||
end
|
||||
local node = minetest.get_node(pos)
|
||||
if node.name == "vines:rope" then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
minetest.add_node(pos, {name="vines:rope_bottom"})
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.get_node(p)
|
||||
if (n.name == 'vines:rope' or n.name == 'vines:rope_bottom') then
|
||||
minetest.add_node(p, {name="vines:rope_top"})
|
||||
end
|
||||
end
|
||||
if node.name == "vines:ropeladder" then
|
||||
itemstack:add_wear(65535 / (USES - 1))
|
||||
minetest.add_node(pos, {name="vines:ropeladder_bottom", param2=node.param2})
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.get_node(p)
|
||||
if (n.name == 'vines:ropeladder' or n.name == 'vines:ropeladder_bottom') then
|
||||
minetest.add_node(p, {name="vines:ropeladder_falling", param2=n.param2})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'vines:shears',
|
||||
recipe = {
|
||||
{'', 'default:steel_ingot', ''},
|
||||
{'default:stick', 'default:wood', 'default:steel_ingot'},
|
||||
{'', 'default:stick', ''}
|
||||
}
|
||||
})
|
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 142 B After Width: | Height: | Size: 142 B |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
Before Width: | Height: | Size: 153 B After Width: | Height: | Size: 153 B |
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 118 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 394 B |
Before Width: | Height: | Size: 415 B After Width: | Height: | Size: 415 B |
Before Width: | Height: | Size: 426 B After Width: | Height: | Size: 426 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 204 B |
Before Width: | Height: | Size: 229 B |
Before Width: | Height: | Size: 212 B |
Before Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 173 B |
Before Width: | Height: | Size: 195 B |
116
vines.lua
@ -1,116 +0,0 @@
|
||||
vines.register_vine( 'root', {
|
||||
description = "Roots",
|
||||
_doc_items_longdesc = vines.doc.roots_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.vines_usage,
|
||||
average_length = 9,
|
||||
},{
|
||||
choose_random_wall = true,
|
||||
avoid_nodes = {"vines:root_middle"},
|
||||
avoid_radius = 5,
|
||||
spawn_delay = 500,
|
||||
spawn_chance = 10,
|
||||
spawn_surfaces = {
|
||||
"default:dirt_with_grass",
|
||||
"default:dirt"
|
||||
},
|
||||
spawn_on_bottom = true,
|
||||
plantlife_limit = -0.6,
|
||||
humidity_min = 0.4,
|
||||
})
|
||||
|
||||
vines.register_vine( 'vine', {
|
||||
description = "Vines",
|
||||
_doc_items_longdesc = vines.doc.vines_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.vines_usage,
|
||||
average_length = 5,
|
||||
},{
|
||||
choose_random_wall = true,
|
||||
avoid_nodes = {"group:vines"},
|
||||
avoid_radius = 5,
|
||||
spawn_delay = 500,
|
||||
spawn_chance = 100,
|
||||
spawn_surfaces = {
|
||||
"default:leaves",
|
||||
"default:jungleleaves",
|
||||
"moretrees:jungletree_leaves_red",
|
||||
"moretrees:jungletree_leaves_yellow",
|
||||
"moretrees:jungletree_leaves_green"
|
||||
},
|
||||
spawn_on_bottom = true,
|
||||
plantlife_limit = -0.9,
|
||||
humidity_min = 0.7,
|
||||
})
|
||||
|
||||
vines.register_vine( 'side', {
|
||||
description = "Vines",
|
||||
_doc_items_longdesc = vines.doc.vines_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.vines_usage,
|
||||
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,
|
||||
spawn_surfaces = {
|
||||
"default:leaves",
|
||||
"default:jungleleaves",
|
||||
"moretrees:jungletree_leaves_red",
|
||||
"moretrees:jungletree_leaves_yellow",
|
||||
"moretrees:jungletree_leaves_green"
|
||||
},
|
||||
spawn_on_side = true,
|
||||
plantlife_limit = -0.9,
|
||||
humidity_min = 0.4,
|
||||
})
|
||||
|
||||
vines.register_vine( "jungle", {
|
||||
description = "Jungle Vines",
|
||||
_doc_items_longdesc = vines.doc.vines_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.vines_usage,
|
||||
average_length = 7,
|
||||
},{
|
||||
choose_random_wall = true,
|
||||
neighbors = {
|
||||
"default:jungleleaves",
|
||||
"moretrees:jungletree_leaves_red",
|
||||
"moretrees:jungletree_leaves_yellow",
|
||||
"moretrees:jungletree_leaves_green"
|
||||
},
|
||||
avoid_nodes = {
|
||||
"vines:jungle_middle",
|
||||
"vines:jungle_end",
|
||||
},
|
||||
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_min = 0.2,
|
||||
})
|
||||
|
||||
vines.register_vine( 'willow', {
|
||||
description = "Willow Vines",
|
||||
_doc_items_longdesc = vines.doc.vines_longdesc,
|
||||
_doc_items_usagehelp = vines.doc.vines_usage,
|
||||
average_length = 9,
|
||||
},{
|
||||
choose_random_wall = true,
|
||||
avoid_nodes = { "vines:willow_middle" },
|
||||
avoid_radius = 5,
|
||||
near_nodes = { 'default:water_source' },
|
||||
near_nodes_size = 1,
|
||||
near_nodes_count = 1,
|
||||
near_nodes_vertical = 7,
|
||||
plantlife_limit = -0.8,
|
||||
spawn_chance = 10,
|
||||
spawn_delay = 500,
|
||||
spawn_on_side = true,
|
||||
spawn_surfaces = {"moretrees:willow_leaves"},
|
||||
humidity_min = 0.5
|
||||
})
|