31 Commits

Author SHA1 Message Date
b597f99014 Merge remote-tracking branch 'upstream/master' 2021-06-26 19:07:22 +02:00
bfd08f01c8 Just run the conversion LBM on every load
it won't take any appreciable CPU anyway if there's nothing to do.

Minetest seems to not new (or newly-renamed) LBMs when it should, when
it's set to only run once.  Also covers cases where a crash could
prevent mapblocks being checked later.
2021-06-23 21:09:48 -04:00
9ed4771515 fix rare edge-case where unknown nodes cause a crash
When a new mapblock is generated and the mod checks the neighbors around
a target to place a fallen twig, if it finds an unknown node (because
it's in a neighboring, old mapblock from a previous session -- perhaps
an old moss node that hadn't converted-over to wallmounted yet), trying
to check its buildable_to state will fail, since that requires that
there be a node def to look at, which an unknown node wouldn't have.

This substitutes a known not-buildable_to node for those cases, so that
the code won't try to overwrite what it found.
2021-06-23 21:03:06 -04:00
3f107a8067 renamed the LBM in case it got run at the wrong time
between mod updates; forces it to run again
(it's harmless to let it run twice)
2021-06-23 10:09:58 -04:00
b3cbd3df2e fix moss node drops 2021-06-21 05:21:34 -04:00
b1b4a08834 make pebbles fall when ground is dug. 2021-06-21 00:36:14 -04:00
f01e4bb55f Convert moss to wallmounted mode
I couldn't use leaf decay to make moss disappear when a trunk is dug,
because it breaks leaf decay on that tree's leaves: the leafdecay
function is not a true "register"- type function that can be run more
than once on a given trunk node, it's an all-or-nothing override and
only the last call for any given trunk actually sticks.

Since moss is... was facedir, attached_node didn't work right either, as
it doesn't have a mode to look for a vertical surface behind the
attached object (like how it works with wallmounted items), so this
converts moss to true wallmounted and uses attached_node like I
originally wanted.

To avoid losing the effect where moss can be rotated randomly when
generated, I registered 4 nodes for each moss type, with
increasingly-rotated textures.
2021-06-20 23:30:26 -04:00
637f96e215 Merge remote-tracking branch 'upstream/master' 2021-06-20 17:27:50 +02:00
7b4f54ead0 make youngtrees, bushes fall on dig,
make moss fall when the node holding it is dug,
and make trunk roots decay (exploiting the standard leafdecay function)
2021-06-19 20:36:36 -04:00
c061ef23cf Merge branch 'bls-197' into 'master'
Fixes bug with stalactite placement

See merge request VanessaE/plantlife_modpack!7
2021-06-07 17:04:31 +00:00
d87d8e51f5 Fixes bug with stalactite placement 2021-06-07 17:04:31 +00:00
fa9f30043f Merge remote-tracking branch 'upstream/master' 2021-04-08 13:38:00 +02:00
70df655a42 allow pebbles to spawn on a few more surface types 2021-04-06 04:09:34 -04:00
4876fc1265 let biome_lib place pebbles instead of using custom mapgen code 2021-04-06 04:08:41 -04:00
81b2b0898b don't use a function to pick random dry grasses
just use `biome_lib`'s random-choice table feature
(it was only there to let the mod replace junglegrass, but that's pointless
when junglegrass doesn't tend to spawn in the same areas)
2021-04-06 03:32:04 -04:00
d97f25e112 Merge remote-tracking branch 'upstream/master' 2021-02-13 14:19:21 +01:00
a750bac532 Merge branch 'master' into 'master'
Made woodsoils soils tillable.

See merge request VanessaE/plantlife_modpack!6
2021-02-07 23:29:08 +00:00
b4b24dedba Made woodsoils soils tillable. 2021-02-07 21:17:29 +01:00
86896848d5 Merge remote-tracking branch 'upstream/master' 2020-12-03 20:55:06 +01:00
622016713e respect protection when placing twigs 2020-12-02 10:05:01 -05:00
5b66d54632 Add protection check when placing twigs from trunks mod 2020-07-24 23:14:34 +02:00
031260a62d [youngtrees] Optimize math.random call function 2020-07-24 00:08:50 +02:00
d4e83d7e78 [trunks] Tidy code and disable auto roof corners ABM 2020-07-24 00:03:48 +02:00
8d65559828 [nature_classic] Optimize math.random call function 2020-07-23 23:10:37 +02:00
ec8132b06c [flowers_plus] Optimize math.random call function 2020-07-23 23:02:17 +02:00
4dcf14ce1f [ferns] Optimize math.random call function 2020-07-23 22:59:08 +02:00
d7b543f5d7 [dryplants] Tidy code 2020-07-23 22:45:28 +02:00
f661500cb3 [cavestuff] Optimize math.* call functions 2020-07-23 22:14:52 +02:00
c2681261e0 [bushes_classic] Optimize math.random call function 2020-07-23 22:10:33 +02:00
2c433e0b57 [bushes] Tidy code 2020-07-23 22:05:25 +02:00
1f52bbea19 [vines] Optimize math.random call function 2020-07-23 21:23:51 +02:00
20 changed files with 390 additions and 287 deletions

View File

@ -6,6 +6,8 @@
-- (Leaf texture created by RealBadAngel or VanessaE)
-- Branch textures created by Neuromancer.
local random = math.random
-- support for i18n
local S = minetest.get_translator("bushes")
abstract_bushes = {}
@ -26,7 +28,7 @@ node_box = {
{-0.0612,-0.500000,-0.500000,0.0612,0.500000,-0.375000}, --NodeBox 1
}
},
groups = {snappy=3,flammable=2},
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick'
})
@ -61,7 +63,8 @@ for i in pairs(BushBranchCenter) do
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks
snappy=3,
flammable=2,
leaves=1
leaves=1,
attached_node=1
},
sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick 4'
@ -104,7 +107,8 @@ for i in pairs(BushBranchSide) do
-- tree=1, -- MM: disabled because some recipes use group:tree for trunks
snappy=3,
flammable=2,
leaves=1
leaves=1,
attached_node=1
},
sounds = default.node_sound_leaves_defaults(),
drop = 'default:stick 3'
@ -129,33 +133,22 @@ for i in pairs(BushLeafNode) do
end
abstract_bushes.grow_bush = function(pos)
local leaf_type = math.random(1,2)
local bush_side_height = math.random(0,1)
local chance_of_bush_node_right = math.random(1,10)
if chance_of_bush_node_right> 5 then
local right_pos = {x=pos.x+1, y=pos.y+bush_side_height, z=pos.z}
abstract_bushes.grow_bush_node(right_pos,3,leaf_type)
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)
end
local chance_of_bush_node_left = math.random(1,10)
if chance_of_bush_node_left> 5 then
bush_side_height = math.random(0,1)
local left_pos = {x=pos.x-1, y=pos.y+bush_side_height, z=pos.z}
abstract_bushes.grow_bush_node(left_pos,1,leaf_type)
end
local chance_of_bush_node_front = math.random(1,10)
if chance_of_bush_node_front> 5 then
bush_side_height = math.random(0,1)
local front_pos = {x=pos.x, y=pos.y+bush_side_height, z=pos.z+1}
abstract_bushes.grow_bush_node(front_pos,2,leaf_type)
end
local chance_of_bush_node_back = math.random(1,10)
if chance_of_bush_node_back> 5 then
bush_side_height = math.random(0,1)
local back_pos = {x=pos.x, y=pos.y+bush_side_height, z=pos.z-1}
abstract_bushes.grow_bush_node(back_pos,0,leaf_type)
end
abstract_bushes.grow_bush_node(pos,5,leaf_type)
abstract_bushes.grow_bush_node(pos,5,leaf_type)
end
abstract_bushes.grow_bush_node = function(pos,dir, leaf_type)
@ -187,11 +180,9 @@ abstract_bushes.grow_bush_node = function(pos,dir, leaf_type)
minetest.swap_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir})
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
minetest.swap_node(above_right_here, {name="bushes:BushLeaves"..leaf_type})
local chance_of_high_leaves = math.random(1,10)
if chance_of_high_leaves> 5 then
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
if random(1,10) > 5 then
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
minetest.swap_node(two_above_right_here, {name="bushes:BushLeaves"..leaf_type})
minetest.swap_node({x=pos.x, y=pos.y+3, z=pos.z}, {name="bushes:BushLeaves"..leaf_type})
end
end
end
@ -213,8 +204,7 @@ biome_lib:register_generate_plant({
)
abstract_bushes.grow_youngtree2 = function(pos)
local height = math.random(4,5)
abstract_bushes.grow_youngtree_node2(pos,height)
abstract_bushes.grow_youngtree_node2(pos, random(4,5))
end
abstract_bushes.grow_youngtree_node2 = function(pos, height)
@ -225,9 +215,9 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height)
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}
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then
if height == 4 then
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"})
@ -237,8 +227,6 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height)
minetest.swap_node(three_above_right_here, {name="bushes:BushLeaves1" })
minetest.swap_node(three_above_right_here_south, {name="bushes:BushLeaves1" })
end
end
end

