2013-07-17 21:34:35 +02:00
|
|
|
-- Code of rubber tree by PilzAdam
|
|
|
|
|
2014-04-16 19:10:00 +02:00
|
|
|
local S = technic.worldgen.gettext
|
|
|
|
|
2013-07-17 21:34:35 +02:00
|
|
|
minetest.register_node(":moretrees:rubber_tree_sapling", {
|
2014-04-16 19:10:00 +02:00
|
|
|
description = S("Rubber Tree Sapling"),
|
2013-07-17 21:34:35 +02:00
|
|
|
drawtype = "plantlike",
|
2017-03-28 21:04:28 +02:00
|
|
|
tiles = { "technic_rubber_sapling.png" },
|
2013-07-17 21:34:35 +02:00
|
|
|
inventory_image = "technic_rubber_sapling.png",
|
|
|
|
wield_image = "technic_rubber_sapling.png",
|
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
2017-03-28 21:04:28 +02:00
|
|
|
groups = { dig_immediate = 3, flammable = 2 },
|
2013-07-17 21:34:35 +02:00
|
|
|
sounds = default.node_sound_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = "fuel",
|
|
|
|
recipe = "moretrees:rubber_tree_sapling",
|
|
|
|
burntime = 10
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node(":moretrees:rubber_tree_trunk", {
|
2014-04-16 19:10:00 +02:00
|
|
|
description = S("Rubber Tree"),
|
2017-03-28 21:04:28 +02:00
|
|
|
tiles = {
|
|
|
|
"default_tree_top.png", "default_tree_top.png",
|
|
|
|
"technic_rubber_tree_full.png"
|
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
tree = 1,
|
|
|
|
snappy = 1,
|
|
|
|
choppy = 2,
|
|
|
|
oddly_breakable_by_hand = 1,
|
|
|
|
flammable = 2
|
|
|
|
},
|
2013-07-17 21:34:35 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node(":moretrees:rubber_tree_trunk_empty", {
|
2014-04-16 19:10:00 +02:00
|
|
|
description = S("Rubber Tree"),
|
2017-03-28 21:04:28 +02:00
|
|
|
tiles = {
|
|
|
|
"default_tree_top.png", "default_tree_top.png",
|
|
|
|
"technic_rubber_tree_empty.png"
|
|
|
|
},
|
|
|
|
groups = {
|
|
|
|
tree = 1,
|
|
|
|
snappy = 1,
|
|
|
|
choppy = 2,
|
|
|
|
oddly_breakable_by_hand = 1,
|
|
|
|
flammable = 2,
|
|
|
|
not_in_creative_inventory = 1
|
|
|
|
},
|
2013-07-17 21:34:35 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node(":moretrees:rubber_tree_leaves", {
|
|
|
|
drawtype = "allfaces_optional",
|
2015-07-25 15:46:17 +02:00
|
|
|
description = S("Rubber Tree Leaves"),
|
2017-03-28 21:04:28 +02:00
|
|
|
tiles = { "technic_rubber_leaves.png" },
|
2013-07-17 21:34:35 +02:00
|
|
|
paramtype = "light",
|
2017-03-28 21:04:28 +02:00
|
|
|
groups = { snappy = 3, leafdecay = 3, flammable = 2, leaves = 1 },
|
2013-07-17 21:34:35 +02:00
|
|
|
drop = {
|
|
|
|
max_items = 1,
|
2017-03-28 21:04:28 +02:00
|
|
|
items = {
|
|
|
|
{
|
|
|
|
items = { "moretrees:rubber_tree_sapling" },
|
|
|
|
rarity = 20,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
items = { "moretrees:rubber_tree_leaves" },
|
|
|
|
}
|
2015-03-22 19:34:35 +01:00
|
|
|
}
|
2013-07-17 21:34:35 +02:00
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
|
|
|
|
2017-03-28 21:04:28 +02:00
|
|
|
technic.rubber_tree_model = {
|
2013-07-17 21:34:35 +02:00
|
|
|
axiom = "FFFFA",
|
|
|
|
rules_a = "[&FFBFA]////[&BFFFA]////[&FBFFA]",
|
|
|
|
rules_b = "[&FFA]////[&FFA]////[&FFA]",
|
|
|
|
trunk = "moretrees:rubber_tree_trunk",
|
|
|
|
leaves = "moretrees:rubber_tree_leaves",
|
|
|
|
angle = 35,
|
|
|
|
iterations = 3,
|
|
|
|
random_level = 1,
|
|
|
|
trunk_type = "double",
|
|
|
|
thin_branches = true
|
|
|
|
}
|
|
|
|
|
|
|
|
minetest.register_abm({
|
2017-03-28 21:04:28 +02:00
|
|
|
nodenames = { "moretrees:rubber_tree_sapling" },
|
2013-07-17 21:34:35 +02:00
|
|
|
interval = 60,
|
|
|
|
chance = 20,
|
|
|
|
action = function(pos, node)
|
|
|
|
minetest.remove_node(pos)
|
|
|
|
minetest.spawn_tree(pos, technic.rubber_tree_model)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
if technic.config:get_bool("enable_rubber_tree_generation") then
|
|
|
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
|
|
|
if math.random(1, 100) > 5 then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local tmp = {
|
2017-03-28 21:04:28 +02:00
|
|
|
x = (maxp.x - minp.x) / 2 + minp.x,
|
|
|
|
y = (maxp.y - minp.y) / 2 + minp.y,
|
|
|
|
z = (maxp.z - minp.z) / 2 + minp.z
|
|
|
|
}
|
2013-07-17 21:34:35 +02:00
|
|
|
local pos = minetest.find_node_near(tmp, maxp.x - minp.x,
|
2017-03-28 21:04:28 +02:00
|
|
|
{ "default:dirt_with_grass" })
|
2013-07-17 21:34:35 +02:00
|
|
|
if pos ~= nil then
|
2017-03-28 21:04:28 +02:00
|
|
|
minetest.spawn_tree({ x = pos.x, y = pos.y + 1, z = pos.z }, technic.rubber_tree_model)
|
2013-07-17 21:34:35 +02:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|