2014-08-12 21:08:11 +02:00
|
|
|
-- Bushes Mod by Mossmanikin, Evergreen, & Neuromancer
|
2018-11-09 00:29:07 +01:00
|
|
|
-- The initial code for this was taken from Mossmanikin's Grasses Mod,
|
|
|
|
-- then heavilly modified by Neuromancer for this mod.
|
2014-08-12 21:08:11 +02:00
|
|
|
-- Mossmanikin also greatly helped with providing samples for coding.
|
2018-11-09 00:29:07 +01:00
|
|
|
-- bush leaf textures are from VannessaE's moretrees mod.
|
|
|
|
-- (Leaf texture created by RealBadAngel or VanessaE)
|
2014-08-12 21:08:11 +02:00
|
|
|
-- Branch textures created by Neuromancer.
|
2018-02-18 01:28:43 +01:00
|
|
|
|
2020-07-23 22:03:13 +02:00
|
|
|
local random = math.random
|
|
|
|
|
2017-08-03 15:02:56 +02:00
|
|
|
-- support for i18n
|
2020-02-15 15:32:06 +01:00
|
|
|
local S = minetest.get_translator("bushes")
|
2018-02-18 01:28:43 +01:00
|
|
|
abstract_bushes = {}
|
2014-08-12 21:08:11 +02:00
|
|
|
|
|
|
|
minetest.register_node("bushes:youngtree2_bottom", {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Young Tree 2 (bottom)"),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype="nodebox",
|
2014-06-04 22:09:06 +02:00
|
|
|
tiles = {"bushes_youngtree2trunk.png"},
|
2018-02-18 01:28:43 +01:00
|
|
|
inventory_image = "bushes_youngtree2trunk_inv.png",
|
|
|
|
wield_image = "bushes_youngtree2trunk_inv.png",
|
2014-08-12 21:08:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
walkable = false,
|
|
|
|
is_ground_content = true,
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
--{0.375000,-0.500000,-0.500000,0.500000,0.500000,-0.375000}, --NodeBox 1
|
|
|
|
{-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1
|
|
|
|
}
|
|
|
|
},
|
2021-06-20 02:34:22 +02:00
|
|
|
groups = {snappy=3,flammable=2,attached_node=1},
|
2014-08-12 21:08:11 +02:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2014-06-04 22:09:06 +02:00
|
|
|
drop = 'default:stick'
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
2018-02-18 01:28:43 +01:00
|
|
|
|
|
|
|
local BushBranchCenter = { {1,1}, {3,2} }
|
2014-08-12 21:08:11 +02:00
|
|
|
for i in pairs(BushBranchCenter) do
|
2018-02-18 01:28:43 +01:00
|
|
|
local Num = BushBranchCenter[i][1]
|
|
|
|
local TexNum = BushBranchCenter[i][2]
|
2014-08-12 21:08:11 +02:00
|
|
|
minetest.register_node("bushes:bushbranches"..Num, {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Bush Branches @1", Num),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
|
|
|
"bushes_leaves_"..TexNum..".png",
|
|
|
|
"bushes_branches_center_"..TexNum..".png"
|
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{0, -1/2, -1/2, -1/4, 1/2, 1/2},
|
|
|
|
{0, -1/2, -1/2, 1/4, 1/2, 1/2}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
|
|
|
|
},
|
|
|
|
inventory_image = "bushes_branches_center_"..TexNum..".png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
groups = {
|
|
|
|
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks
|
2018-02-18 01:28:43 +01:00
|
|
|
snappy=3,
|
|
|
|
flammable=2,
|
2021-06-20 02:34:22 +02:00
|
|
|
leaves=1,
|
|
|
|
attached_node=1
|
2014-08-12 21:08:11 +02:00
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2014-06-04 22:09:06 +02:00
|
|
|
drop = 'default:stick 4'
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2018-02-18 01:28:43 +01:00
|
|
|
local BushBranchSide = { {2,1}, {4,2} }
|
2014-08-12 21:08:11 +02:00
|
|
|
for i in pairs(BushBranchSide) do
|
2018-02-18 01:28:43 +01:00
|
|
|
local Num = BushBranchSide[i][1]
|
|
|
|
local TexNum = BushBranchSide[i][2]
|
2014-08-12 21:08:11 +02:00
|
|
|
minetest.register_node("bushes:bushbranches"..Num, {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Bush Branches @1", Num),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
tiles = {
|
2018-02-18 01:28:43 +01:00
|
|
|
--[[top]] "bushes_leaves_"..TexNum..".png",
|
2014-08-12 21:08:11 +02:00
|
|
|
--[[bottom]]"bushes_branches_center_"..TexNum..".png",
|
|
|
|
--[[right]] "bushes_branches_left_"..TexNum..".png",
|
|
|
|
--[[left]] "bushes_branches_right_"..TexNum..".png", -- MM: We could also mirror the previous here,
|
2018-02-18 01:28:43 +01:00
|
|
|
--[[back]] "bushes_branches_center_"..TexNum..".png",-- unless U really want 'em 2 B different
|
|
|
|
--[[front]] "bushes_branches_right_"..TexNum..".png"
|
2014-08-12 21:08:11 +02:00
|
|
|
},
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
-- { left , bottom , front, right , top , back }
|
|
|
|
{0.137748,-0.491944, 0.5 ,-0.125000,-0.179444,-0.007790}, --NodeBox 1
|
|
|
|
{0.262748,-0.185995, 0.5 ,-0.237252, 0.126505,-0.260269}, --NodeBox 2
|
|
|
|
{0.500000, 0.125000, 0.5 ,-0.500000, 0.500000,-0.500000}, --NodeBox 3
|
|
|
|
},
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/2, -1/2, -1/2, 1/2, 1/2, 1/2},
|
|
|
|
},
|
|
|
|
inventory_image = "bushes_branches_right_"..TexNum..".png",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
groups = {
|
|
|
|
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks
|
2018-02-18 01:28:43 +01:00
|
|
|
snappy=3,
|
|
|
|
flammable=2,
|
2021-06-20 02:34:22 +02:00
|
|
|
leaves=1,
|
|
|
|
attached_node=1
|
2014-08-12 21:08:11 +02:00
|
|
|
},
|
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
2014-06-04 22:09:06 +02:00
|
|
|
drop = 'default:stick 3'
|
2014-08-12 21:08:11 +02:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2018-02-18 01:28:43 +01:00
|
|
|
local BushLeafNode = { {1}, {2}}
|
2014-08-12 21:08:11 +02:00
|
|
|
for i in pairs(BushLeafNode) do
|
2018-02-18 01:28:43 +01:00
|
|
|
local Num = BushLeafNode[i][1]
|
2014-08-12 21:08:11 +02:00
|
|
|
minetest.register_node("bushes:BushLeaves"..Num, {
|
2017-08-03 15:02:56 +02:00
|
|
|
description = S("Bush Leaves @1", Num),
|
2014-08-12 21:08:11 +02:00
|
|
|
drawtype = "allfaces_optional",
|
|
|
|
tiles = {"bushes_leaves_"..Num..".png"},
|
|
|
|
paramtype = "light",
|
2018-02-18 01:28:43 +01:00
|
|
|
groups = { -- MM: Should we add leafdecay?
|
2014-08-12 21:08:11 +02:00
|
|
|
snappy=3,
|
|
|
|
flammable=2,
|
|
|
|
attached_node=1
|
|
|
|
},
|
2018-02-18 01:28:43 +01:00
|
|
|
sounds = default.node_sound_leaves_defaults(),
|
|
|
|
})
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
abstract_bushes.grow_bush = function(pos)
|
2020-07-23 22:03:13 +02:00
|
|
|
local leaf_type = random(1,2)
|
|
|
|
for _, pos_dir in ipairs({
|
|
|
|
{ pos = {x=pos.x+1, y=pos.y+random(0,1), z=pos.z},
|
|
|
|
dir = 3},
|
|
|
|
{ pos = {x=pos.x-1, y=pos.y+random(0,1), z=pos.z},
|
|
|
|
dir = 1},
|
|
|
|
{ pos = {x=pos.x, y=pos.y+random(0,1), z=pos.z+1},
|
|
|
|
dir = 2},
|
|
|
|
{ pos = {x=pos.x, y=pos.y+random(0,1), z=pos.z-1},
|
|
|
|
dir = 0}
|
|
|
|
}) do
|
|
|
|
if random(1,10) > 5 then
|
|
|
|
abstract_bushes.grow_bush_node(pos_dir.pos, pos_dir.dir, leaf_type)
|
2018-02-18 01:28:43 +01:00
|
|
|
end
|
2020-07-23 22:03:13 +02:00
|
|
|
end
|
|
|
|
abstract_bushes.grow_bush_node(pos,5,leaf_type)
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
abstract_bushes.grow_bush_node = function(pos,dir, leaf_type)
|
2018-02-18 01:28:43 +01:00
|
|
|
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
|
|
|
local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z}
|
2018-02-18 01:28:43 +01:00
|
|
|
|
2014-11-20 17:18:53 +01:00
|
|
|
local bush_branch_type = 2
|
2018-02-18 01:28:43 +01:00
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
-- MM: I'm not sure if it's slower now than before...
|
|
|
|
if dir ~= 5 and leaf_type == 1 then
|
|
|
|
bush_branch_type = 2
|
|
|
|
end
|
|
|
|
if dir ~= 5 and leaf_type == 2 then
|
|
|
|
bush_branch_type = 4
|
|
|
|
end
|
|
|
|
if dir == 5 and leaf_type == 1 then
|
|
|
|
bush_branch_type = 1
|
|
|
|
dir = 1
|
|
|
|
end
|
|
|
|
if dir == 5 and leaf_type == 2 then
|
|
|
|
bush_branch_type = 3
|
|
|
|
dir = 1
|
|
|
|
end
|
2018-02-18 01:28:43 +01:00
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
|
|
|
or minetest.get_node(right_here).name == "default:junglegrass" then
|
2018-10-25 16:27:54 +02:00
|
|
|
minetest.swap_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir})
|
2014-08-12 21:08:11 +02:00
|
|
|
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
|
2018-10-25 16:27:54 +02:00
|
|
|
minetest.swap_node(above_right_here, {name="bushes:BushLeaves"..leaf_type})
|
2020-07-23 22:03:13 +02:00
|
|
|
if random(1,10) > 5 then
|
2014-08-12 21:08:11 +02:00
|
|
|
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
|
2020-07-23 22:03:13 +02:00
|
|
|
minetest.swap_node({x=pos.x, y=pos.y+3, z=pos.z}, {name="bushes:BushLeaves"..leaf_type})
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-08-09 16:11:30 +02:00
|
|
|
biome_lib:register_generate_plant({
|
2014-08-12 21:08:11 +02:00
|
|
|
surface = {
|
2018-02-18 01:28:43 +01:00
|
|
|
"default:dirt_with_grass",
|
2014-08-12 21:08:11 +02:00
|
|
|
"stoneage:grass_with_silex",
|
|
|
|
"sumpf:peat",
|
|
|
|
"sumpf:sumpf"
|
|
|
|
},
|
|
|
|
max_count = 15, --10,15
|
|
|
|
rarity = 101 - 4, --3,4
|
|
|
|
min_elevation = 1, -- above sea level
|
|
|
|
plantlife_limit = -0.9,
|
|
|
|
},
|
2014-08-15 16:09:01 +02:00
|
|
|
abstract_bushes.grow_bush
|
2018-02-18 01:28:43 +01:00
|
|
|
)
|
2014-08-12 21:08:11 +02:00
|
|
|
|
|
|
|
abstract_bushes.grow_youngtree2 = function(pos)
|
2020-07-23 22:03:13 +02:00
|
|
|
abstract_bushes.grow_youngtree_node2(pos, random(4,5))
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
abstract_bushes.grow_youngtree_node2 = function(pos, height)
|
2018-02-18 01:28:43 +01:00
|
|
|
|
|
|
|
|
2014-08-12 21:08:11 +02:00
|
|
|
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
|
|
|
local above_right_here = {x=pos.x, y=pos.y+2, z=pos.z}
|
|
|
|
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
|
|
|
|
local three_above_right_here = {x=pos.x, y=pos.y+4, z=pos.z}
|
2018-02-18 01:28:43 +01:00
|
|
|
|
2020-07-23 22:03:13 +02:00
|
|
|
if height == 4 and
|
|
|
|
(minetest.get_node(right_here).name == "air" -- instead of check_air = true,
|
|
|
|
or minetest.get_node(right_here).name == "default:junglegrass") then
|
|
|
|
local two_above_right_here_south = {x=pos.x, y=pos.y+3, z=pos.z-1}
|
|
|
|
local three_above_right_here_south = {x=pos.x, y=pos.y+4, z=pos.z-1}
|
|
|
|
minetest.swap_node(right_here, {name="bushes:youngtree2_bottom"})
|
|
|
|
minetest.swap_node(above_right_here, {name="bushes:youngtree2_bottom"})
|
|
|
|
minetest.swap_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2})
|
|
|
|
minetest.swap_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0})
|
|
|
|
minetest.swap_node(three_above_right_here, {name="bushes:BushLeaves1" })
|
|
|
|
minetest.swap_node(three_above_right_here_south, {name="bushes:BushLeaves1" })
|
2014-08-12 21:08:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-08-09 16:11:30 +02:00
|
|
|
biome_lib:register_generate_plant({
|
2014-08-12 21:08:11 +02:00
|
|
|
surface = {
|
2018-02-18 01:28:43 +01:00
|
|
|
"default:dirt_with_grass",
|
2014-08-12 21:08:11 +02:00
|
|
|
"stoneage:grass_with_silex",
|
|
|
|
"sumpf:peat",
|
|
|
|
"sumpf:sumpf"
|
|
|
|
},
|
|
|
|
max_count = 55, --10,15
|
|
|
|
rarity = 101 - 4, --3,4
|
|
|
|
min_elevation = 1, -- above sea level
|
|
|
|
plantlife_limit = -0.9,
|
|
|
|
},
|
2014-08-15 16:09:01 +02:00
|
|
|
abstract_bushes.grow_youngtree2
|
2018-02-18 01:28:43 +01:00
|
|
|
)
|
|
|
|
|
2014-06-04 22:09:06 +02:00
|
|
|
--http://dev.minetest.net/Node_Drawtypes
|
2019-01-05 22:50:35 +01:00
|
|
|
|
|
|
|
minetest.log("action", "[bushes] loaded.")
|