From ec25fd83415d0ecb49f41295af3dc30f14850b2f Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Mon, 17 Dec 2018 02:20:30 -0500 Subject: update biome_lib, digilines, hotbar, mesecons, pipeworks, ropes, technic, unified inventory, unified dyes, vines, and worldedit --- ropes/README.md | 2 + ropes/bridge.lua | 88 ++++++++++++++++++++ ropes/doc.lua | 8 ++ ropes/extendingladder.lua | 204 ++++++++++++++++++++++++++++++++++++++++++++++ ropes/init.lua | 31 +++++-- ropes/ladder.lua | 191 ------------------------------------------- ropes/locale/es.po | 80 ++++++++++++++---- ropes/locale/template.pot | 73 ++++++++++++++--- ropes/locale/update.bat | 6 ++ ropes/ropeladder.lua | 191 +++++++++++++++++++++++++++++++++++++++++++ ropes/settingtypes.txt | 15 +++- 11 files changed, 661 insertions(+), 228 deletions(-) create mode 100644 ropes/bridge.lua create mode 100644 ropes/extendingladder.lua delete mode 100644 ropes/ladder.lua create mode 100644 ropes/locale/update.bat create mode 100644 ropes/ropeladder.lua (limited to 'ropes') diff --git a/ropes/README.md b/ropes/README.md index 699369c..8465745 100644 --- a/ropes/README.md +++ b/ropes/README.md @@ -6,6 +6,8 @@ The rope stops lowering if it reaches an obstruction. Ropes can be cut using an Also included is a rope ladder that behaves similarly, though it only comes in one standard maximum length - 50m by default, again changeable in settings. +This mod will also enhance default wood ladders and steel ladders to make them "extendable", capable of building upward independent of support to a setting-defined limit (defaulting to 5 nodes for wood and 15 nodes for steel ladders). This can be disabled if undesired. + This mod retains optional backward compatibility with the crafting items from the vines mod (anything with group "vines" can be used to make rope boxes and rope ladders). Ropes can also be made from cotton, available via an optional dependency on the farming mod. In-game documentation is provided via an optional dependency on the doc mod. \ No newline at end of file diff --git a/ropes/bridge.lua b/ropes/bridge.lua new file mode 100644 index 0000000..31db7e6 --- /dev/null +++ b/ropes/bridge.lua @@ -0,0 +1,88 @@ +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(modpath.."/intllib.lua") + +if ropes.bridges_enabled then + +local bridge_on_place = function(itemstack, placer, pointed_thing) + -- Shall place item and return the leftover itemstack. + -- The placer may be any ObjectRef or nil. + -- default: minetest.item_place + if placer == nil then + return minetest.item_place(itemstack, placer, pointed_thing) + end + + local above = pointed_thing.above + local under = pointed_thing.under + + if above.x == under.x and above.z == under.z and above.y > under.y then + -- we're aimed downward at a buildable node from above. + -- determine the direction the placer lies relative to this node. + local new_under = vector.new(under) + local placer_pos = placer:get_pos() + local diff_x = placer_pos.x - under.x + local diff_z = placer_pos.z - under.z + if math.abs(diff_x) > math.abs(diff_z) then + -- placer is displaced along the X axis relative to the target + if diff_x > 0 then + new_under.x = under.x - 1 + else + new_under.x = under.x + 1 + end + else + -- placer is displaced along the Z axis relative to the target + if diff_z > 0 then + new_under.z = under.z - 1 + else + new_under.z = under.z + 1 + end + end + if minetest.registered_nodes[minetest.get_node(new_under).name].buildable_to then + local new_pointed_thing = {type="node", under=new_under, above={x=new_under.x, y=new_under.y+1, z=new_under.z}} + return minetest.item_place(itemstack, placer, new_pointed_thing) + end + end + + return minetest.item_place(itemstack, placer, pointed_thing) +end + +minetest.register_node("ropes:wood_bridge", { + description = S("Wooden Bridge"), + _doc_items_longdesc = ropes.doc.wooden_bridge_longdesc, + _doc_items_usagehelp = ropes.doc.wooden_bridge_usagehelp, + tiles = { + "default_wood.png", "default_wood.png", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + "default_wood.png^[transformR270", "default_wood.png^[transformR90", + }, + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + groups = {choppy = 2, flammable = 2, oddly_breakable_by_hand = 1, flow_through = 1, fence = 1, wall = 1}, + sounds = default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = { + {-0.5, 0.375, -0.5, 0.5, 0.5, 0.5}, -- Platform + {-0.375, -0.5, -0.5, 0.375, -0.375, -0.4375}, -- x beam4 + {-0.375, -0.5, 0.4375, 0.375, -0.375, 0.5}, -- x beam3 + {0.375, -0.5, -0.4375, 0.5, -0.375, 0.4375}, -- z beam2 + {-0.5, -0.5, -0.4375, -0.375, -0.375, 0.4375}, -- z beam1 + {0.375, -0.5, -0.5, 0.5, 0.375, -0.4375}, -- upright4 + {0.375, -0.5, 0.4375, 0.5, 0.375, 0.5}, -- upright3 + {-0.5, -0.5, -0.5, -0.375, 0.375, -0.4375}, -- upright2 + {-0.5, -0.5, 0.4375, -0.375, 0.375, 0.5}, -- upright1 + } + }, + on_place = bridge_on_place, +}) + +minetest.register_craft({ + output = "ropes:wood_bridge 5", + recipe = { + {"group:stick", "stairs:slab_wood", "group:stick"}, + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + } +}) + +end diff --git a/ropes/doc.lua b/ropes/doc.lua index 7f2ce54..020fb04 100644 --- a/ropes/doc.lua +++ b/ropes/doc.lua @@ -39,6 +39,14 @@ ropes.doc.ropebox_usage = rope_length_doc .. "\n\n" .. S("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. If you are near the bottom end of a rope that's extending you'll be automatically carried down with it. The rope will stop when it encounters and obstruction, but will resume lowering if the obstruction is removed.") .. "\n\n" .. S("A rope can be severed midway using an axe or other similar tool. 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 permanently lost when a rope is severed like this.") +if ropes.extending_ladder_enabled then + ropes.doc.ladder_longdesc = S("A ladder for climbing. It can reach greater heights when placed against a supporting block.") + ropes.doc.ladder_usagehelp = S("Right-clicking on a ladder with a stack of identical ladder items will automatically add new ladder segments to the top, provided it hasn't extended too far up beyond the last block behind it providing support.") +end + +ropes.doc.wooden_bridge_longdesc = S("A wooden platform with support struts useful for bridging gaps.") +ropes.doc.wooden_bridge_usagehelp = S("This behaves like most structural blocks except in one circumstance: when placed on top of a block with buildable space on the side facing away from you, this block will not be built on top but instead will extend out from that far side of the target block. This allows a platform to be easily built that juts out away from the location you're standing on.") + 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") diff --git a/ropes/extendingladder.lua b/ropes/extendingladder.lua new file mode 100644 index 0000000..c804ac2 --- /dev/null +++ b/ropes/extendingladder.lua @@ -0,0 +1,204 @@ +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(modpath.."/intllib.lua") + +if ropes.extending_ladder_enabled then + +minetest.unregister_item("default:ladder_wood") +minetest.unregister_item("default:ladder_steel") +minetest.clear_craft({output = "default:ladder_wood"}) +minetest.clear_craft({output = "default:ladder_steel"}) + +local wallmounted_to_facedir = +{[0] = 15, -- ceiling +[1] = 13, -- floor +[2] = 1, -- +X +[3] = 3, -- -X +[4] = 0, -- +Z +[5] = 2, -- -Z +} + +minetest.register_lbm({ + label = "Switch from wallmounted default ladders to rope mod extending ladders", + name = "ropes:wallmounted_ladder_to_facedir_ladder", + nodenames = {"default:ladder_wood", "default:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = wallmounted_to_facedir[node.param2]} + if (node.name == "default:ladder_wood") then + new_node.name = "ropes:ladder_wood" + else + new_node.name = "ropes:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +minetest.register_craft({ + output = "ropes:ladder_wood 5", + recipe = { + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + {"group:stick", "", "group:stick"}, + } +}) + +minetest.register_craft({ + output = 'ropes:ladder_steel 15', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + + +local ladder_extender = function(pos, node, clicker, itemstack, pointed_thing, ladder_node, standing_limit) + local clicked_stack = ItemStack(itemstack) + + -- true if we're pointing up at the ladder from below and there's a buildable space below it + -- this check allows us to extend ladders downward + local pointing_directly_below = + pointed_thing.above.x == pos.x and + pointed_thing.above.z == pos.z and + pointed_thing.above.y == pos.y - 1 and + minetest.registered_nodes[minetest.get_node(pointed_thing.above).name].buildable_to + + if clicked_stack:get_name() == ladder_node and not pointing_directly_below then + local param2 = minetest.get_node(pos).param2 + local dir = minetest.facedir_to_dir(param2) + local scan_limit = pos.y + 6 -- Only add ladder segments up to five nodes above the one clicked on + pos.y = pos.y + 1 + while pos.y < scan_limit and minetest.get_node(pos).name == ladder_node do + param2 = minetest.get_node(pos).param2 + pos.y = pos.y + 1 + end + if pos.y < scan_limit and minetest.registered_nodes[minetest.get_node(pos).name].buildable_to then + + -- scan downward behind the ladder to find support + local behind_pos = vector.add(pos, minetest.facedir_to_dir(param2)) + local target_height = pos.y - standing_limit - 1 + while behind_pos.y > target_height and minetest.registered_nodes[minetest.get_node(behind_pos).name].buildable_to do + behind_pos.y = behind_pos.y - 1 + end + + -- If there's enough support, build a new ladder segment + if behind_pos.y > target_height then + if minetest.is_protected(pos, clicker:get_player_name()) then + minetest.record_protection_violation(clicker:get_player_name()) + else + minetest.set_node(pos, {name=ladder_node, param2=param2}) + if not minetest.settings:get_bool("creative_mode") then + clicked_stack:take_item(1) + end + end + end + end + elseif clicked_stack:get_definition().type == "node" then + return minetest.item_place_node(itemstack, clicker, pointed_thing) + end + return clicked_stack +end + +minetest.register_node("ropes:ladder_wood", { + description = S("Wooden Ladder"), + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_wood.png","default_wood.png","default_wood.png^[transformR270","default_wood.png^[transformR270","default_ladder_wood.png"}, + inventory_image = "default_ladder_wood.png", + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + paramtype = "light", + node_box = { + type = "fixed", + fixed = { + {-0.375, -0.5, 0.375, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.375, 0.375, 0.5, 0.5}, -- Upright2 + {-0.4375, 0.3125, 0.4375, 0.4375, 0.4375, 0.5}, -- Rung_4 + {-0.4375, -0.1875, 0.4375, 0.4375, -0.0625, 0.5}, -- Rung_2 + {-0.4375, -0.4375, 0.4375, 0.4375, -0.3125, 0.5}, -- Rung_1 + {-0.4375, 0.0625, 0.4375, 0.4375, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2, flow_through = 1}, + sounds = default.node_sound_wood_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_wood", ropes.extending_wood_ladder_limit) + end, +}) + +minetest.register_node("ropes:ladder_steel", { + description = S("Steel Ladder"), + _doc_items_longdesc = ropes.doc.ladder_longdesc, + _doc_items_usagehelp = ropes.doc.ladder_usagehelp, + tiles = {"default_steel_block.png","default_steel_block.png","default_steel_block.png","default_steel_block.png","default_ladder_steel.png"}, + inventory_image = "default_ladder_steel.png", + wield_image = "default_ladder_steel.png", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.4375, -0.5, 0.3125, -0.25, 0.5, 0.5}, -- Upright1 + {0.25, -0.5, 0.3125, 0.4375, 0.5, 0.5}, -- Upright2 + {-0.25, 0.3125, 0.375, 0.25, 0.4375, 0.5}, -- Rung_4 + {-0.25, -0.1875, 0.375, 0.25, -0.0625, 0.5}, -- Rung_2 + {-0.25, -0.4375, 0.375, 0.25, -0.3125, 0.5}, -- Rung_1 + {-0.25, 0.0625, 0.375, 0.25, 0.1875, 0.5}, -- Rung_3 + } + }, + groups = {cracky = 2, flow_through = 1}, + sounds = default.node_sound_metal_defaults(), + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + return ladder_extender(pos, node, clicker, itemstack, pointed_thing, "ropes:ladder_steel", ropes.extending_steel_ladder_limit) + end, +}) + +else + +-- Table of possible wallmounted values +local facedir_to_wallmounted = { + 4, -- +Z + 2, -- +X + 5, -- -Z + 3, -- -X + 1, -- -Y + 0, -- +Y +} +-- Mapping from facedir value to index in facedir_to_dir. +local facedir_to_wallmounted_map = { + [0]=1, 2, 3, 4, + 5, 2, 6, 4, + 6, 2, 5, 4, + 1, 5, 3, 6, + 1, 6, 3, 5, + 1, 4, 3, 2, +} + +minetest.register_lbm({ + label = "Switch from ropes ladders to wallmounted default ladders", + name = "ropes:facedir_ladder_to_wallmounted_ladder", + nodenames = {"ropes:ladder_wood", "ropes:ladder_steel"}, + run_at_every_load = false, + action = function(pos, node) + local new_node = {param2 = facedir_to_wallmounted[facedir_to_wallmounted_map[node.param2 % 32]]} + if (node.name == "ropes:ladder_wood") then + new_node.name = "default:ladder_wood" + else + new_node.name = "default:ladder_steel" + end + minetest.set_node(pos, new_node) + end, +}) + +end diff --git a/ropes/init.lua b/ropes/init.lua index cf57df3..1ef9915 100644 --- a/ropes/init.lua +++ b/ropes/init.lua @@ -7,18 +7,33 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") 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" ) -dofile( minetest.get_modpath( ropes.name ) .. "/crafts.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/ropeboxes.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" ) -dofile( minetest.get_modpath( ropes.name ) .. "/loot.lua" ) +ropes.ropeLadderLength = tonumber(minetest.settings:get("ropes_rope_ladder_length")) or 50 + +ropes.extending_ladder_enabled = minetest.settings:get_bool("ropes_extending_ladder_enabled") +if ropes.extending_ladder_enabled == nil then + ropes.extending_ladder_enabled = true +end +ropes.extending_wood_ladder_limit = tonumber(minetest.settings:get("ropes_extending_wood_ladder_limit")) or 5 +ropes.extending_steel_ladder_limit = tonumber(minetest.settings:get("ropes_extending_steel_ladder_limit")) or 15 + +ropes.bridges_enabled = minetest.settings:get_bool("ropes_bridges_enabled") +if ropes.bridges_enabled == nil then + ropes.bridges_enabled = true +end + +dofile( MP .. "/doc.lua" ) +dofile( MP .. "/functions.lua" ) +dofile( MP .. "/crafts.lua" ) +dofile( MP .. "/ropeboxes.lua" ) +dofile( MP .. "/ropeladder.lua" ) +dofile( MP .. "/extendingladder.lua" ) +dofile( MP .. "/bridge.lua" ) +dofile( MP .. "/loot.lua" ) for i=1,5 do @@ -40,4 +55,4 @@ minetest.register_alias("castle:ropes", "ropes:rope") minetest.register_alias("castle:ropebox", "ropes:steel1rope_block") minetest.register_alias("castle:box_rope", "ropes:rope") -print(S("[Ropes] Loaded!")) +print("[Ropes] Loaded!") diff --git a/ropes/ladder.lua b/ropes/ladder.lua deleted file mode 100644 index 7097c72..0000000 --- a/ropes/ladder.lua +++ /dev/null @@ -1,191 +0,0 @@ -if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then - return -end - --- internationalization boilerplate -local MP = minetest.get_modpath(minetest.get_current_modname()) -local S, NS = dofile(MP.."/intllib.lua") - -if ropes.ropeLadderLength > 0 then - minetest.register_craft({ - output = "ropes:ropeladder_top", - recipe = { - {'','group:stick',''}, - {'group:vines','group:stick','group:vines'}, - {'','group:stick',''}, - } - }) -end - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:ropeladder_top", - burntime = ropes.ladder_burn_time, -}) - -local rope_ladder_top_def = { - description = S("Rope Ladder"), - _doc_items_longdesc = ropes.doc.ropeladder_longdesc, - _doc_items_usagehelp = ropes.doc.ropeladder_usage, - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"}, - is_ground_content = false, - 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, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - 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} - local node_below = minetest.get_node(pos_below) - local this_node = minetest.get_node(pos) - local placer_name = placer:get_player_name() - -- 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 - and (not minetest.is_protected(pos_below, placer_name) - or minetest.check_player_privs(placer_name, "protection_bypass")) then - 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", ropes.ropeLadderLength) - meta:set_string("placer", placer_name) - end - end, - after_destruct = function(pos) - local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} - ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"}) - end, -} - -if ropes.ropeLadderLength == 0 then - rope_ladder_top_def.groups.not_in_creative_inventory = 1 -end - -minetest.register_node("ropes:ropeladder_top", rope_ladder_top_def) - -minetest.register_node("ropes:ropeladder", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - }, - groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - - after_destruct = function(pos) - ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") - end, -}) - -local ladder_extender = ropes.make_rope_on_timer("ropes:ropeladder") - -minetest.register_node("ropes:ropeladder_bottom", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"}, - is_ground_content = false, - 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, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - on_construct = function( pos ) - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end, - on_timer = ladder_extender, - - after_destruct = function(pos) - ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") - end, -}) - -minetest.register_node("ropes:ropeladder_falling", { - description = S("Rope Ladder"), - _doc_items_create_entry = false, - drop = "", - drawtype = "signlike", - tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, - is_ground_content = false, - inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", - wield_image = "default_ladder_wood.png^ropes_ropeladder.png", - paramtype = "light", - paramtype2 = "wallmounted", - walkable = false, - climbable = true, - sunlight_propagates = true, - selection_box = { - type = "wallmounted", - --wall_top = = - --wall_bottom = = - --wall_side = = - - }, - groups = {flammable=2, not_in_creative_inventory=1}, - sounds = default.node_sound_wood_defaults(), - on_construct = function( pos ) - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end, - on_timer = function( pos, elapsed ) - 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 ~= "ignore") then - ropes.destroy_rope(pos_below, {'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling'}) - minetest.swap_node(pos, {name="air"}) - else - local timer = minetest.get_node_timer( pos ) - timer:start( 1 ) - end - end -}) diff --git a/ropes/locale/es.po b/ropes/locale/es.po index b7c1b56..79e0bda 100644 --- a/ropes/locale/es.po +++ b/ropes/locale/es.po @@ -7,18 +7,22 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-10-27 10:41+0200\n" +"POT-Creation-Date: 2018-11-27 22:45-0700\n" "PO-Revision-Date: 2018-10-27 11:26+0200\n" +"Last-Translator: \n" "Language-Team: \n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 1.8.11\n" -"Last-Translator: \n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: es\n" -#: crafts.lua:17 +#: bridge.lua:47 +msgid "Wooden Bridge" +msgstr "" + +#: crafts.lua:54 msgid "Rope Segment" msgstr "Segmento de cuerda" @@ -83,23 +87,33 @@ msgstr "" "recuperar dos segmentos de cable colocando solo la caja de cable de @1m en " "la rejilla de fabricación." -#: doc.lua:20 doc.lua:22 ropeboxes.lua:302 +#: doc.lua:20 +#: doc.lua:22 +#: ropeboxes.lua:321 msgid "Wood" msgstr "madera" -#: doc.lua:20 doc.lua:26 doc.lua:32 +#: doc.lua:20 +#: doc.lua:26 +#: doc.lua:32 msgid "rope boxes can hold @1m of rope." msgstr "Las cajas de cuerdas pueden mantener @1m de cuerda." -#: doc.lua:22 doc.lua:28 doc.lua:34 +#: doc.lua:22 +#: doc.lua:28 +#: doc.lua:34 msgid "rope boxes can hold rope lengths from @1m to @2m." msgstr "Las cajas de cuerda pueden contener longitudes de cuerda de @1m a @2m." -#: doc.lua:26 doc.lua:28 ropeboxes.lua:319 +#: doc.lua:26 +#: doc.lua:28 +#: ropeboxes.lua:338 msgid "Copper" msgstr "cobre" -#: doc.lua:32 doc.lua:34 ropeboxes.lua:336 +#: doc.lua:32 +#: doc.lua:34 +#: ropeboxes.lua:355 msgid "Steel" msgstr "acero" @@ -149,18 +163,52 @@ msgstr "" "longitud máxima de cuerda que antes - ninguna cuerda se pierde " "permanentemente cuando una cuerda es cortada de esta manera." -#: init.lua:72 -msgid "[Ropes] Loaded!" -msgstr "¡[Ropes] Cargado!" +#: doc.lua:43 +msgid "" +"A ladder for climbing. It can reach greater heights when placed against a " +"supporting block." +msgstr "" -#: ladder.lua:27 ladder.lua:78 ladder.lua:108 ladder.lua:142 -msgid "Rope Ladder" -msgstr "Escalera de cuerda" +#: doc.lua:44 +msgid "" +"Right-clicking on a ladder with a stack of identical ladder items will " +"automatically add new ladder segments to the top, provided it hasn't " +"extended too far up beyond the last block behind it providing support." +msgstr "" + +#: doc.lua:47 +msgid "A wooden platform with support struts useful for bridging gaps." +msgstr "" + +#: doc.lua:48 +msgid "" +"This behaves like most structural blocks except in one circumstance: when " +"placed on top of a block with buildable space on the side facing away from " +"you, this block will not be built on top but instead will extend out from " +"that far side of the target block. This allows a platform to be easily built " +"that juts out away from the location you're standing on." +msgstr "" + +#: extendingladder.lua:103 +msgid "Wooden Ladder" +msgstr "" + +#: extendingladder.lua:136 +msgid "Steel Ladder" +msgstr "" #: ropeboxes.lua:121 msgid "@1 Ropebox @2m" msgstr "Caja de cuerda de @1 de @2m" -#: ropeboxes.lua:218 ropeboxes.lua:249 +#: ropeboxes.lua:229 +#: ropeboxes.lua:264 msgid "Rope" msgstr "Cuerda" + +#: ropeladder.lua:27 +#: ropeladder.lua:89 +#: ropeladder.lua:119 +#: ropeladder.lua:153 +msgid "Rope Ladder" +msgstr "Escalera de cuerda" diff --git a/ropes/locale/template.pot b/ropes/locale/template.pot index 3d739ab..ac17db9 100644 --- a/ropes/locale/template.pot +++ b/ropes/locale/template.pot @@ -8,15 +8,20 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-09 21:21-0700\n" +"POT-Creation-Date: 2018-11-27 22:45-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: crafts.lua:17 +#: bridge.lua:47 +msgid "Wooden Bridge" +msgstr "" + +#: crafts.lua:54 msgid "Rope Segment" msgstr "" @@ -58,23 +63,33 @@ msgid "" "box in the crafting grid by itself." msgstr "" -#: doc.lua:20 doc.lua:22 ropeboxes.lua:302 +#: doc.lua:20 +#: doc.lua:22 +#: ropeboxes.lua:321 msgid "Wood" msgstr "" -#: doc.lua:20 doc.lua:26 doc.lua:32 +#: doc.lua:20 +#: doc.lua:26 +#: doc.lua:32 msgid "rope boxes can hold @1m of rope." msgstr "" -#: doc.lua:22 doc.lua:28 doc.lua:34 +#: doc.lua:22 +#: doc.lua:28 +#: doc.lua:34 msgid "rope boxes can hold rope lengths from @1m to @2m." msgstr "" -#: doc.lua:26 doc.lua:28 ropeboxes.lua:319 +#: doc.lua:26 +#: doc.lua:28 +#: ropeboxes.lua:338 msgid "Copper" msgstr "" -#: doc.lua:32 doc.lua:34 ropeboxes.lua:336 +#: doc.lua:32 +#: doc.lua:34 +#: ropeboxes.lua:355 msgid "Steel" msgstr "" @@ -106,18 +121,52 @@ msgid "" "permanently lost when a rope is severed like this." msgstr "" -#: init.lua:72 -msgid "[Ropes] Loaded!" +#: doc.lua:43 +msgid "" +"A ladder for climbing. It can reach greater heights when placed against a " +"supporting block." msgstr "" -#: ladder.lua:27 ladder.lua:78 ladder.lua:108 ladder.lua:142 -msgid "Rope Ladder" +#: doc.lua:44 +msgid "" +"Right-clicking on a ladder with a stack of identical ladder items will " +"automatically add new ladder segments to the top, provided it hasn't " +"extended too far up beyond the last block behind it providing support." +msgstr "" + +#: doc.lua:47 +msgid "A wooden platform with support struts useful for bridging gaps." +msgstr "" + +#: doc.lua:48 +msgid "" +"This behaves like most structural blocks except in one circumstance: when " +"placed on top of a block with buildable space on the side facing away from " +"you, this block will not be built on top but instead will extend out from " +"that far side of the target block. This allows a platform to be easily built " +"that juts out away from the location you're standing on." +msgstr "" + +#: extendingladder.lua:103 +msgid "Wooden Ladder" +msgstr "" + +#: extendingladder.lua:136 +msgid "Steel Ladder" msgstr "" #: ropeboxes.lua:121 msgid "@1 Ropebox @2m" msgstr "" -#: ropeboxes.lua:218 ropeboxes.lua:249 +#: ropeboxes.lua:229 +#: ropeboxes.lua:264 msgid "Rope" msgstr "" + +#: ropeladder.lua:27 +#: ropeladder.lua:89 +#: ropeladder.lua:119 +#: ropeladder.lua:153 +msgid "Rope Ladder" +msgstr "" diff --git a/ropes/locale/update.bat b/ropes/locale/update.bat new file mode 100644 index 0000000..e87d44c --- /dev/null +++ b/ropes/locale/update.bat @@ -0,0 +1,6 @@ +@echo off +setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +cd .. +set LIST= +for /r %%X in (*.lua) do set LIST=!LIST! %%X +..\intllib\tools\xgettext.bat %LIST% \ No newline at end of file diff --git a/ropes/ropeladder.lua b/ropes/ropeladder.lua new file mode 100644 index 0000000..7097c72 --- /dev/null +++ b/ropes/ropeladder.lua @@ -0,0 +1,191 @@ +if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then + return +end + +-- internationalization boilerplate +local MP = minetest.get_modpath(minetest.get_current_modname()) +local S, NS = dofile(MP.."/intllib.lua") + +if ropes.ropeLadderLength > 0 then + minetest.register_craft({ + output = "ropes:ropeladder_top", + recipe = { + {'','group:stick',''}, + {'group:vines','group:stick','group:vines'}, + {'','group:stick',''}, + } + }) +end + +minetest.register_craft({ + type = "fuel", + recipe = "ropes:ropeladder_top", + burntime = ropes.ladder_burn_time, +}) + +local rope_ladder_top_def = { + description = S("Rope Ladder"), + _doc_items_longdesc = ropes.doc.ropeladder_longdesc, + _doc_items_usagehelp = ropes.doc.ropeladder_usage, + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_top.png"}, + is_ground_content = false, + 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, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + 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} + local node_below = minetest.get_node(pos_below) + local this_node = minetest.get_node(pos) + local placer_name = placer:get_player_name() + -- 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 + and (not minetest.is_protected(pos_below, placer_name) + or minetest.check_player_privs(placer_name, "protection_bypass")) then + 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", ropes.ropeLadderLength) + meta:set_string("placer", placer_name) + end + end, + after_destruct = function(pos) + local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} + ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"}) + end, +} + +if ropes.ropeLadderLength == 0 then + rope_ladder_top_def.groups.not_in_creative_inventory = 1 +end + +minetest.register_node("ropes:ropeladder_top", rope_ladder_top_def) + +minetest.register_node("ropes:ropeladder", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +local ladder_extender = ropes.make_rope_on_timer("ropes:ropeladder") + +minetest.register_node("ropes:ropeladder_bottom", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder_bottom.png"}, + is_ground_content = false, + 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, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {choppy=2, flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = ladder_extender, + + after_destruct = function(pos) + ropes.hanging_after_destruct(pos, "ropes:ropeladder_falling", "ropes:ropeladder", "ropes:ropeladder_bottom") + end, +}) + +minetest.register_node("ropes:ropeladder_falling", { + description = S("Rope Ladder"), + _doc_items_create_entry = false, + drop = "", + drawtype = "signlike", + tiles = {"default_ladder_wood.png^ropes_ropeladder.png"}, + is_ground_content = false, + inventory_image = "default_ladder_wood.png^ropes_ropeladder.png", + wield_image = "default_ladder_wood.png^ropes_ropeladder.png", + paramtype = "light", + paramtype2 = "wallmounted", + walkable = false, + climbable = true, + sunlight_propagates = true, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + + }, + groups = {flammable=2, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + on_construct = function( pos ) + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end, + on_timer = function( pos, elapsed ) + 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 ~= "ignore") then + ropes.destroy_rope(pos_below, {'ropes:ropeladder', 'ropes:ropeladder_bottom', 'ropes:ropeladder_falling'}) + minetest.swap_node(pos, {name="air"}) + else + local timer = minetest.get_node_timer( pos ) + timer:start( 1 ) + end + end +}) diff --git a/ropes/settingtypes.txt b/ropes/settingtypes.txt index 242cd76..3c5d747 100644 --- a/ropes/settingtypes.txt +++ b/ropes/settingtypes.txt @@ -34,4 +34,17 @@ ropes_steel_rope_box_max_multiple (Maximum steel rope box multiple) int 9 0 9 #intended for the situation where you have an established world and you want #to reduce the number of rope boxes available to players without turning #existing rope boxes into "unknown node"s. -ropes_create_all_definitions (Create all rope box definitions) bool false \ No newline at end of file +ropes_create_all_definitions (Create all rope box definitions) bool false + +#Extending ladders replaces the default wallmounted wood and steel ladders +#with ladders capable of standing on their own, to a defined limit. +#A ladder can extend to its unsupported limit before needing another node +#behind it to provide a new point of support. Right-clicking on an existing +#ladder with a stack of ladders will add new ladder segments to its top. +ropes_extending_ladder_enabled (Enable extendable ladders) bool true +ropes_extending_wood_ladder_limit (Unsupported limit of wooden ladders) int 5 +ropes_extending_steel_ladder_limit (Unsupported limit of steel ladders) int 15 + +#These nodes make it easier to build bridges by extending out away +#from the player as they're placed +ropes_bridges_enabled (Enable bridges) bool true \ No newline at end of file -- cgit v1.2.3