View File

@ -4,6 +4,8 @@ local S = minetest.get_translator("bushes_classic")
plantlife_bushes = {}
-- TODO: add support for nodebreakers? those dig like mese picks
local random = math.random
plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger)
if not (digger and pos and oldnode) then
return
@ -63,7 +65,7 @@ plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger)
-- with a chance of 1/3, return 2 bushes
local amount
if math.random(1,3) == 1 then
if random(1,3) == 1 then
amount = "2"
else
amount = "1"
@ -75,7 +77,7 @@ plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger)
elseif groupcaps.choppy then
-- the amount of sticks may vary
local amount = math.random(4, 20)
local amount = random(4, 20)
-- return some sticks
harvested = "default:stick " .. amount
@ -136,7 +138,7 @@ minetest.register_abm({
local dirt = minetest.get_node(dirtpos)
local is_soil = minetest.get_item_group(dirt.name, "soil") or minetest.get_item_group(dirt.name, "potting_soil")
if is_soil and (dirt.name == "farming:soil_wet" or math.random(1,3) == 1) then
if is_soil and (dirt.name == "farming:soil_wet" or random(1,3) == 1) then
minetest.swap_node( pos, {name = "bushes:" .. bush_name .. "_bush"})
end
end

View File

@ -7,6 +7,8 @@ local mname = "cavestuff"
-- support for i18n
local S = minetest.get_translator("cavestuff")
cavestuff = {}
dofile(minetest.get_modpath("cavestuff").."/nodes.lua")
dofile(minetest.get_modpath("cavestuff").."/mapgen.lua")

View File

@ -1,52 +1,39 @@
--Map Generation Stuff
minetest.register_on_generated(function(minp, maxp, seed)
if maxp.y >= 2 and minp.y <= 0 then
-- Generate pebbles
local perlin1 = minetest.get_perlin(329, 3, 0.6, 100)
-- Assume X and Z lengths are equal
local divlen = 16
local divs = (maxp.x-minp.x)/divlen+1;
for divx=0,divs-1 do
for divz=0,divs-1 do
local x0 = minp.x + math.floor((divx+0)*divlen)
local z0 = minp.z + math.floor((divz+0)*divlen)
local x1 = minp.x + math.floor((divx+1)*divlen)
local z1 = minp.z + math.floor((divz+1)*divlen)
-- Determine pebble amount from perlin noise
local pebble_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 2 * 2)
-- Find random positions for pebbles based on this random
local pr = PseudoRandom(seed+1)
for i=0,pebble_amount do
local x = pr:next(x0, x1)
local z = pr:next(z0, z1)
-- Find ground level (0...15)
local ground_y = nil
for y=30,0,-1 do
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
ground_y = y
break
end
end
biome_lib:register_generate_plant(
{
surface = {
"default:dirt_with_grass",
"default:gravel",
"default:stone",
"default:permafrost_with_stones"
},
max_count = 50,
rarity = 0,
plantlife_limit = -1,
check_air = true,
random_facedir = {0, 3}
},
{
"cavestuff:pebble_1",
"cavestuff:pebble_2"
}
)
if ground_y then
local p = {x=x,y=ground_y+1,z=z}
local nn = minetest.get_node(p).name
-- Check if the node can be replaced
if minetest.registered_nodes[nn] and
minetest.registered_nodes[nn].buildable_to then
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
-- If desert sand, add dry shrub
if nn == "default:dirt_with_grass" then
minetest.swap_node(p,{name="cavestuff:pebble_"..pr:next(1,2), param2=math.random(0,3)})
elseif nn == "default:desert_sand" then
minetest.swap_node(p,{name="cavestuff:desert_pebble_"..pr:next(1,2), param2=math.random(0,3)})
end
end
end
end
end
end
end
end)
biome_lib:register_generate_plant(
{
surface = {
"default:desert_sand",
"default:desert_stone"
},
max_count = 50,
rarity = 0,
plantlife_limit = -1,
check_air = true,
random_facedir = {0, 3}
},
{
"cavestuff:desert_pebble_1",
"cavestuff:desert_pebble_2"
}
)

View File

@ -1,2 +1,2 @@
name = cavestuff
depends = default
depends = default,biome_lib

View File

@ -1,6 +1,8 @@
-- support for i18n
local S = minetest.get_translator("cavestuff")
local random = math.random
--Rocks
local cbox = {
@ -15,12 +17,12 @@ minetest.register_node("cavestuff:pebble_1",{
tiles = {"undergrowth_pebble.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3, stone=1},
groups = {cracky=3, stone=1, attached_node=1},
selection_box = cbox,
collision_box = cbox,
on_place = function(itemstack, placer, pointed_thing)
-- place a random pebble node
local stack = ItemStack("cavestuff:pebble_"..math.random(1,2))
local stack = ItemStack("cavestuff:pebble_"..random(1,2))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("cavestuff:pebble_1 "..itemstack:get_count()-(1-ret:get_count()))
end,
@ -35,7 +37,7 @@ minetest.register_node("cavestuff:pebble_2",{
tiles = {"undergrowth_pebble.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3, stone=1, not_in_creative_inventory=1},
groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
selection_box = cbox,
collision_box = cbox,
sounds = default.node_sound_stone_defaults(),
@ -48,12 +50,12 @@ minetest.register_node("cavestuff:desert_pebble_1",{
tiles = {"default_desert_stone.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3, stone=1},
groups = {cracky=3, stone=1, attached_node=1},
selection_box = cbox,
collision_box = cbox,
on_place = function(itemstack, placer, pointed_thing)
-- place a random pebble node
local stack = ItemStack("cavestuff:desert_pebble_"..math.random(1,2))
local stack = ItemStack("cavestuff:desert_pebble_"..random(1,2))
local ret = minetest.item_place(stack, placer, pointed_thing)
return ItemStack("cavestuff:desert_pebble_1 "..itemstack:get_count()-(1-ret:get_count()))
end,
@ -67,7 +69,7 @@ minetest.register_node("cavestuff:desert_pebble_2",{
tiles = {"default_desert_stone.png"},
paramtype = "light",
paramtype2 = "facedir",
groups = {cracky=3, stone=1, not_in_creative_inventory=1},
groups = {cracky=3, stone=1, attached_node=1, not_in_creative_inventory=1},
selection_box = cbox,
collision_box = cbox,
sounds = default.node_sound_stone_defaults(),
@ -85,19 +87,34 @@ minetest.register_node("cavestuff:stalactite_1",{
node_box = {
type = "fixed",
fixed = {
{-0.187500,0.425000,-0.150003,0.162500,0.500000,0.162500},
{-0.112500,0.162500,-0.100000,0.087500,0.475000,0.087500},
{-0.062500,-0.275000,-0.062500,0.062500,0.500000,0.062500},
{-0.037500,-0.837500,0.037500,0.037500,0.500000,-0.025000},
{-0.187500,-0.425000,-0.150003,0.162500,-0.500000,0.162500},
{-0.112500,-0.162500,-0.100000,0.087500,-0.475000,0.087500},
{-0.062500,0.275000,-0.062500,0.062500,-0.500000,0.062500},
{-0.037500,0.837500,0.037500,0.037500,-0.500000,-0.025000},
}
},
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
if minetest.get_node(pt.under).name=="default:stone"
and minetest.get_node({x=pt.under.x, y=pt.under.y-1, z=pt.under.z}).name=="air"
and minetest.get_node({x=pt.under.x, y=pt.under.y-2, z=pt.under.z}).name=="air" then
minetest.swap_node({x=pt.under.x, y=pt.under.y-1, z=pt.under.z}, {name="cavestuff:stalactite_"..math.random(1,3)})
local dir = vector.subtract(pointed_thing.above, pointed_thing.under)
local base = pointed_thing.under
local place = vector.add(base, dir)
local above = vector.add(place, dir)
if not placer then return end
local playername = placer:get_player_name()
if minetest.is_protected(place, playername)
or minetest.is_protected(above, playername) then
minetest.record_protection_violation(place, playername)
return
end
if minetest.get_node(base).name == "default:stone"
and minetest.get_node(place).name == "air"
and minetest.get_node(above).name == "air"
then
minetest.swap_node(place, {
name = "cavestuff:stalactite_"..math.random(1,3),
param2 = minetest.dir_to_wallmounted(vector.multiply(dir, -1))
})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
@ -116,10 +133,10 @@ minetest.register_node("cavestuff:stalactite_2",{
node_box = {
type = "fixed",
fixed = {
{-0.187500,0.387500,-0.150003,0.162500,0.500000,0.162500},
{-0.112500,0.112500,-0.100000,0.087500,0.475000,0.087500},
{-0.062500,-0.675000,-0.062500,0.062500,0.500000,0.062500},
{-0.037500,-0.975000,0.037500,0.037500,0.500000,-0.025000},
{-0.187500,-0.387500,-0.150003,0.162500,-0.500000,0.162500},
{-0.112500,-0.112500,-0.100000,0.087500,-0.475000,0.087500},
{-0.062500,0.675000,-0.062500,0.062500,-0.500000,0.062500},
{-0.037500,0.975000,0.037500,0.037500,-0.500000,-0.025000},
}
},
})
@ -134,10 +151,10 @@ minetest.register_node("cavestuff:stalactite_3",{
node_box = {
type = "fixed",
fixed = {
{-0.187500,0.387500,-0.150003,0.162500,0.500000,0.162500},
{-0.112500,0.037500,-0.100000,0.087500,0.475000,0.087500},
{-0.062500,-0.437500,-0.062500,0.062500,0.500000,0.062500},
{-0.037500,-1.237500,0.037500,0.037500,0.500000,-0.025000},
{-0.187500,-0.387500,-0.150003,0.162500,-0.500000,0.162500},
{-0.112500,-0.037500,-0.100000,0.087500,-0.475000,0.087500},
{-0.062500,0.437500,-0.062500,0.062500,-0.500000,0.062500},
{-0.037500,1.237500,0.037500,0.037500,-0.500000,-0.025000},
}
},
})

View File

@ -11,8 +11,11 @@
-- support for i18n
local S = minetest.get_translator("dryplants")
local random = math.random
local sqrt = math.sqrt
abstract_dryplants.grow_juncus = function(pos)
local juncus_type = math.random(2,3)
local juncus_type = random(2,3)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then
@ -27,7 +30,7 @@ end
minetest.register_node("dryplants:juncus", {
description = S("Juncus"),
drawtype = "plantlike",
visual_scale = math.sqrt(8),
visual_scale = sqrt(8),
paramtype = "light",
tiles = {"dryplants_juncus_03.png"},
inventory_image = "dryplants_juncus_inv.png",
@ -53,7 +56,7 @@ minetest.register_node("dryplants:juncus", {
return
end
local pos = pointed_thing.under
local juncus_type = math.random(2,3)
local juncus_type = random(2,3)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
if juncus_type == 2 then
minetest.swap_node(right_here, {name="dryplants:juncus_02"})
@ -69,7 +72,7 @@ minetest.register_node("dryplants:juncus", {
minetest.register_node("dryplants:juncus_02", {
description = S("Juncus"),
drawtype = "plantlike",
visual_scale = math.sqrt(8),
visual_scale = sqrt(8),
paramtype = "light",
tiles = {"dryplants_juncus_02.png"},
walkable = false,

View File

@ -8,8 +8,7 @@
-----------------------------------------------------------------------------------------------
abstract_dryplants.grow_grass_variation = function(pos)
local right_here = {x=pos.x, y=pos.y, z=pos.z}
minetest.swap_node(right_here, {name="dryplants:grass_short"})
minetest.swap_node(pos, {name="dryplants:grass_short"})
end
biome_lib:register_generate_plant({

View File

@ -7,16 +7,8 @@
-- Looked at code from: default
-----------------------------------------------------------------------------------------------
abstract_dryplants.grow_grass = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
local grass_size = math.random(1,5)
if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then
minetest.swap_node(right_here, {name="default:grass_"..grass_size})
end
end
biome_lib:register_generate_plant({
biome_lib:register_generate_plant(
{
surface = {
"default:dirt_with_grass",
"stoneage:grass_with_silex",
@ -27,6 +19,12 @@ biome_lib:register_generate_plant({
rarity = 101 - TALL_GRASS_RARITY,
min_elevation = 1, -- above sea level
plantlife_limit = -0.9,
check_air = true,
},
abstract_dryplants.grow_grass
{ "default:grass_1",
"default:grass_2",
"default:grass_3",
"default:grass_4",
"default:grass_5"
}
)

View File

@ -20,13 +20,16 @@
-- support for i18n
local S = minetest.get_translator("dryplants")
local random = math.random
local sqrt = math.sqrt
-----------------------------------------------------------------------------------------------
-- REEDMACE SHAPES
-----------------------------------------------------------------------------------------------
abstract_dryplants.grow_reedmace = function(pos)
local size = math.random(1,3)
local spikes = math.random(1,3)
local size = random(1,3)
local spikes = random(1,3)
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z}
local pos_02 = {x = pos.x, y = pos.y + 2, z = pos.z}
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
@ -51,8 +54,8 @@ abstract_dryplants.grow_reedmace = function(pos)
end
abstract_dryplants.grow_reedmace_water = function(pos)
local size = math.random(1,3)
local spikes = math.random(1,3)
local size = random(1,3)
local spikes = random(1,3)
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z}
local pos_02 = {x = pos.x, y = pos.y + 2, z = pos.z}
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
@ -127,7 +130,7 @@ minetest.register_node("dryplants:reedmace_top", {
minetest.register_node("dryplants:reedmace_height_2", {
description = S("Reedmace, height: 2"),
drawtype = "plantlike",
visual_scale = math.sqrt(8),
visual_scale = sqrt(8),
paramtype = "light",
tiles = {"dryplants_reedmace_height_2.png"},
inventory_image = "dryplants_reedmace_top.png",
@ -150,7 +153,7 @@ minetest.register_node("dryplants:reedmace_height_2", {
minetest.register_node("dryplants:reedmace_height_3", {
description = S("Reedmace, height: 3"),
drawtype = "plantlike",
visual_scale = math.sqrt(8),
visual_scale = sqrt(8),
paramtype = "light",
tiles = {"dryplants_reedmace_height_3.png"},
inventory_image = "dryplants_reedmace_top.png",
@ -173,7 +176,7 @@ minetest.register_node("dryplants:reedmace_height_3", {
minetest.register_node("dryplants:reedmace_height_3_spikes", {
description = S("Reedmace, height: 3 & Spikes"),
drawtype = "plantlike",
visual_scale = math.sqrt(8),
visual_scale = sqrt(8),
paramtype = "light",
tiles = {"dryplants_reedmace_height_3_spikes.png"},
inventory_image = "dryplants_reedmace_top.png",

View File

@ -48,5 +48,5 @@ HAY_DRYING_TIME = 3600 -- seconds
REED_WILL_DRY = false -- wet reed nodes will become dry reed nodes
REED_DRYING_TIME = 3600 -- seconds
AUTO_ROOF_CORNER = true
AUTO_ROOF_CORNER = false

View File

@ -11,6 +11,8 @@ local S = minetest.get_translator("ferns")
assert(abstract_ferns.config.enable_treefern == true)
local random = math.random
abstract_ferns.grow_tree_fern = function(pos)
local pos_aux = {x = pos.x, y = pos.y + 1, z = pos.z}
@ -20,12 +22,12 @@ abstract_ferns.grow_tree_fern = function(pos)
return
end
local size = math.random(1, 4) + math.random(1, 4)
local size = random(1, 4) + random(1, 4)
if (size > 5) then
size = 10 - size
end
size = size + 1
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[math.random(1, 2)]
local crown = ({ "ferns:tree_fern_leaves", "ferns:tree_fern_leaves_02" })[random(1, 2)]
local i = 1
local brk = false

View File

@ -4,6 +4,8 @@ local S = minetest.get_translator("flowers_plus")
-- This file supplies a few additional plants and some related crafts
-- for the plantlife modpack. Last revision: 2013-04-24
local random = math.random
flowers_plus = {}
local SPAWN_DELAY = 1000
@ -97,7 +99,7 @@ for i in ipairs(lilies_list) do
if not keys["sneak"] then
local node = minetest.get_node(pt.under)
local waterlily = math.random(1,8)
local waterlily = random(1,8)
if waterlily == 1 then
nodename = "flowers:waterlily"
elseif waterlily == 2 then
@ -115,7 +117,7 @@ for i in ipairs(lilies_list) do
elseif waterlily == 8 then
nodename = "flowers:waterlily_s4"
end
minetest.swap_node(place_pos, {name = nodename, param2 = math.random(0,3) })
minetest.swap_node(place_pos, {name = nodename, param2 = random(0,3) })
else
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.swap_node(place_pos, {name = "flowers:waterlily", param2 = fdir})
@ -197,7 +199,7 @@ for i in ipairs(algae_list) do
if not keys["sneak"] then
--local node = minetest.get_node(pt.under)
local seaweed = math.random(1,4)
local seaweed = random(1,4)
if seaweed == 1 then
nodename = "flowers:seaweed"
elseif seaweed == 2 then
@ -207,7 +209,7 @@ for i in ipairs(algae_list) do
elseif seaweed == 4 then
nodename = "flowers:seaweed_4"
end
minetest.swap_node(place_pos, {name = nodename, param2 = math.random(0,3) })
minetest.swap_node(place_pos, {name = nodename, param2 = random(0,3) })
else
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.swap_node(place_pos, {name = "flowers:seaweed", param2 = fdir})
@ -285,7 +287,7 @@ minetest.register_alias( "along_shore:seaweed_4" , "flowers:seaweed_4" )
flowers_plus.grow_waterlily = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
for i in ipairs(lilies_list) do
local chance = math.random(1,8)
local chance = random(1,8)
local ext = ""
local num = lilies_list[i][3]
@ -294,7 +296,7 @@ flowers_plus.grow_waterlily = function(pos)
end
if chance == num then
minetest.swap_node(right_here, {name="flowers:waterlily"..ext, param2=math.random(0,3)})
minetest.swap_node(right_here, {name="flowers:waterlily"..ext, param2=random(0,3)})
end
end
end
@ -318,7 +320,7 @@ biome_lib:register_generate_plant({
flowers_plus.grow_seaweed = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.swap_node(right_here, {name="along_shore:seaweed_"..math.random(1,4), param2=math.random(1,3)})
minetest.swap_node(right_here, {name="along_shore:seaweed_"..random(1,4), param2=random(1,3)})
end
biome_lib:register_generate_plant({

View File

@ -2,6 +2,8 @@
local S = minetest.get_translator("nature_classic")
-- Blossoms and such
local random = math.random
local function spawn_apple_under(pos)
local below = {
x = pos.x,
@ -46,7 +48,7 @@ minetest.register_abm({
chance = nature.leaves_blossom_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if math.random(nature.leaves_blossom_chance) == 1 then
if random(nature.leaves_blossom_chance) == 1 then
nature.enqueue_node(pos, node, nature.blossom_node)
end
end
@ -61,7 +63,7 @@ minetest.register_abm({
chance = nature.blossom_leaves_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if math.random(nature.blossom_leaves_chance) == 1 then
if random(nature.blossom_leaves_chance) == 1 then
nature.enqueue_node(pos, node, nature.blossom_leaves)
end
end
@ -76,7 +78,7 @@ minetest.register_abm({
chance = nature.apple_chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if math.random(4) == 1 and nature.dtime < 0.2 and not minetest.find_node_near(pos, nature.apple_spread, { "default:apple" }) then
if random(4) == 1 and nature.dtime < 0.2 and not minetest.find_node_near(pos, nature.apple_spread, { "default:apple" }) then
spawn_apple_under(pos)
end
end

View File

@ -4,6 +4,12 @@
-- TWiGS
-----------------------------------------------------------------------------------------------
local fakenode = {
name = "default:stone", -- could be anything that's guaranteed to exist at mapgen time, and isn't buildable_to
param1 = 0,
param2 = 0
}
abstract_trunks.place_twig = function(pos)
local twig_size = math.random(1,27)
@ -26,9 +32,19 @@ abstract_trunks.place_twig = function(pos)
local node_s_w = minetest.get_node(south_west)
local node_west = minetest.get_node(west)
local node_n_w = minetest.get_node(north_west)
node_north = minetest.registered_nodes[node_north.name] and node_north or fakenode
node_n_e = minetest.registered_nodes[node_n_e.name] and node_n_e or fakenode
node_east = minetest.registered_nodes[node_east.name] and node_east or fakenode
node_s_e = minetest.registered_nodes[node_s_e.name] and node_s_e or fakenode
node_south = minetest.registered_nodes[node_south.name] and node_south or fakenode
node_s_w = minetest.registered_nodes[node_s_w.name] and node_s_w or fakenode
node_west = minetest.registered_nodes[node_west.name] and node_west or fakenode
node_n_w = minetest.registered_nodes[node_n_w.name] and node_n_w or fakenode
-- small twigs
if twig_size <= 16 then
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
minetest.swap_node(right_here, {name="trunks:twig_"..random(1,4), param2=random(0,3)})
end
-- big twigs
if Big_Twigs == true then
@ -147,7 +163,7 @@ abstract_trunks.place_twig = function(pos)
end
end
elseif twig_size <= 25 then
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
minetest.swap_node(right_here, {name="trunks:twig_"..random(12,13), param2=random(0,3)})
end
end
end
@ -254,10 +270,10 @@ abstract_trunks.place_trunk = function(pos)
local MoD = TRuNKS[i][1]
local TRuNK = TRuNKS[i][2]
local NR = TRuNKS[i][3]
local chance = math.random(1, 17)
local length = math.random(3,5)
local chance = random(1, 17)
local length = random(3,5)
if chance == NR then
local trunk_type = math.random(1,3)
local trunk_type = random(1,3)
if trunk_type == 1 then
if minetest.get_modpath(MoD) ~= nil then
minetest.swap_node(right_here, {name=MoD..":"..TRuNK})
@ -356,11 +372,12 @@ if Moss_on_ground == true then
abstract_trunks.grow_moss_on_ground = function(pos)
local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
local moss_type = math.random(1,21)
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)})
minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
else
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3)})
minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
end
end
@ -406,44 +423,49 @@ abstract_trunks.grow_moss_on_trunk = function(pos)
local node_under = minetest.get_node(undrneath)
--if minetest.get_item_group(node_under.name, "tree") < 1 then
if minetest.registered_nodes[node_here.name].buildable_to then
local moss_type = math.random(1,41)
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]})
minetest.swap_node(on_ground, {name="trunks:moss_with_fungus_"..rot, param2=1})
elseif moss_type < 22 then
minetest.swap_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]})
minetest.swap_node(on_ground, {name="trunks:moss_plain_"..rot, param2=1})
end
end
if minetest.registered_nodes[node_north.name].buildable_to then
local moss_type = math.random(1,31) -- cliche of more moss at north
if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true,
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7
minetest.swap_node(at_side_n, {name="trunks:moss_with_fungus_"..rot, param2=5})
elseif moss_type < 22 then
minetest.swap_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)})
minetest.swap_node(at_side_n, {name="trunks:moss_plain_"..rot, param2=5})
end
end
if minetest.registered_nodes[node_east.name].buildable_to then
local moss_type = math.random(1,41)
if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true,
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)})
minetest.swap_node(at_side_e, {name="trunks:moss_with_fungus_"..rot, param2=3})
elseif moss_type < 22 then
minetest.swap_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)})
minetest.swap_node(at_side_e, {name="trunks:moss_plain_"..rot, param2=3})
end
end
if minetest.registered_nodes[node_south.name].buildable_to then
local moss_type = math.random(1,41)
if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true,
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)})
minetest.swap_node(at_side_s, {name="trunks:moss_with_fungus_"..rot, param2=4})
elseif moss_type < 22 then
minetest.swap_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)})
minetest.swap_node(at_side_s, {name="trunks:moss_plain_"..rot, param2=4})
end
end
if minetest.registered_nodes[node_west.name].buildable_to then
local moss_type = math.random(1,41)
if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true,
local rot = math.random(0,3)
if moss_type == 1 then
minetest.swap_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)})
minetest.swap_node(at_side_w, {name="trunks:moss_with_fungus_"..rot, param2=2})
elseif moss_type < 22 then
minetest.swap_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)})
minetest.swap_node(at_side_w, {name="trunks:moss_plain_"..rot, param2=2})
end
end
--end
@ -487,7 +509,7 @@ end
if Roots == true then -- see settings.txt
abstract_trunks.grow_roots = function(pos)
local twig_size = math.random(1,27)
local twig_size = random(1,27)
local right_here = {x=pos.x , y=pos.y , z=pos.z }
local below = {x=pos.x , y=pos.y-1, z=pos.z }

View File

@ -1,6 +1,8 @@
-- Code by Mossmanikin & Neuromancer
-- support for i18n
local S = minetest.get_translator("trunks")
local random = math.random
-----------------------------------------------------------------------------------------------
-- TWiGS
-----------------------------------------------------------------------------------------------
@ -42,13 +44,20 @@ for i in pairs(NoDe) do
liquids_pointable = true,
on_place = function(itemstack, placer, pointed_thing)
local pt = pointed_thing
if not placer then return end
local playername = placer:get_player_name()
if minetest.is_protected(pt.above, playername) then
minetest.record_protection_violation(pt.above, playername)
return
end
local direction = minetest.dir_to_facedir(placer:get_look_dir())
if minetest.get_node(pt.above).name=="air" then
minetest.swap_node(pt.above, {name="trunks:twig_"..math.random(1,4), param2=direction})
if not minetest.setting_getbool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
end,
})
@ -57,42 +66,62 @@ end
-----------------------------------------------------------------------------------------------
-- MoSS
-----------------------------------------------------------------------------------------------
local flat_moss = {-1/2, -1/2, -1/2, 1/2, -15/32--[[<-flickers if smaller]], 1/2}
-- wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
-- wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
-- wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
minetest.register_node("trunks:moss", {
-- was local flat_moss = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2}
local cbox = {
type = "wallmounted",
wall_top = {-1/2, 1/2, -1/2, 1/2, 15/32, 1/2},
wall_bottom = {-1/2, -1/2, -1/2, 1/2, -15/32, 1/2},
wall_side = {-1/2, -1/2, -1/2, -15/32, 1/2, 1/2}
}
for r = 0, 3 do
local xform = ""
if r > 0 then xform = "^[transformR"..r*90 end
minetest.register_node("trunks:moss_plain_"..r, {
description = S("Moss"),
drawtype = "nodebox",--"signlike",
tiles = {"trunks_moss.png"},
drawtype = "nodebox",
tiles = {"trunks_moss.png"..xform},
inventory_image = "trunks_moss.png",
wield_image = "trunks_moss.png",
paramtype = "light",
paramtype2 = "facedir",--"wallmounted",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
node_box = {type = "fixed", fixed = flat_moss},
selection_box = {type = "fixed", fixed = flat_stick},--{type = "wallmounted"},
groups = {snappy = 3, flammable = 3, attached_node = 1 },
node_box = cbox,
groups = {snappy = 3, flammable = 3, attached_node=1, not_in_creative_inventory = r},
sounds = default.node_sound_leaves_defaults(),
})
drop = "trunks:moss_plain_0",
})
-----------------------------------------------------------------------------------------------
-- MoSS & FuNGuS
-----------------------------------------------------------------------------------------------
minetest.register_node("trunks:moss_fungus", {
-----------------------------------------------------------------------------------------------
-- MoSS & FuNGuS
-----------------------------------------------------------------------------------------------
minetest.register_node("trunks:moss_with_fungus_"..r, {
description = S("Moss with Fungus"),
drawtype = "nodebox",--"signlike",
tiles = {"trunks_moss_fungus.png"},
drawtype = "nodebox",
tiles = {"trunks_moss_fungus.png"..xform},
inventory_image = "trunks_moss_fungus.png",
wield_image = "trunks_moss_fungus.png",
paramtype = "light",
paramtype2 = "facedir",--"wallmounted",
paramtype2 = "wallmounted",
sunlight_propagates = true,
walkable = false,
node_box = {type = "fixed", fixed = flat_moss},
selection_box = {type = "fixed", fixed = flat_stick},--{type = "wallmounted"},
groups = {snappy = 3, flammable = 3, attached_node = 1 },
node_box = cbox,
groups = {snappy = 3, flammable = 3, attached_node=1, not_in_creative_inventory = r},
sounds = default.node_sound_leaves_defaults(),
})
drop = "trunks:moss_with_fungus_0",
})
end
minetest.register_alias("trunks:moss_plain", "trunks:moss_plain_0")
minetest.register_alias("trunks:moss_with_fungus", "trunks:moss_with_fungus_0")
-----------------------------------------------------------------------------------------------
-- TWiGS BLoCK
@ -353,7 +382,8 @@ for i in pairs(TRuNKS) do
snappy=1,
choppy=2,
oddly_breakable_by_hand=1,
flammable=2--,
flammable=2,
attached_node = 1
--not_in_creative_inventory=1 -- atm in inv for testing
},
--drop = "trunks:twig_1", -- not sure about this yet
@ -368,3 +398,26 @@ end
end
minetest.register_alias("trunks:pine_trunkroot", "trunks:pine_treeroot")
-- convert moss to wallmounted mode so that attached_node works properly.
local fdirtowall = {
[0] = 1,
[1] = 5,
[2] = 4,
[3] = 3,
[4] = 2,
}
minetest.register_lbm({
name = "trunks:convert_moss_wallmounted",
label = "Convert moss to wallmounted mode",
run_at_every_load = true,
nodenames = {"trunks:moss", "trunks:moss_fungus"},
action = function(pos, node)
local basedir = math.floor(node.param2 / 4)
local rot = node.param2 % 4
local newname = node.name == "trunks:moss_fungus" and "trunks:moss_with_fungus" or "trunks:moss_plain"
minetest.set_node(pos, {name = newname.."_"..rot, param2 = fdirtowall[basedir] })
end
})

View File

@ -64,7 +64,7 @@ Moss_on_trunk_Max_Count = 640 -- absolute maximum number in an area of 80x80x80
Moss_on_trunk_Rarity = 24 -- larger values makes moss more rare (100 means chance of 0 %)
Auto_Roof_Corner = true -- behavior is similar (not the same!) to the one of minecraft stairs
Auto_Roof_Corner = false -- behavior is similar (not the same!) to the one of minecraft stairs
Roots = true

View File

@ -18,6 +18,8 @@ minetest.register_craftitem("vines:vines", {
-- FUNCTIONS
local random = math.random
local function dig_down(pos, node, digger)
if digger == nil then return end
@ -80,7 +82,7 @@ vines.register_vine = function( name, defs, biome )
local timer = minetest.get_node_timer(pos)
timer:start(math.random(5, 10))
timer:start(random(5, 10))
end,
on_timer = function(pos)
@ -91,7 +93,7 @@ vines.register_vine = function( name, defs, biome )
if bottom_node.name == "air" then
if not math.random(defs.average_length) == 1 then
if not random(defs.average_length) == 1 then
minetest.set_node(pos, {
name = vine_name_middle, param2 = node.param2})
@ -101,7 +103,7 @@ vines.register_vine = function( name, defs, biome )
local timer = minetest.get_node_timer(bottom_node)
timer:start(math.random(5, 10))
timer:start(random(5, 10))
end
end
end,

View File

@ -19,6 +19,11 @@ minetest.register_node("woodsoils:dirt_with_leaves_1", {
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
soil = {
base = "woodsoils:dirt_with_leaves_1",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("woodsoils:dirt_with_leaves_2", {
@ -37,6 +42,11 @@ minetest.register_node("woodsoils:dirt_with_leaves_2", {
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
soil = {
base = "woodsoils:dirt_with_leaves_2",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("woodsoils:grass_with_leaves_1", {
@ -55,6 +65,11 @@ minetest.register_node("woodsoils:grass_with_leaves_1", {
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
soil = {
base = "woodsoils:grass_with_leaves_1",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
minetest.register_node("woodsoils:grass_with_leaves_2", {
@ -73,6 +88,11 @@ minetest.register_node("woodsoils:grass_with_leaves_2", {
sounds = default.node_sound_dirt_defaults({
footstep = {name="default_grass_footstep", gain=0.4},
}),
soil = {
base = "woodsoils:grass_with_leaves_2",
dry = "farming:soil",
wet = "farming:soil_wet"
}
})
-- For compatibility with older stuff

View File

@ -1,6 +1,8 @@
-- support for i18n
local S = minetest.get_translator("youngtrees")
local random = math.random
abstract_youngtrees = {}
minetest.register_node("youngtrees:bamboo", {
@ -40,7 +42,7 @@ minetest.register_node("youngtrees:youngtree2_middle",{
{-0.500000,0.125000,-0.500000,0.500000,0.500000,0.500000}, --NodeBox 3
}
},
groups = {snappy=3,flammable=2},
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1'
})
@ -58,7 +60,7 @@ minetest.register_node("youngtrees:youngtree_top", {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {snappy=3,flammable=2},
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1'
})
@ -77,7 +79,7 @@ minetest.register_node("youngtrees:youngtree_middle", {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {snappy=3,flammable=2},
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1'
})
@ -97,15 +99,14 @@ minetest.register_node("youngtrees:youngtree_bottom", {
type = "fixed",
fixed = {-0.3, -0.5, -0.3, 0.3, 0.5, 0.3}
},
groups = {snappy=3,flammable=2},
groups = {snappy=3,flammable=2,attached_node=1},
sounds = default.node_sound_leaves_defaults(),
drop = 'trunks:twig_1'
})
abstract_youngtrees.grow_youngtree = function(pos)
local height = math.random(1,3)
abstract_youngtrees.grow_youngtree_node(pos,height)
abstract_youngtrees.grow_youngtree_node(pos, random(1,3))
end
abstract_youngtrees.grow_youngtree_node = function(pos, height)