diff options
Diffstat (limited to 'ropes')
-rw-r--r-- | ropes/LICENSE.md | 23 | ||||
-rw-r--r-- | ropes/crafts.lua | 41 | ||||
-rw-r--r-- | ropes/depends.txt | 4 | ||||
-rw-r--r-- | ropes/init.lua | 12 | ||||
-rw-r--r-- | ropes/ladder.lua | 11 | ||||
-rw-r--r-- | ropes/ropeboxes.lua | 16 |
6 files changed, 91 insertions, 16 deletions
diff --git a/ropes/LICENSE.md b/ropes/LICENSE.md index fb67788..368b332 100644 --- a/ropes/LICENSE.md +++ b/ropes/LICENSE.md @@ -1,4 +1,19 @@ -License -======= -- Code WTFPL -- Texture CC +## MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ropes/crafts.lua b/ropes/crafts.lua index 299c0cc..8e2bae8 100644 --- a/ropes/crafts.lua +++ b/ropes/crafts.lua @@ -3,16 +3,53 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") if minetest.get_modpath("farming") then +-- this doesn't work reliably due to side effects of https://github.com/minetest/minetest/issues/5518 +-- local old_def = minetest.registered_craftitems["farming:cotton"] +-- if old_def then +-- old_def.groups["thread"] = 1 +-- minetest.override_item("farming:cotton", { +-- groups = old_def.groups +-- }) +-- end minetest.register_craft({ - output = 'ropes:ropesegment', + output = 'ropes:ropesegment', recipe = { {'farming:cotton','farming:cotton'}, {'farming:cotton','farming:cotton'}, - {'farming:cotton','farming:cotton'} + {'farming:cotton','farming:cotton'}, + } + }) +end + +if minetest.get_modpath("hemp") then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'hemp:hemp_rope'}, + {'hemp:hemp_rope'}, + } + }) +end + +if minetest.get_modpath("cottages") then + minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'cottages:rope'}, + {'cottages:rope'}, } }) end +minetest.register_craft({ + output = 'ropes:ropesegment', + recipe = { + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + {'group:thread','group:thread'}, + } +}) + minetest.register_craftitem("ropes:ropesegment", { description = S("Rope Segment"), _doc_items_longdesc = ropes.doc.ropesegment_longdesc, diff --git a/ropes/depends.txt b/ropes/depends.txt index 6672602..55c98cb 100644 --- a/ropes/depends.txt +++ b/ropes/depends.txt @@ -3,4 +3,6 @@ farming? vines? doc? intllib? -loot?
\ No newline at end of file +loot? +hemp? +cottages?
\ No newline at end of file diff --git a/ropes/init.lua b/ropes/init.lua index 68d9895..cf57df3 100644 --- a/ropes/init.lua +++ b/ropes/init.lua @@ -6,12 +6,12 @@ ropes = { local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") -ropes.ropeLength = tonumber(minetest.setting_get("ropes_rope_length")) or 50 -ropes.ropeLadderLength = tonumber(minetest.setting_get("ropes_rope_ladder_length")) or 50 -ropes.woodRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_wood_rope_box_max_multiple")) or 2 -ropes.copperRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_copper_rope_box_max_multiple")) or 5 -ropes.steelRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_steel_rope_box_max_multiple")) or 9 -ropes.create_all_definitions = minetest.setting_getbool("ropes_create_all_definitions") +ropes.ropeLength = tonumber(minetest.settings:get("ropes_rope_length")) or 50 +ropes.ropeLadderLength = tonumber(minetest.settings:get("ropes_rope_ladder_length")) or 50 +ropes.woodRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_wood_rope_box_max_multiple")) or 2 +ropes.copperRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_copper_rope_box_max_multiple")) or 5 +ropes.steelRopeBoxMaxMultiple = tonumber(minetest.settings:get("ropes_steel_rope_box_max_multiple")) or 9 +ropes.create_all_definitions = minetest.settings:get_bool("ropes_create_all_definitions") dofile( minetest.get_modpath( ropes.name ) .. "/doc.lua" ) dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" ) diff --git a/ropes/ladder.lua b/ropes/ladder.lua index 5ac872c..7097c72 100644 --- a/ropes/ladder.lua +++ b/ropes/ladder.lua @@ -46,6 +46,17 @@ local rope_ladder_top_def = { }, groups = { choppy=2, oddly_breakable_by_hand=1,flammable=2}, sounds = default.node_sound_wood_defaults(), + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, after_place_node = function(pos, placer) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} diff --git a/ropes/ropeboxes.lua b/ropes/ropeboxes.lua index 9049bb1..626b158 100644 --- a/ropes/ropeboxes.lua +++ b/ropes/ropeboxes.lua @@ -134,6 +134,17 @@ local function register_rope_block(multiple, max_multiple, name_prefix, node_pre selection_box = {type="regular"}, collision_box = {type="regular"}, groups = {choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type == "node" then + local target_node = minetest.get_node(pointed_thing.under) + local target_def = minetest.registered_nodes[target_node.name] + if target_def.walkable == false then + return itemstack + end + end + return minetest.item_place(itemstack, placer, pointed_thing) + end, after_place_node = function(pos, placer) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} @@ -225,9 +236,8 @@ local rope_def = { drop = "", tiles = { "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_3.png", "ropes_5.png", "ropes_5.png" }, groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_leaves_defaults(), sounds = { - footstep = "ropes_creak", + footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6}, dig = "__group", dug = "__group", }, @@ -262,7 +272,7 @@ local rope_bottom_def = { drawtype = "nodebox", groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, sounds = { - footstep = "ropes_creak", + footstep = {name = "ropes_creak", gain = 0.8, max_hear_distance = 6}, dig = "__group", dug = "__group", }, |