From 3027973c3a8cb749fb993f3a7dd2528c632a0a3f Mon Sep 17 00:00:00 2001 From: Sokomine Date: Fri, 30 Jun 2017 19:58:52 +0200 Subject: [PATCH] added special ladder and rope for mines --- init.lua | 1 + nodes_mining.lua | 67 +++++++++++++++++++++++++++++++++++++ textures/cottages_rope.png | Bin 0 -> 106 bytes 3 files changed, 68 insertions(+) create mode 100644 nodes_mining.lua create mode 100644 textures/cottages_rope.png diff --git a/init.lua b/init.lua index cbafc0a..8149611 100644 --- a/init.lua +++ b/init.lua @@ -63,6 +63,7 @@ dofile(minetest.get_modpath("cottages").."/nodes_doorlike.lua"); dofile(minetest.get_modpath("cottages").."/nodes_fences.lua"); dofile(minetest.get_modpath("cottages").."/nodes_roof.lua"); dofile(minetest.get_modpath("cottages").."/nodes_barrel.lua"); +dofile(minetest.get_modpath("cottages").."/nodes_mining.lua"); --dofile(minetest.get_modpath("cottages").."/nodes_chests.lua"); -- this is only required and useful if you run versions of the random_buildings mod where the nodes where defined inside that mod diff --git a/nodes_mining.lua b/nodes_mining.lua new file mode 100644 index 0000000..3af4f71 --- /dev/null +++ b/nodes_mining.lua @@ -0,0 +1,67 @@ + + +--------------------------------------------------------------------------------------- +-- a rope that is of use to the mines +--------------------------------------------------------------------------------------- +-- the rope can only be digged if there is no further rope above it; +-- Note: This rope also counts as a rail node; thus, carts can move through it +minetest.register_node("cottages:rope", { + description = "rope for climbing", + tiles = {"cottages_rope.png"}, + groups = {snappy=3,choppy=3,oddly_breakable_by_hand=3,rail=1,connect_to_raillike=1},--connect_to_raillike=minetest.raillike_group("rail")}, + walkable = false, + climbable = true, + paramtype = "light", + sunlight_propagates = true, + drawtype = "plantlike", + is_ground_content = false, + can_dig = function(pos, player) + local below = minetest.get_node( {x=pos.x, y=pos.y-1, z=pos.z}); + if( below and below.name and below.name == "cottages:rope" ) then + if( player ) then + minetest.chat_send_player( player:get_player_name(), + 'The entire rope would be too heavy. Start digging at its lowest end!'); + end + return false; + end + return true; + end +}) + +minetest.register_craft({ + output = "cottages:rope", + recipe = { + {"default:cotton","default:cotton","default:cotton"} + } +}) + + +-- Note: This rope also counts as a rail node; thus, carts can move through it +minetest.register_node("cottages:ladder_with_rope_and_rail", { + description = "Ladder with rail support", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^carts_rail_straight.png^cottages_rope.png"}, + inventory_image = "default_ladder_wood.png", + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + }, + groups = {choppy=2,oddly_breakable_by_hand=3,rail=1,connect_to_raillike=1}, --connect_to_raillike=minetest.raillike_group("rail")}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + + + +minetest.register_craft({ + output = "cottages:ladder_with_rope_and_rail 3", + recipe = { + {"default:ladder","cottages:rope", "default:rail"} + } +}) diff --git a/textures/cottages_rope.png b/textures/cottages_rope.png new file mode 100644 index 0000000000000000000000000000000000000000..0045c4c35a084711061a59701654079f83e79e41 GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`hMq2tAr_~T6AtkHvyPDb!~bCm zYqG%nMwburX&jcb4zelS^x5@xidDS{kK5sdC9RAM*{%thtAdu80W~vty85}Sb4q9e E0Kr`!{Qv*} literal 0 HcmV?d00001