Let papyrus grow on roots (MTG), make crafting cheaper
parent
b28b094cff
commit
16ab332180
|
@ -1 +1,2 @@
|
||||||
default
|
default
|
||||||
|
nodetest?
|
||||||
|
|
|
@ -27,21 +27,20 @@ minetest.register_node(":nodetest:papyrus_roots", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
liquids_pointable = true,
|
liquids_pointable = true,
|
||||||
groups = {snappy=3,flammable=2},
|
groups = {snappy=3, flammable=2},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'nodetest:papyrus_roots',
|
output = 'nodetest:papyrus_roots',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'default:papyrus', 'default:papyrus', 'default:papyrus'},
|
{'default:papyrus', 'default:papyrus'},
|
||||||
{'default:papyrus', 'default:papyrus', 'default:papyrus'},
|
{'default:papyrus', 'default:papyrus'},
|
||||||
{'default:papyrus', 'default:papyrus', 'default:papyrus'},
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = 'default:papyrus 9',
|
output = 'default:papyrus 4',
|
||||||
recipe = {
|
recipe = {
|
||||||
{'nodetest:papyrus_roots'},
|
{'nodetest:papyrus_roots'},
|
||||||
}
|
}
|
||||||
|
@ -50,8 +49,8 @@ minetest.register_craft({
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"nodetest:papyrus_roots"},
|
nodenames = {"nodetest:papyrus_roots"},
|
||||||
neighbors = {"group:water"},
|
neighbors = {"group:water"},
|
||||||
interval = 50,
|
interval = 14,
|
||||||
chance = 50,
|
chance = 71,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
pos.y = pos.y+1
|
pos.y = pos.y+1
|
||||||
if minetest.get_node(pos).name == "air" then
|
if minetest.get_node(pos).name == "air" then
|
||||||
|
@ -60,4 +59,41 @@ minetest.register_abm({
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local function grow_papyrus(pos, node)
|
||||||
|
pos.y = pos.y - 1
|
||||||
|
local name = minetest.get_node(pos).name
|
||||||
|
if name ~= "nodetest:papyrus_roots" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not minetest.find_node_near(pos, 3, {"group:water"}) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
local height = 0
|
||||||
|
while node.name == "default:papyrus" and height < 4 do
|
||||||
|
height = height + 1
|
||||||
|
pos.y = pos.y + 1
|
||||||
|
node = minetest.get_node(pos)
|
||||||
|
end
|
||||||
|
if height == 4 or node.name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if minetest.get_node_light(pos) < 13 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
minetest.set_node(pos, {name = "default:papyrus"})
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
label = "Grow papyrus on roots",
|
||||||
|
nodenames = {"default:papyrus"},
|
||||||
|
neighbors = {"nodetest:papyrus_roots"},
|
||||||
|
interval = 14,
|
||||||
|
chance = 71,
|
||||||
|
action = function(...)
|
||||||
|
grow_papyrus(...)
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue