Add multiple material types.

This commit is contained in:
FaceDeer 2017-02-09 21:29:42 -07:00
parent ad26d725c3
commit 7f7ca3514e
13 changed files with 277 additions and 175 deletions

@ -6,9 +6,9 @@ if minetest.get_modpath("farming") then
minetest.register_craft({ minetest.register_craft({
output = 'ropes:ropesegment', output = 'ropes:ropesegment',
recipe = { recipe = {
{'farming:cotton',}, {'farming:cotton','farming:cotton'},
{'farming:cotton',}, {'farming:cotton','farming:cotton'},
{'farming:cotton'} {'farming:cotton','farming:cotton'}
} }
}) })
end end
@ -21,68 +21,14 @@ minetest.register_craftitem("ropes:ropesegment", {
inventory_image = "ropes_item.png", 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 cotton_burn_time = 1
local wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:wood")}}).time ropes.wood_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:wood")}}).time
local rope_burn_time = cotton_burn_time * 3 ropes.rope_burn_time = cotton_burn_time * 6
local rope_box_burn_time = wood_burn_time + rope_burn_time * 2
local stick_burn_time = minetest.get_craft_result({method="fuel", width=1, items={ItemStack("default:stick")}}).time 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({ minetest.register_craft({
type = "fuel", type = "fuel",
recipe = "ropes:ropesegment", recipe = "ropes:ropesegment",
burntime = rope_burn_time, burntime = ropes.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,
}) })

