diff options
Diffstat (limited to 'ropes')
-rw-r--r-- | ropes/crafts.lua | 21 | ||||
-rw-r--r-- | ropes/ladder.lua | 11 | ||||
-rw-r--r-- | ropes/ropeboxes.lua | 11 |
3 files changed, 41 insertions, 2 deletions
diff --git a/ropes/crafts.lua b/ropes/crafts.lua index 299c0cc..2c33dd3 100644 --- a/ropes/crafts.lua +++ b/ropes/crafts.lua @@ -3,16 +3,33 @@ 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 +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/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 676f1c2..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} |