From 7f7ca3514e5fee2d70277d88c08ed087d72f0256 Mon Sep 17 00:00:00 2001 From: FaceDeer Date: Thu, 9 Feb 2017 21:29:42 -0700 Subject: [PATCH] Add multiple material types. --- crafts.lua | 68 ++----------- doc.lua | 27 +++-- init.lua | 47 ++++++--- ladder.lua | 31 +++++- locale/template.pot | 91 ++++++++++------- ropeboxes.lua | 155 +++++++++++++++++++---------- settingtypes.txt | 33 +++++- textures/ropes_ropebox_front_1.png | Bin 376 -> 345 bytes textures/ropes_ropebox_front_2.png | Bin 435 -> 418 bytes textures/ropes_ropebox_front_3.png | Bin 508 -> 475 bytes textures/ropes_ropebox_front_4.png | Bin 573 -> 555 bytes textures/ropes_ropebox_front_5.png | Bin 653 -> 621 bytes textures/ropes_ropebox_side.png | Bin 545 -> 412 bytes 13 files changed, 277 insertions(+), 175 deletions(-) diff --git a/crafts.lua b/crafts.lua index 05c467f..299c0cc 100644 --- a/crafts.lua +++ b/crafts.lua @@ -6,9 +6,9 @@ if minetest.get_modpath("farming") then minetest.register_craft({ output = 'ropes:ropesegment', recipe = { - {'farming:cotton',}, - {'farming:cotton',}, - {'farming:cotton'} + {'farming:cotton','farming:cotton'}, + {'farming:cotton','farming:cotton'}, + {'farming:cotton','farming:cotton'} } }) end @@ -21,68 +21,14 @@ minetest.register_craftitem("ropes:ropesegment", { inventory_image = "ropes_item.png", }) -minetest.register_craft({ - output = "ropes:ropeladder_top", - recipe = { - {'group:vines','group:stick','group:vines'}, - {'group:vines','group:stick','group:vines'}, - } -}) - -minetest.register_craft({ - output = "ropes:1rope_block", - recipe = { - {'group:wood',}, - {'group:vines',}, - {'group:vines'} - } -}) - local cotton_burn_time = 1 -local wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:wood")}}).time -local rope_burn_time = cotton_burn_time * 3 -local rope_box_burn_time = wood_burn_time + rope_burn_time * 2 +ropes.wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:wood")}}).time +ropes.rope_burn_time = cotton_burn_time * 6 local stick_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:stick")}}).time -local ladder_burn_time = rope_burn_time * 2 + stick_burn_time * 2 +ropes.ladder_burn_time = ropes.rope_burn_time * 2 + stick_burn_time * 3 minetest.register_craft({ type = "fuel", recipe = "ropes:ropesegment", - burntime = rope_burn_time, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:1rope_block", - burntime = rope_box_burn_time, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:2rope_block", - burntime = rope_box_burn_time * 2, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:3rope_block", - burntime = rope_box_burn_time * 3, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:4rope_block", - burntime = rope_box_burn_time * 4, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:5rope_block", - burntime = rope_box_burn_time * 5, -}) - -minetest.register_craft({ - type = "fuel", - recipe = "ropes:ropeladder_top", - burntime = ladder_burn_time, + burntime = ropes.rope_burn_time, }) \ No newline at end of file diff --git a/doc.lua b/doc.lua index 35f1cdc..7f2ce54 100644 --- a/doc.lua +++ b/doc.lua @@ -14,17 +14,30 @@ ropes.doc.ropesegment_usage = S("This craft item is useful for creating rope lad ropes.doc.ropeladder_longdesc = S("A hanging rope ladder that automatically extends downward.") ropes.doc.ropeladder_usage = S("After a rope ladder is placed on a vertical wall it will begin extending downward until it reaches its maximum length (@1 meters). 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.", ropes.ropeLadderLength) -local rope_length_doc -if ropes.ropeLengthMaxMultiple > 1 then - rope_length_doc = S("Rope boxes have a certain amount of rope contained within them specified in the name of the node. They come in @1 standard lengths (from @2 meters to @3 meters in multiples of @2 meters) that can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @4m rope box by combining two @2m rope boxes, and the two @2m rope boxes can be recovered by splitting the @4m rope box back up in the crafting grid.", ropes.ropeLengthMaxMultiple, ropes.ropeLength, ropes.ropeLength*ropes.ropeLengthMaxMultiple, ropes.ropeLength*2) -else - rope_length_doc = S("Rope boxes contain @1 meters of rope.", ropes.ropeLength) +local rope_length_doc = S("Rope boxes have a certain amount of rope contained within them specified in the name of the node, and have a limit to how much rope they can support that depends on the material they're made of. The different lengths can be crafted by combining and splitting up rope boxes in the crafting grid. For example, you can craft a @1m rope box by putting a @2m rope box and a rope segment in the crafting grid, or a @3m rope box and two rope segments in the crafting grid. Two rope segments can be recovered by putting the @1m rope box in the crafting grid by itself.", ropes.ropeLength*3, ropes.ropeLength*2, ropes.ropeLength) .. "\n" + +if ropes.woodRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Wood") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.woodRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Wood") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.woodRopeBoxMaxMultiple) +end + +if ropes.copperRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Copper") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.copperRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Copper") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.copperRopeBoxMaxMultiple) +end + +if ropes.steelRopeBoxMaxMultiple == 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Steel") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength) +elseif ropes.steelRopeBoxMaxMultiple > 1 then + rope_length_doc = rope_length_doc .. "\n" .. S("Steel") .. " " .. S("rope boxes can hold rope lengths from @1m to @2m.", ropes.ropeLength, ropes.ropeLength*ropes.steelRopeBoxMaxMultiple) end ropes.doc.ropebox_longdesc = S("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_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. Take care not to fall off the end! 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 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.") + 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.") doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder") doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom") diff --git a/init.lua b/init.lua index 65374cf..0f72933 100644 --- a/init.lua +++ b/init.lua @@ -16,11 +16,24 @@ if not ropes.ropeLadderLength then ropes.ropeLadderLength = 50 end -ropes.ropeLengthMaxMultiple = tonumber(minetest.setting_get("ropes_rope_box_max_multiple")) -if not ropes.ropeLengthMaxMultiple then - ropes.ropeLengthMaxMultiple = 9 +ropes.woodRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_wood_rope_box_max_multiple")) +if not ropes.woodRopeBoxMaxMultiple then + ropes.woodRopeBoxMaxMultiple = 2 end +ropes.copperRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_copper_rope_box_max_multiple")) +if not ropes.copperRopeBoxMaxMultiple then + ropes.copperRopeBoxMaxMultiple = 5 +end + +ropes.steelRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_steel_rope_box_max_multiple")) +if not ropes.steelRopeBoxMaxMultiple then + ropes.steelRopeBoxMaxMultiple = 9 +end + +ropes.create_all_definitions = minetest.setting_getbool("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" ) @@ -29,9 +42,9 @@ dofile( minetest.get_modpath( ropes.name ) .. "/ladder.lua" ) local upgrade_counter = 1 -- For players who used to use the combined vine/rope mod fork I split this out of -local swapper = function(old_node, new_node) +local swapper = function(old_node, new_node, upgrade_name) minetest.register_lbm({ - name = "ropes:vines_to_ropes_upgrade_" .. tostring(upgrade_counter), + name = "ropes:" .. upgrade_name .. "_" .. tostring(upgrade_counter), nodenames = {old_node}, action = function(pos, node) minetest.swap_node(pos, {name=new_node, param2=node.param2}) @@ -40,16 +53,20 @@ local swapper = function(old_node, new_node) upgrade_counter = upgrade_counter + 1 end for i=1,5 do - swapper(string.format("vines:%irope_block", i), string.format("ropes:%irope_block", i)) + swapper(string.format("vines:%irope_block", i), string.format("ropes:%irope_block", i), "vines_to_ropes_upgrade") +end +swapper("vines:rope", "ropes:rope", "vines_to_ropes_upgrade") +swapper("vines:rope_bottom", "ropes:rope_bottom", "vines_to_ropes_upgrade") +swapper("vines:rope_end", "ropes:rope_bottom", "vines_to_ropes_upgrade") +swapper("vines:rope_top", "ropes:rope_top", "vines_to_ropes_upgrade") +swapper("vines:ropeladder_top", "ropes:ropeladder_top", "vines_to_ropes_upgrade") +swapper("vines:ropeladder", "ropes:ropeladder", "vines_to_ropes_upgrade") +swapper("vines:ropeladder_bottom", "ropes:ropeladder_bottom", "vines_to_ropes_upgrade") +swapper("vines:ropeladder_falling", "ropes:ropeladder_falling", "vines_to_ropes_upgrade") +swapper("vines:rope_block", "ropes:5rope_block", "vines_to_ropes_upgrade") -- for the original vines mod + +for i=1,9 do + swapper(string.format("ropes:%irope_block", i), string.format("ropes:wood%irope_block", i), "rope_block_composition_upgrade") end -swapper("vines:rope", "ropes:rope") -swapper("vines:rope_bottom", "ropes:rope_bottom") -swapper("vines:rope_end", "ropes:rope_bottom") -swapper("vines:rope_top", "ropes:rope_top") -swapper("vines:ropeladder_top", "ropes:ropeladder_top") -swapper("vines:ropeladder", "ropes:ropeladder") -swapper("vines:ropeladder_bottom", "ropes:ropeladder_bottom") -swapper("vines:ropeladder_falling", "ropes:ropeladder_falling") -swapper("vines:rope_block", "ropes:5rope_block") -- for the original vines mod print(S("[Ropes] Loaded!")) diff --git a/ladder.lua b/ladder.lua index cb9f343..5ac872c 100644 --- a/ladder.lua +++ b/ladder.lua @@ -1,8 +1,29 @@ +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") -minetest.register_node("ropes:ropeladder_top", { +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, @@ -45,7 +66,13 @@ minetest.register_node("ropes:ropeladder_top", { 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"), diff --git a/locale/template.pot b/locale/template.pot index 28ebcbf..3d739ab 100644 --- a/locale/template.pot +++ b/locale/template.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-09 00:20-0700\n" +"POT-Creation-Date: 2017-02-09 21:21-0700\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,20 +16,8 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: init.lua:57 -msgid "[Ropes] Loaded!" -msgstr "" - -#: ropeboxes.lua:120 -msgid "Rope @1m" -msgstr "" - -#: ropeboxes.lua:202 ropeboxes.lua:233 -msgid "Rope" -msgstr "" - -#: ladder.lua:6 ladder.lua:51 ladder.lua:81 ladder.lua:115 -msgid "Rope Ladder" +#: crafts.lua:17 +msgid "Rope Segment" msgstr "" #: doc.lua:11 @@ -58,45 +46,78 @@ msgid "" "length as before." msgstr "" -#: doc.lua:19 +#: doc.lua:17 msgid "" "Rope boxes have a certain amount of rope contained within them specified in " -"the name of the node. They come in @1 standard lengths (from @2 meters to @3 " -"meters in multiples of @2 meters) that can be crafted by combining and " -"splitting up rope boxes in the crafting grid. For example, you can craft a " -"@4m rope box by combining two @2m rope boxes, and the two @2m rope boxes can " -"be recovered by splitting the @4m rope box back up in the crafting grid." +"the name of the node, and have a limit to how much rope they can support " +"that depends on the material they're made of. The different lengths can be " +"crafted by combining and splitting up rope boxes in the crafting grid. For " +"example, you can craft a @1m rope box by putting a @2m rope box and a rope " +"segment in the crafting grid, or a @3m rope box and two rope segments in the " +"crafting grid. Two rope segments can be recovered by putting the @1m rope " +"box in the crafting grid by itself." msgstr "" -#: doc.lua:21 -msgid "Rope boxes contain @1 meters of rope." +#: doc.lua:20 doc.lua:22 ropeboxes.lua:302 +msgid "Wood" msgstr "" -#: doc.lua:24 +#: 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 +msgid "rope boxes can hold rope lengths from @1m to @2m." +msgstr "" + +#: doc.lua:26 doc.lua:28 ropeboxes.lua:319 +msgid "Copper" +msgstr "" + +#: doc.lua:32 doc.lua:34 ropeboxes.lua:336 +msgid "Steel" +msgstr "" + +#: doc.lua:37 msgid "" "Ropes are hung by placing rope boxes, which automatically lower a rope of " "fixed length below them. They can be climbed and cut." msgstr "" -#: doc.lua:26 +#: doc.lua:39 msgid "" "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! 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." +"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." msgstr "" -#: doc.lua:27 +#: doc.lua:40 msgid "" -"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 " +"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 " -"permnanently lost when a rope is severed like this." +"permanently lost when a rope is severed like this." +msgstr "" + +#: init.lua:72 +msgid "[Ropes] Loaded!" +msgstr "" + +#: ladder.lua:27 ladder.lua:78 ladder.lua:108 ladder.lua:142 +msgid "Rope Ladder" +msgstr "" + +#: ropeboxes.lua:121 +msgid "@1 Ropebox @2m" +msgstr "" + +#: ropeboxes.lua:218 ropeboxes.lua:249 +msgid "Rope" msgstr "" diff --git a/ropeboxes.lua b/ropeboxes.lua index c5ab8af..81e8885 100644 --- a/ropeboxes.lua +++ b/ropeboxes.lua @@ -2,14 +2,14 @@ local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") -local function rope_box_tiles(count) +local function rope_box_tiles(count, tint) return { - string.format("ropes_ropebox_front_%i.png^ropes_%i.png", count, count), - string.format("ropes_ropebox_front_%i.png^ropes_%i.png", count, count), - "ropes_ropebox_side.png", - "ropes_ropebox_side.png", - string.format("ropes_ropebox_front_%i.png^ropes_%i.png", count, count), - string.format("ropes_ropebox_front_%i.png^ropes_%i.png", count, count), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint), + string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), + string.format("ropes_ropebox_front_%i.png^[colorize:%s^ropes_ropebox_front_%i.png^ropes_%i.png", count, tint, count, count), } end @@ -23,7 +23,7 @@ local rope_box_data = { {0.125, -0.5, -0.125, 0.1875, 0.125, 0.125}, -- support }, --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection - tiles = rope_box_tiles(1), + tiles = 1, }, { node={ @@ -34,7 +34,7 @@ local rope_box_data = { {0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support }, --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection - tiles = rope_box_tiles(2), + tiles = 2, }, { node={ @@ -45,7 +45,7 @@ local rope_box_data = { {0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support }, --selection = {-0.3125, -0.5, -0.25, 0.3125, 0.25, 0.25}, -- selection - tiles = rope_box_tiles(3), + tiles = 3, }, { node={ @@ -56,7 +56,7 @@ local rope_box_data = { {0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support }, --selection = {-0.375, -0.5, -0.25, 0.375, 0.25, 0.25}, -- selection - tiles = rope_box_tiles(4), + tiles = 4, }, { node={ @@ -67,7 +67,7 @@ local rope_box_data = { {0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support }, --selection = {-0.4375, -0.5, -0.25, 0.4375, 0.25, 0.25}, -- selection - tiles = rope_box_tiles(5), + tiles = 5, }, { node={ @@ -78,7 +78,7 @@ local rope_box_data = { {0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support }, --selection = {-0.1875, -0.5, -0.3125, 0.1875, 0.3125, 0.3125}, -- selection - tiles = rope_box_tiles(2), + tiles = 2, }, { node={ @@ -89,7 +89,7 @@ local rope_box_data = { {0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support }, --selection = {-0.3125, -0.5, -0.3125, 0.3125, 0.3125, 0.3125}, -- selection - tiles = rope_box_tiles(3), + tiles = 3, }, { node={ @@ -100,7 +100,7 @@ local rope_box_data = { {0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support }, --selection = {-0.375, -0.5, -0.3125, 0.375, 0.3125, 0.3125}, -- selection - tiles = rope_box_tiles(4), + tiles = 4, }, { node={ @@ -111,13 +111,14 @@ local rope_box_data = { {0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support }, --selection_bottom = {-0.4375, -0.5, -0.3125, 0.4375, 0.3125, 0.3125}, -- selection - tiles = rope_box_tiles(5), + tiles = 5, } } -local function register_rope_block(multiple) +local function register_rope_block(multiple, max_multiple, name_prefix, node_prefix, tint, flammable) + local node_name = string.format("ropes:%s%irope_block", node_prefix, multiple) local rope_block_def = { - description = S("Rope @1m", ropes.ropeLength*multiple), + description = S("@1 Ropebox @2m", name_prefix, ropes.ropeLength*multiple), _doc_items_create_entry = false, drawtype="nodebox", sunlight_propagates = true, @@ -125,14 +126,14 @@ local function register_rope_block(multiple) paramtype2 = "wallmounted", walkable = false, climbable = true, - tiles = rope_box_data[multiple].tiles, + tiles = rope_box_tiles(rope_box_data[multiple].tiles, tint), node_box = { type = "fixed", fixed = rope_box_data[multiple].node }, selection_box = {type="regular"}, collision_box = {type="regular"}, - groups = {flammable=2, choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, + groups = {choppy=2, oddly_breakable_by_hand=1, rope_block = 1}, after_place_node = function(pos, placer) local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} @@ -161,40 +162,55 @@ local function register_rope_block(multiple) -- some were already placed in-world) but we want to hide it from creative inventory -- and if someone digs it we want to disintegrate it into its component parts to prevent -- reuse. - if multiple > ropes.ropeLengthMaxMultiple then + if multiple > max_multiple then rope_block_def.groups.not_in_creative_inventory = 1 - rope_block_def.drop = string.format("ropes:1rope_block %i", multiple) + rope_block_def.drop = string.format("ropes:%s1rope_block %i", node_prefix, multiple) end - minetest.register_node(string.format("ropes:%irope_block", multiple), rope_block_def) + if flammable then + rope_block_def.groups.flammable = flammable + + minetest.register_craft({ + type = "fuel", + recipe = node_name, + burntime = ropes.rope_burn_time * multiple + ropes.wood_burn_time, + }) + end + + minetest.register_node(node_name, rope_block_def) if (multiple ~= 1) then -- Only register a recipe to craft this if it's within the permitted multiple range - if multiple <= ropes.ropeLengthMaxMultiple then - local rec = {} - for i=1,multiple,1 do - rec[i] = "ropes:1rope_block" + if multiple <= max_multiple then + for i = 1, multiple-1 do + local rec = {string.format("ropes:%s%irope_block", node_prefix, i)} + for n = 1, multiple-i do + table.insert(rec, "ropes:ropesegment") + end + minetest.register_craft({ + output = node_name, + type = "shapeless", + recipe = rec + }) end - - minetest.register_craft({ - output = string.format("ropes:%irope_block", multiple), - type = "shapeless", - recipe = rec - }) end -- Always allow players to disintegrate this into component parts, in case -- there were some in inventory and the setting was changed. minetest.register_craft({ - output = string.format("ropes:1rope_block %i", multiple), + output = "ropes:ropesegment", + type = "shapeless", recipe = { - {string.format('ropes:%irope_block', multiple)} - } + node_name + }, + replacements = { + {node_name, string.format('ropes:%s%irope_block', node_prefix, multiple-1)}, + }, }) end if minetest.get_modpath("doc") then - doc.add_entry_alias("nodes", "ropes:rope", "nodes", string.format("ropes:%irope_block", multiple)) + doc.add_entry_alias("nodes", "ropes:rope", "nodes", node_name) end end @@ -268,17 +284,56 @@ local rope_bottom_def = { end, } ---creates rope blocks with length multiples 1-5. ---second parameter sets how many pixels wide the rope texture is -register_rope_block(1) -register_rope_block(2) -register_rope_block(3) -register_rope_block(4) -register_rope_block(5) -register_rope_block(6) -register_rope_block(7) -register_rope_block(8) -register_rope_block(9) - minetest.register_node("ropes:rope", rope_def) -minetest.register_node("ropes:rope_bottom", rope_bottom_def) \ No newline at end of file +minetest.register_node("ropes:rope_bottom", rope_bottom_def) + +if ropes.woodRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.woodRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:1rope_block", + recipe = { + {'group:wood'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.woodRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.woodRopeBoxMaxMultiple, S("Wood"), "wood", "#86683a", 2) + end + end +end + +if ropes.copperRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.copperRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:1rope_block", + recipe = { + {'default:copper_ingot'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.copperRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.copperRopeBoxMaxMultiple, S("Copper"), "copper", "#c88648") + end + end +end + +if ropes.steelRopeBoxMaxMultiple > 0 or ropes.create_all_definitions then + if ropes.steelRopeBoxMaxMultiple > 0 then + minetest.register_craft({ + output = "ropes:1rope_block", + recipe = { + {'default:steel_ingot'}, + {'group:vines'} + } + }) + end + for i = 1,9 do + if ropes.steelRopeBoxMaxMultiple >= i or ropes.create_all_definitions then + register_rope_block(i, ropes.steelRopeBoxMaxMultiple, S("Steel"), "steel", "#ffffff") + end + end +end diff --git a/settingtypes.txt b/settingtypes.txt index bb0ad2a..242cd76 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -5,10 +5,33 @@ ropes_rope_length (Rope length) int 50 1 30000 #Rope ladders will extend this far at maximum. #Changing this value will not affect rope ladders that already exist in-world. -ropes_rope_ladder_length (Rope ladder length) int 50 1 30000 +#Setting this to 0 disables rope ladders. +ropes_rope_ladder_length (Rope ladder length) int 50 0 30000 -#Sets the maximum length multiple rope box permitted to be crafted. +#Sets the maximum length multiple wooden rope box permitted to be crafted. +#So for example if the rope length is set to 50 and this is set to 2, +#the longest possible wooden rope box a player can craft has 100 meters of rope. +#Allowed values run from 0 to 9. 0 disables wood rope boxes. +ropes_wood_rope_box_max_multiple (Maximum wood_rope box multiple) int 2 0 9 + +#Sets the maximum length multiple copper rope box permitted to be crafted. #So for example if the rope length is set to 50 and this is set to 5, -#the longest possible rope box a player can craft has 250 meters of rope. -#Allowed values run from 1 to 9 -ropes_rope_box_max_multiple (Maximum rope box multiple) int 9 1 9 \ No newline at end of file +#the longest possible copper rope box a player can craft has 250 meters of rope. +#Allowed values run from 0 to 9. 0 disables copper rope boxes. +ropes_copper_rope_box_max_multiple (Maximum copper rope box multiple) int 5 0 9 + +#Sets the maximum length multiple steel rope box permitted to be crafted. +#So for example if the rope length is set to 50 and this is set to 9, +#the longest possible steel rope box a player can craft has 450 meters of rope. +#Allowed values run from 0 to 9. 0 disables steel rope boxes. +ropes_steel_rope_box_max_multiple (Maximum steel rope box multiple) int 9 0 9 + +#If this is set to true, then the mod will generate definitions for the rope boxes +#that are otherwise not permitted by the settings above. These rope boxes +#will not be craftable and will not be available in the creative inventory, +#but they will continue to exist if they were placed "in world" and a player +#can deconstruct them to retrieve their rope components. This setting is +#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 diff --git a/textures/ropes_ropebox_front_1.png b/textures/ropes_ropebox_front_1.png index da2ac5d523b72a6186f8834366c2814102cffd8e..23b6067080d78aa6ec91b8bf1a094020debb46c6 100644 GIT binary patch delta 271 zcmV+q0r39#0@(tPQ-2Br5g*tlK|cTh0Om5GbW)_<3?RnXCQNy=N>NS2OeVy%)X~zEanq{*@e497YDXK znnnnhgpT7TR2;A`4gl6KHU|QbgI+@Y`v+vw_Qd6YLTlnMaDPT{c93my%Chq6U<`;j z4lxIFjWli>L8hNWM(Geh`m9iCQxb&F0F_S%-E6bQ80FO29ISw&iXyZw0FD=~-Hf9& z<>UR$YlRaaOjVO8bzR}qwgZ{(_JqNc*9skgmn1@)+NrfUXaM@J3ehw`e&hb*3~X;Z VHSH?w;s5{u00>D%PDHLkV1jBJc1!>O delta 302 zcmV+}0nz^10{8-uQ-28v11JWM)a(EN0R>4!K~y-)m6J_Q!!QtqU+f~qBo04fLqM{` z30QCdHXMLU`DQ+dS8Y|GGG4g5RVbe4DWrO0wO|t|A28AKt%Zzlu`(>N2xBMl*;!YrG(9P zjTkjjN_h&5F_2P1R~16&Af<#cCZED%+v4kcpHD#u0cJ)VMl@Q3nIVM8r?C4xK$REy z6sBnc09-W{LMI&m^!}xwI3@7*TBA5+pqNSJFZ8&2yykn`kpKVy07*qoM6N<$g1xSV AW&i*H diff --git a/textures/ropes_ropebox_front_2.png b/textures/ropes_ropebox_front_2.png index b3fe838b6d13fb466d9372931b00b9e9978e7140..ee8c471773dc456e2a01368e0e5da771f2a6f2ec 100644 GIT binary patch delta 344 zcmV-e0jK`61EK?vQ-2Br5)PTWG7bO$0WV2JK~y-)m6Od*!ax*-zoC${^hY2VWFR4N z>&nEHD<8xc@%?-e!L%h%kanPrO3TI}BzBT=w{!BHIp@w;{GT_Ve0jQGJU-0m`yGb8 zE^(rsfmh)DQryNc>up9Q1jBwn@%;BaGCaq|^BmM(nPg@_yj<}ahRE@RshnH|m;pjNXX=3Mbak{@(-JK?o>1gD zi!ekfUw6C*CoqRfczRjJ6=Xa@sg>O+>LIHx2*$w07vbt@`Awk0giuXjXGc| zC7Z7;t7L~`cTtR6r~{OMI6Jorl1-|&P&VzrS|vNy+myhy8IJ~6ZJ`Bl6S!omIKN1f qzAi!qFzES+sv?Rb{TI$>mvaKMGIS9c6v3SU0000;y9Klie!Jk#u2?PQ^axTby^hf<*~KH1|mYx^jWPpuz&ra+wLGDb_ODXF{UC9 zheNU~#~5?a#61>mou)LEPqV4e8~wj008FMcvMi^6aY>QqM-6@@NRk8*smQ6$@YN|I zLXsqQ35+on`DHXh>i}bnT>=25R7DON4bpUtQp)}YWmz(rj?p?`(C@Q&TT+&#U4k$S z@jS00>%5>91Y&reM;M0oEnIz(XY&=xuiMw?x-KG8k#P&=i!~yG>$>(We3N^f7AN(Z zeGA*|7J#!>gH#vQkKCR8nZR)z0J`k}M}+ZYOqS(8X1n?XjEAi9N_WlY00000NkvXX Hu0mjfn2)B} diff --git a/textures/ropes_ropebox_front_3.png b/textures/ropes_ropebox_front_3.png index 924b35f05ae25b50503a317e872c5517affd5fe5..4e420cd6fd167cca92cb1d649310074fc822401e 100644 GIT binary patch delta 402 zcmV;D0d4;L1KR_TQ-2Br5*Pi@n$7?K0cc4?K~y-)jg!kx!cY`N*9ABJB5NBlqk!o>LC(S}Fm-qJP%r~|!CB#m&!d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000NkvXXu0mjf@LLU_ diff --git a/textures/ropes_ropebox_side.png b/textures/ropes_ropebox_side.png index 5584b54c82c2f2a4973a65a4d867f48746910afd..37cfa108910d27f10f0ace9086dc58d5c65f55c8 100644 GIT binary patch delta 338 zcmV-Y0j>U_1e^nqQ-2Br5fo4Kn704`0VzpDK~y-)ZIj_`gfI++zXU_MuG1+xK$mO> z=tdpkC(IPu!Hz2BQ0DdJHvKI@0vVTg^2Ap9BtCf@4go#bE zH*s0AgktGVTC)KIcvWd#j%Nl7T}blH2!BW@sekI-j7Lj|Rb+?MGsSmZ{MOl~(h_VB zQ|pR212>&5R>lq3#bXwaGgR|hQ5^|CO?$zfDE4ZXw0`ugP0)CIHwts1yuQF2{dJali*!K*e| ki$R*6{6v#=tVnqN17@gi{pg{&g8%>k07*qoM6N<$g3p+iO#lD@ delta 472 zcmV;}0Vn>P1EBj<1h?F4=Kuzl#q^6KyH&M zAWfv6SQhoz4@1J;T>%1YLm15*j^*?DbP=JHf~vAC3pr}T&~9pz_x9))+nX0Z5ugf#svVi)+ri7z|5`)04XI#oZ+UFGR11G zlv3FD9Wx{6d`0NJPrJ2NYOT2Y1P1W^eo<9am7FtXHZL<^k`EzF!mrm0cc0XMetw8C z5<-|fLI@Yc)_)oza#=E)7T@nT0FTE5Gh^R(&hwmLRrQJhpsKh#?#^)>0OXu!jN>?1 z*OhJCaQDl;8CGjWME)zy?RMk&d;(x*b8O49OoyeE%YmvAW8^%~8RdSzvu)d)(D5lUemHF z$8pSaI>3!-jI1KUzathAdhe|3I*X^HS)-aMrJ4EnPc&LOL|SXOJAVM)97WtE9b85L O0000