diff --git a/README.md b/README.md index 6aac52e..78f5bc7 100644 --- a/README.md +++ b/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. diff --git a/aliases.lua b/aliases.lua deleted file mode 100644 index fce7218..0000000 --- a/aliases.lua +++ /dev/null @@ -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' ) diff --git a/bower.json b/bower.json deleted file mode 100644 index 108a7c1..0000000 --- a/bower.json +++ /dev/null @@ -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" -} diff --git a/crafts.lua b/crafts.lua index 9f1c133..ce0dc75 100644 --- a/crafts.lua +++ b/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'} + } +}) \ No newline at end of file diff --git a/depends.txt b/depends.txt index 7b62beb..92dd391 100644 --- a/depends.txt +++ b/depends.txt @@ -1,4 +1,2 @@ default -biome_lib -moretrees? doc? \ No newline at end of file diff --git a/doc.lua b/doc.lua index 378f640..eae81d1 100644 --- a/doc.lua +++ b/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") \ No newline at end of file +doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_bottom") +doc.add_entry_alias("nodes", "ropes:rope", "nodes", "ropes:rope_top") \ No newline at end of file diff --git a/functions.lua b/functions.lua index 1050a47..285e205 100644 --- a/functions.lua +++ b/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"}) diff --git a/init.lua b/init.lua index 5fefc4b..bc573c7 100644 --- a/init.lua +++ b/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!") diff --git a/ladder.lua b/ladder.lua index f00bbbe..4a821a9 100644 --- a/ladder.lua +++ b/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 ) diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..88ecfd1 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = ropes \ No newline at end of file diff --git a/ropeboxes.lua b/ropeboxes.lua index ae337ec..fbe407a 100644 --- a/ropeboxes.lua +++ b/ropeboxes.lua @@ -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 ) diff --git a/shear.lua b/shear.lua deleted file mode 100644 index 15d3ba8..0000000 --- a/shear.lua +++ /dev/null @@ -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', ''} - } -}) \ No newline at end of file diff --git a/textures/vines_1rope.png b/textures/ropes_1rope.png similarity index 100% rename from textures/vines_1rope.png rename to textures/ropes_1rope.png diff --git a/textures/vines_1rope_frontback.png b/textures/ropes_1rope_frontback.png similarity index 100% rename from textures/vines_1rope_frontback.png rename to textures/ropes_1rope_frontback.png diff --git a/textures/vines_2rope.png b/textures/ropes_2rope.png similarity index 100% rename from textures/vines_2rope.png rename to textures/ropes_2rope.png diff --git a/textures/vines_2rope_frontback.png b/textures/ropes_2rope_frontback.png similarity index 100% rename from textures/vines_2rope_frontback.png rename to textures/ropes_2rope_frontback.png diff --git a/textures/vines_3rope.png b/textures/ropes_3rope.png similarity index 100% rename from textures/vines_3rope.png rename to textures/ropes_3rope.png diff --git a/textures/vines_3rope_frontback.png b/textures/ropes_3rope_frontback.png similarity index 100% rename from textures/vines_3rope_frontback.png rename to textures/ropes_3rope_frontback.png diff --git a/textures/vines_4rope.png b/textures/ropes_4rope.png similarity index 100% rename from textures/vines_4rope.png rename to textures/ropes_4rope.png diff --git a/textures/vines_4rope_frontback.png b/textures/ropes_4rope_frontback.png similarity index 100% rename from textures/vines_4rope_frontback.png rename to textures/ropes_4rope_frontback.png diff --git a/textures/vines_5rope.png b/textures/ropes_5rope.png similarity index 100% rename from textures/vines_5rope.png rename to textures/ropes_5rope.png diff --git a/textures/vines_5rope_frontback.png b/textures/ropes_5rope_frontback.png similarity index 100% rename from textures/vines_5rope_frontback.png rename to textures/ropes_5rope_frontback.png diff --git a/textures/vines_item.png b/textures/ropes_item.png similarity index 100% rename from textures/vines_item.png rename to textures/ropes_item.png diff --git a/textures/vines_rope.png b/textures/ropes_rope.png similarity index 100% rename from textures/vines_rope.png rename to textures/ropes_rope.png diff --git a/textures/vines_rope_bottom.png b/textures/ropes_rope_bottom.png similarity index 100% rename from textures/vines_rope_bottom.png rename to textures/ropes_rope_bottom.png diff --git a/textures/vines_rope_top.png b/textures/ropes_rope_top.png similarity index 100% rename from textures/vines_rope_top.png rename to textures/ropes_rope_top.png diff --git a/textures/vines_ropeladder.png b/textures/ropes_ropeladder.png similarity index 100% rename from textures/vines_ropeladder.png rename to textures/ropes_ropeladder.png diff --git a/textures/vines_ropeladder_bottom.png b/textures/ropes_ropeladder_bottom.png similarity index 100% rename from textures/vines_ropeladder_bottom.png rename to textures/ropes_ropeladder_bottom.png diff --git a/textures/vines_ropeladder_top.png b/textures/ropes_ropeladder_top.png similarity index 100% rename from textures/vines_ropeladder_top.png rename to textures/ropes_ropeladder_top.png diff --git a/textures/vines_side.png b/textures/ropes_side.png similarity index 100% rename from textures/vines_side.png rename to textures/ropes_side.png diff --git a/textures/vines_jungle_end.png b/textures/vines_jungle_end.png deleted file mode 100644 index 77c7f5a..0000000 Binary files a/textures/vines_jungle_end.png and /dev/null differ diff --git a/textures/vines_jungle_middle.png b/textures/vines_jungle_middle.png deleted file mode 100644 index 79e8429..0000000 Binary files a/textures/vines_jungle_middle.png and /dev/null differ diff --git a/textures/vines_root_end.png b/textures/vines_root_end.png deleted file mode 100644 index 57be98b..0000000 Binary files a/textures/vines_root_end.png and /dev/null differ diff --git a/textures/vines_root_middle.png b/textures/vines_root_middle.png deleted file mode 100644 index 49f88c0..0000000 Binary files a/textures/vines_root_middle.png and /dev/null differ diff --git a/textures/vines_shears.png b/textures/vines_shears.png deleted file mode 100644 index c4c39f9..0000000 Binary files a/textures/vines_shears.png and /dev/null differ diff --git a/textures/vines_side_end.png b/textures/vines_side_end.png deleted file mode 100644 index 8f20414..0000000 Binary files a/textures/vines_side_end.png and /dev/null differ diff --git a/textures/vines_side_middle.png b/textures/vines_side_middle.png deleted file mode 100644 index 2576e93..0000000 Binary files a/textures/vines_side_middle.png and /dev/null differ diff --git a/textures/vines_vine_end.png b/textures/vines_vine_end.png deleted file mode 100644 index dabef62..0000000 Binary files a/textures/vines_vine_end.png and /dev/null differ diff --git a/textures/vines_vine_middle.png b/textures/vines_vine_middle.png deleted file mode 100644 index 8afffe8..0000000 Binary files a/textures/vines_vine_middle.png and /dev/null differ diff --git a/textures/vines_willow_end.png b/textures/vines_willow_end.png deleted file mode 100644 index bdf327b..0000000 Binary files a/textures/vines_willow_end.png and /dev/null differ diff --git a/textures/vines_willow_middle.png b/textures/vines_willow_middle.png deleted file mode 100644 index 5aef898..0000000 Binary files a/textures/vines_willow_middle.png and /dev/null differ diff --git a/vines.lua b/vines.lua deleted file mode 100644 index 8450cdd..0000000 --- a/vines.lua +++ /dev/null @@ -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 -})