27
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_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) 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 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.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) if ropes.woodRopeBoxMaxMultiple == 1 then
else rope_length_doc = rope_length_doc .. "\n" .. S("Wood") .. " " .. S("rope boxes can hold @1m of rope.", ropes.ropeLength)
rope_length_doc = S("Rope boxes contain @1 meters 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 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_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" .. 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("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 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("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")
doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom") doc.add_entry_alias("nodes", "ropes:ropeladder_top", "nodes", "ropes:ropeladder_bottom")

@ -16,11 +16,24 @@ if not ropes.ropeLadderLength then
ropes.ropeLadderLength = 50 ropes.ropeLadderLength = 50
end end
ropes.ropeLengthMaxMultiple = tonumber(minetest.setting_get("ropes_rope_box_max_multiple")) ropes.woodRopeBoxMaxMultiple = tonumber(minetest.setting_get("ropes_wood_rope_box_max_multiple"))
if not ropes.ropeLengthMaxMultiple then if not ropes.woodRopeBoxMaxMultiple then
ropes.ropeLengthMaxMultiple = 9 ropes.woodRopeBoxMaxMultiple = 2
end 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 ) .. "/doc.lua" )
dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" ) dofile( minetest.get_modpath( ropes.name ) .. "/functions.lua" )
dofile( minetest.get_modpath( ropes.name ) .. "/crafts.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 local upgrade_counter = 1
-- For players who used to use the combined vine/rope mod fork I split this out of -- 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({ minetest.register_lbm({
name = "ropes:vines_to_ropes_upgrade_" .. tostring(upgrade_counter), name = "ropes:" .. upgrade_name .. "_" .. tostring(upgrade_counter),
nodenames = {old_node}, nodenames = {old_node},
action = function(pos, node) action = function(pos, node)
minetest.swap_node(pos, {name=new_node, param2=node.param2}) 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 upgrade_counter = upgrade_counter + 1
end end
for i=1,5 do 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 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!")) print(S("[Ropes] Loaded!"))

@ -1,8 +1,29 @@
if ropes.ropeLadderLength == 0 and not ropes.create_all_definitions then
return
end
-- internationalization boilerplate -- internationalization boilerplate
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") 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"), description = S("Rope Ladder"),
_doc_items_longdesc = ropes.doc.ropeladder_longdesc, _doc_items_longdesc = ropes.doc.ropeladder_longdesc,
_doc_items_usagehelp = ropes.doc.ropeladder_usage, _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} 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"}) ropes.destroy_rope(pos_below, {"ropes:ropeladder", "ropes:ropeladder_bottom", "ropes:ropeladder_falling"})
end, 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", { minetest.register_node("ropes:ropeladder", {
description = S("Rope Ladder"), description = S("Rope Ladder"),

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,20 +16,8 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: init.lua:57 #: crafts.lua:17
msgid "[Ropes] Loaded!" msgid "Rope Segment"
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"
msgstr "" msgstr ""
#: doc.lua:11 #: doc.lua:11
@ -58,45 +46,78 @@ msgid ""
"length as before." "length as before."
msgstr "" msgstr ""
#: doc.lua:19 #: doc.lua:17
msgid "" msgid ""
"Rope boxes have a certain amount of rope contained within them specified in " "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 " "the name of the node, and have a limit to how much rope they can support "
"meters in multiples of @2 meters) that can be crafted by combining and " "that depends on the material they're made of. The different lengths can be "
"splitting up rope boxes in the crafting grid. For example, you can craft a " "crafted by combining and splitting up rope boxes in the crafting grid. For "
"@4m rope box by combining two @2m rope boxes, and the two @2m rope boxes can " "example, you can craft a @1m rope box by putting a @2m rope box and a rope "
"be recovered by splitting the @4m rope box back up in the crafting grid." "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 "" msgstr ""
#: doc.lua:21 #: doc.lua:20 doc.lua:22 ropeboxes.lua:302
msgid "Rope boxes contain @1 meters of rope." msgid "Wood"
msgstr "" 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 "" msgid ""
"Ropes are hung by placing rope boxes, which automatically lower a rope of " "Ropes are hung by placing rope boxes, which automatically lower a rope of "
"fixed length below them. They can be climbed and cut." "fixed length below them. They can be climbed and cut."
msgstr "" msgstr ""
#: doc.lua:26 #: doc.lua:39
msgid "" msgid ""
"When a rope box is placed the rope will immediately begin lowering from it " "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 " "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 " "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 " "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 " "goes. If you are near the bottom end of a rope that's extending you'll be "
"rope that's extending you'll be automatically carried down with it. The rope " "automatically carried down with it. The rope will stop when it encounters "
"will stop when it encounters and obstruction, but will resume lowering if " "and obstruction, but will resume lowering if the obstruction is removed."
"the obstruction is removed."
msgstr "" msgstr ""
#: doc.lua:27 #: doc.lua:40
msgid "" msgid ""
"A rope can be severed midway using an axe or other similar tools. The " "A rope can be severed midway using an axe or other similar tool. The section "
"section of rope below the cut will collapse and disappear, potentially " "of rope below the cut will collapse and disappear, potentially causing "
"causing players who were hanging on to it to fall. The remaining rope will " "players who were hanging on to it to fall. The remaining rope will not "
"not resume descent on its own, but the rope box at the top of the rope " "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 " "\"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 " "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 "" msgstr ""

@ -2,14 +2,14 @@
local MP = minetest.get_modpath(minetest.get_current_modname()) local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua") local S, NS = dofile(MP.."/intllib.lua")
local function rope_box_tiles(count) local function rope_box_tiles(count, tint)
return { return {
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^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),
"ropes_ropebox_side.png", string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint),
"ropes_ropebox_side.png", string.format("ropes_ropebox_side.png^[colorize:%s^ropes_ropebox_side.png", tint),
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^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),
} }
end end
@ -23,7 +23,7 @@ local rope_box_data = {
{0.125, -0.5, -0.125, 0.1875, 0.125, 0.125}, -- support {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 --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection
tiles = rope_box_tiles(1), tiles = 1,
}, },
{ {
node={ node={
@ -34,7 +34,7 @@ local rope_box_data = {
{0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support {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 --selection = {-0.1875, -0.5, -0.25, 0.1875, 0.25, 0.25}, -- selection
tiles = rope_box_tiles(2), tiles = 2,
}, },
{ {
node={ node={
@ -45,7 +45,7 @@ local rope_box_data = {
{0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support {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 --selection = {-0.3125, -0.5, -0.25, 0.3125, 0.25, 0.25}, -- selection
tiles = rope_box_tiles(3), tiles = 3,
}, },
{ {
node={ node={
@ -56,7 +56,7 @@ local rope_box_data = {
{0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support {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 --selection = {-0.375, -0.5, -0.25, 0.375, 0.25, 0.25}, -- selection
tiles = rope_box_tiles(4), tiles = 4,
}, },
{ {
node={ node={
@ -67,7 +67,7 @@ local rope_box_data = {
{0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support {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 --selection = {-0.4375, -0.5, -0.25, 0.4375, 0.25, 0.25}, -- selection
tiles = rope_box_tiles(5), tiles = 5,
}, },
{ {
node={ node={
@ -78,7 +78,7 @@ local rope_box_data = {
{0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- support {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 --selection = {-0.1875, -0.5, -0.3125, 0.1875, 0.3125, 0.3125}, -- selection
tiles = rope_box_tiles(2), tiles = 2,
}, },
{ {
node={ node={
@ -89,7 +89,7 @@ local rope_box_data = {
{0.25, -0.5, -0.125, 0.3125, 0.125, 0.125}, -- support {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 --selection = {-0.3125, -0.5, -0.3125, 0.3125, 0.3125, 0.3125}, -- selection
tiles = rope_box_tiles(3), tiles = 3,
}, },
{ {
node={ node={
@ -100,7 +100,7 @@ local rope_box_data = {
{0.3125, -0.5, -0.125, 0.375, 0.125, 0.125}, -- support {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 --selection = {-0.375, -0.5, -0.3125, 0.375, 0.3125, 0.3125}, -- selection
tiles = rope_box_tiles(4), tiles = 4,
}, },
{ {
node={ node={
@ -111,13 +111,14 @@ local rope_box_data = {
{0.375, -0.5, -0.125, 0.4375, 0.125, 0.125}, -- support {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 --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 = { 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, _doc_items_create_entry = false,
drawtype="nodebox", drawtype="nodebox",
sunlight_propagates = true, sunlight_propagates = true,
@ -125,14 +126,14 @@ local function register_rope_block(multiple)
paramtype2 = "wallmounted", paramtype2 = "wallmounted",
walkable = false, walkable = false,
climbable = true, climbable = true,
tiles = rope_box_data[multiple].tiles, tiles = rope_box_tiles(rope_box_data[multiple].tiles, tint),
node_box = { node_box = {
type = "fixed", type = "fixed",
fixed = rope_box_data[multiple].node fixed = rope_box_data[multiple].node
}, },
selection_box = {type="regular"}, selection_box = {type="regular"},
collision_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) after_place_node = function(pos, placer)
local pos_below = {x=pos.x, y=pos.y-1, z=pos.z} 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 -- 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 -- and if someone digs it we want to disintegrate it into its component parts to prevent
-- reuse. -- reuse.
if multiple > ropes.ropeLengthMaxMultiple then if multiple > max_multiple then
rope_block_def.groups.not_in_creative_inventory = 1 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 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 if (multiple ~= 1) then
-- Only register a recipe to craft this if it's within the permitted multiple range -- Only register a recipe to craft this if it's within the permitted multiple range
if multiple <= ropes.ropeLengthMaxMultiple then if multiple <= max_multiple then
local rec = {} for i = 1, multiple-1 do
for i=1,multiple,1 do local rec = {string.format("ropes:%s%irope_block", node_prefix, i)}
rec[i] = "ropes:1rope_block" for n = 1, multiple-i do
table.insert(rec, "ropes:ropesegment")
end end
minetest.register_craft({ minetest.register_craft({
output = string.format("ropes:%irope_block", multiple), output = node_name,
type = "shapeless", type = "shapeless",
recipe = rec recipe = rec
}) })
end end
end
-- Always allow players to disintegrate this into component parts, in case -- Always allow players to disintegrate this into component parts, in case
-- there were some in inventory and the setting was changed. -- there were some in inventory and the setting was changed.
minetest.register_craft({ minetest.register_craft({
output = string.format("ropes:1rope_block %i", multiple), output = "ropes:ropesegment",
type = "shapeless",
recipe = { recipe = {
{string.format('ropes:%irope_block', multiple)} node_name
} },
replacements = {
{node_name, string.format('ropes:%s%irope_block', node_prefix, multiple-1)},
},
}) })
end end
if minetest.get_modpath("doc") then 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
end end
@ -268,17 +284,56 @@ local rope_bottom_def = {
end, 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", rope_def)
minetest.register_node("ropes:rope_bottom", rope_bottom_def) 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

@ -5,10 +5,33 @@ ropes_rope_length (Rope length) int 50 1 30000
#Rope ladders will extend this far at maximum. #Rope ladders will extend this far at maximum.
#Changing this value will not affect rope ladders that already exist in-world. #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, #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. #the longest possible copper rope box a player can craft has 250 meters of rope.
#Allowed values run from 1 to 9 #Allowed values run from 0 to 9. 0 disables copper rope boxes.
ropes_rope_box_max_multiple (Maximum rope box multiple) int 9 1 9 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 376 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 573 B

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

After

Width:  |  Height:  |  Size: 412 B