mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2024-12-25 18:10:19 +01:00
Vines: Fix recipes and global variables (#13)
This commit is contained in:
parent
c990942ba2
commit
7094d8a369
@ -37,13 +37,13 @@ end
|
|||||||
-- FUNCTIONS
|
-- FUNCTIONS
|
||||||
|
|
||||||
local function on_dig(pos, node, player)
|
local function on_dig(pos, node, player)
|
||||||
vine_name_end = node.name:gsub("_middle", "_end")
|
local vine_name_end = node.name:gsub("_middle", "_end")
|
||||||
drop_item = "vines:vines"
|
local drop_item = "vines:vines"
|
||||||
if enable_vines == false then
|
if enable_vines == false then
|
||||||
drop_item = vine_name_end
|
drop_item = vine_name_end
|
||||||
end
|
end
|
||||||
|
|
||||||
wielded_item = player and player:get_wielded_item()
|
local wielded_item = player and player:get_wielded_item()
|
||||||
if wielded_item then
|
if wielded_item then
|
||||||
wielded_item:add_wear(1)
|
wielded_item:add_wear(1)
|
||||||
if wielded_item:get_name() == 'vines:shears' then
|
if wielded_item:get_name() == 'vines:shears' then
|
||||||
@ -51,7 +51,7 @@ local function on_dig(pos, node, player)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
break_pos = {x = pos.x, y = pos.y, z = pos.z}
|
local break_pos = {x = pos.x, y = pos.y, z = pos.z}
|
||||||
while minetest.get_item_group(minetest.get_node(break_pos).name, "vines") > 0 do
|
while minetest.get_item_group(minetest.get_node(break_pos).name, "vines") > 0 do
|
||||||
minetest.remove_node(break_pos)
|
minetest.remove_node(break_pos)
|
||||||
minetest.handle_node_drops(break_pos, {drop_item}, player)
|
minetest.handle_node_drops(break_pos, {drop_item}, player)
|
||||||
@ -63,7 +63,7 @@ local function ensure_vine_end(pos, oldnode)
|
|||||||
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
local np = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
local nn = minetest.get_node(np)
|
local nn = minetest.get_node(np)
|
||||||
|
|
||||||
vine_name_end = oldnode.name:gsub("_middle", "_end")
|
local vine_name_end = oldnode.name:gsub("_middle", "_end")
|
||||||
|
|
||||||
if minetest.get_item_group(nn.name, "vines") > 0 then
|
if minetest.get_item_group(nn.name, "vines") > 0 then
|
||||||
minetest.swap_node(np, { name = vine_name_end, param2 = oldnode.param2 })
|
minetest.swap_node(np, { name = vine_name_end, param2 = oldnode.param2 })
|
||||||
@ -199,19 +199,19 @@ minetest.register_alias( 'vines:jungle_rotten', 'air' )
|
|||||||
minetest.register_alias( 'vines:willow', 'air' )
|
minetest.register_alias( 'vines:willow', 'air' )
|
||||||
minetest.register_alias( 'vines:willow_rotten', 'air' )
|
minetest.register_alias( 'vines:willow_rotten', 'air' )
|
||||||
|
|
||||||
-- CRAFTS
|
|
||||||
|
|
||||||
minetest.register_craft({
|
-- ROPE
|
||||||
|
if enable_rope ~= false then
|
||||||
|
minetest.register_craft({
|
||||||
output = 'vines:rope_block',
|
output = 'vines:rope_block',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'group:vines', 'group:vines', 'group:vines'},
|
{'group:vines', 'group:vines', 'group:vines'},
|
||||||
{'group:vines', 'group:wood', 'group:vines'},
|
{'group:vines', 'group:wood', 'group:vines'},
|
||||||
{'group:vines', 'group:vines', 'group:vines'},
|
{'group:vines', 'group:vines', 'group:vines'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if minetest.get_modpath("moreblocks") then
|
|
||||||
|
|
||||||
|
if minetest.get_modpath("moreblocks") then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'vines:rope_block',
|
output = 'vines:rope_block',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -220,20 +220,8 @@ if minetest.get_modpath("moreblocks") then
|
|||||||
{'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'},
|
{'moreblocks:rope', 'moreblocks:rope', 'moreblocks:rope'},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_craft({
|
|
||||||
output = 'vines:shears',
|
|
||||||
recipe = {
|
|
||||||
{'', 'default:steel_ingot', ''},
|
|
||||||
{'group:stick', 'group:wood', 'default:steel_ingot'},
|
|
||||||
{'', '', 'group:stick'}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
-- NODES
|
|
||||||
|
|
||||||
if enable_rope ~= false then
|
|
||||||
minetest.register_node("vines:rope_block", {
|
minetest.register_node("vines:rope_block", {
|
||||||
description = S("Rope"),
|
description = S("Rope"),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
@ -341,7 +329,6 @@ if enable_rope ~= false then
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- SHEARS
|
-- SHEARS
|
||||||
|
|
||||||
minetest.register_tool("vines:shears", {
|
minetest.register_tool("vines:shears", {
|
||||||
description = S("Shears"),
|
description = S("Shears"),
|
||||||
inventory_image = "vines_shears.png",
|
inventory_image = "vines_shears.png",
|
||||||
@ -357,7 +344,16 @@ minetest.register_tool("vines:shears", {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- VINES
|
minetest.register_craft({
|
||||||
|
output = 'vines:shears',
|
||||||
|
recipe = {
|
||||||
|
{'', 'default:steel_ingot', ''},
|
||||||
|
{'group:stick', 'group:wood', 'default:steel_ingot'},
|
||||||
|
{'', '', 'group:stick'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- ROOT VINES
|
||||||
if enable_roots ~= false then
|
if enable_roots ~= false then
|
||||||
vines.register_vine('root',
|
vines.register_vine('root',
|
||||||
{description = S("Roots"), average_length = 9}, {
|
{description = S("Roots"), average_length = 9}, {
|
||||||
@ -380,6 +376,7 @@ else
|
|||||||
minetest.register_alias('vines:root_end', 'air')
|
minetest.register_alias('vines:root_end', 'air')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- STANDARD VINES
|
||||||
if enable_standard ~= false then
|
if enable_standard ~= false then
|
||||||
vines.register_vine('vine',
|
vines.register_vine('vine',
|
||||||
{description = S("Vines"), average_length = 5}, {
|
{description = S("Vines"), average_length = 5}, {
|
||||||
@ -405,6 +402,7 @@ else
|
|||||||
minetest.register_alias('vines:vine_end', 'air')
|
minetest.register_alias('vines:vine_end', 'air')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- SIDE VINES
|
||||||
if enable_side ~= false then
|
if enable_side ~= false then
|
||||||
vines.register_vine('side',
|
vines.register_vine('side',
|
||||||
{description = S("Vines"), average_length = 6}, {
|
{description = S("Vines"), average_length = 6}, {
|
||||||
@ -430,6 +428,7 @@ else
|
|||||||
minetest.register_alias('vines:side_end', 'air')
|
minetest.register_alias('vines:side_end', 'air')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- JUNGLE VINES
|
||||||
if enable_jungle ~= false then
|
if enable_jungle ~= false then
|
||||||
vines.register_vine("jungle",
|
vines.register_vine("jungle",
|
||||||
{description = S("Jungle Vines"), average_length = 7}, {
|
{description = S("Jungle Vines"), average_length = 7}, {
|
||||||
@ -463,6 +462,7 @@ else
|
|||||||
minetest.register_alias('vines:jungle_end', 'air')
|
minetest.register_alias('vines:jungle_end', 'air')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- WILLOW VINES
|
||||||
if enable_willow ~= false then
|
if enable_willow ~= false then
|
||||||
vines.register_vine( 'willow',
|
vines.register_vine( 'willow',
|
||||||
{description = S("Willow Vines"), average_length = 9}, {
|
{description = S("Willow Vines"), average_length = 9}, {
|
||||||
@ -485,4 +485,3 @@ else
|
|||||||
minetest.register_alias('vines:willow_middle', 'air')
|
minetest.register_alias('vines:willow_middle', 'air')
|
||||||
minetest.register_alias('vines:willow_end', 'air')
|
minetest.register_alias('vines:willow_end', 'air')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user