mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-07-26 03:30:22 +02:00
Compare commits
34 Commits
replace_bi
...
079a5c1ff8
Author | SHA1 | Date | |
---|---|---|---|
079a5c1ff8 | |||
156d31280a | |||
183c043066 | |||
3239650e68 | |||
6bdb533906 | |||
c62610f544 | |||
8e2148ffc3 | |||
5ac025cda4 | |||
efe869d386 | |||
b597f99014 | |||
637f96e215 | |||
fa9f30043f | |||
d97f25e112 | |||
86896848d5 | |||
5b66d54632 | |||
031260a62d | |||
d4e83d7e78 | |||
8d65559828 | |||
ec8132b06c | |||
4dcf14ce1f | |||
d7b543f5d7 | |||
f661500cb3 | |||
c2681261e0 | |||
2c433e0b57 | |||
1f52bbea19 | |||
10ff005066 | |||
80b548535a | |||
45a8064d3d | |||
1696d8bd8f | |||
091ce416d0 | |||
5dfa02c037 | |||
8b42a45d78 | |||
b6ed0316b7 | |||
114eaff7f1 |
@ -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 = {}
|
||||
@ -140,33 +142,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)
|
||||
end
|
||||
abstract_bushes.grow_bush_node(pos,5,leaf_type)
|
||||
end
|
||||
|
||||
|
||||
@ -197,11 +188,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
|
||||
@ -223,8 +212,7 @@ biome_lib.register_on_generate({
|
||||
)
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -264,3 +252,5 @@ biome_lib.register_on_generate({
|
||||
},
|
||||
abstract_bushes.grow_youngtree2
|
||||
)
|
||||
|
||||
minetest.log("action", "[bushes] loaded.")
|
||||
|
@ -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
|
||||
|
@ -1,6 +1,8 @@
|
||||
-- support for i18n
|
||||
local S = minetest.get_translator("cavestuff")
|
||||
|
||||
local random = math.random
|
||||
|
||||
--Rocks
|
||||
|
||||
local cbox = {
|
||||
@ -20,7 +22,7 @@ minetest.register_node("cavestuff:pebble_1",{
|
||||
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,
|
||||
@ -53,7 +55,7 @@ minetest.register_node("cavestuff:desert_pebble_1",{
|
||||
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,
|
||||
|
@ -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,
|
||||
|
@ -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_on_generate({
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
||||
|
@ -260,13 +260,16 @@ minetest.register_node("ferns:fern_trunk_big", {
|
||||
},
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_destruct = function(pos,oldnode)
|
||||
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if node.name == "ferns:fern_trunk_big" or node.name == "ferns:fern_trunk_big_top" then
|
||||
minetest.dig_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
minetest.add_item(pos,"ferns:fern_trunk_big")
|
||||
end
|
||||
end,
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
if digger == nil then return end
|
||||
local np = {x=pos.x,y=pos.y+1,z=pos.z}
|
||||
local nn = minetest.get_node(np)
|
||||
if nn.name == "ferns:fern_trunk_big" or
|
||||
nn.name == "ferns:fern_trunk_big_top"
|
||||
then
|
||||
minetest.node_dig(np, nn, digger)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
@ -138,13 +140,9 @@ minetest.register_node("ferns:fern_trunk", {
|
||||
},
|
||||
groups = {tree=1,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_destruct = function(pos,oldnode)
|
||||
local node = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
if node.name == "ferns:fern_trunk" then
|
||||
minetest.dig_node({x=pos.x,y=pos.y+1,z=pos.z})
|
||||
minetest.add_item(pos,"ferns:fern_trunk")
|
||||
end
|
||||
end,
|
||||
after_dig_node = function(pos, node, metadata, digger)
|
||||
default.dig_up(pos, node, digger)
|
||||
end,
|
||||
})
|
||||
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
@ -47,4 +47,4 @@ dofile(minetest.get_modpath(current_mod_name) .. "/config.lua")
|
||||
dofile(minetest.get_modpath(current_mod_name) .. "/global_function.lua")
|
||||
dofile(minetest.get_modpath(current_mod_name) .. "/blossom.lua")
|
||||
|
||||
minetest.log("info", S("[Nature Classic] loaded!"))
|
||||
minetest.log("action", S("[Nature Classic] loaded!"))
|
||||
|
@ -31,6 +31,8 @@ abstract_trunks.place_twig = function(pos)
|
||||
end
|
||||
-- big twigs
|
||||
if Big_Twigs == true then
|
||||
local n1, n2
|
||||
local r1, r2
|
||||
-- big twig 1
|
||||
if twig_size == 17 then
|
||||
if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
@ -45,6 +47,89 @@ abstract_trunks.place_twig = function(pos)
|
||||
if check_node_buildable_to(east) then
|
||||
minetest.swap_node(east, {name="trunks:twig_8"})
|
||||
end
|
||||
elseif twig_size == 20 then
|
||||
n1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1})
|
||||
n2 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_5", param2=3})
|
||||
end
|
||||
if minetest.registered_nodes[node_n_w.name].buildable_to then
|
||||
minetest.swap_node(north_west, {name="trunks:twig_7", param2=3})
|
||||
end
|
||||
if minetest.registered_nodes[node_north.name].buildable_to then
|
||||
minetest.swap_node(north, {name="trunks:twig_8", param2=3})
|
||||
end
|
||||
end
|
||||
-- big twig 2
|
||||
elseif twig_size == 21 then
|
||||
n1 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1})
|
||||
n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9"})
|
||||
end
|
||||
if minetest.registered_nodes[node_north.name].buildable_to then
|
||||
minetest.swap_node(north, {name="trunks:twig_10"})
|
||||
end
|
||||
if minetest.registered_nodes[node_n_e.name].buildable_to then
|
||||
minetest.swap_node(north_east, {name="trunks:twig_11"})
|
||||
end
|
||||
end
|
||||
elseif twig_size == 22 then
|
||||
n1 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z})
|
||||
n2 = minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=1})
|
||||
end
|
||||
if minetest.registered_nodes[node_east.name].buildable_to then
|
||||
minetest.swap_node(east, {name="trunks:twig_10", param2=1})
|
||||
end
|
||||
if minetest.registered_nodes[node_s_e.name].buildable_to then
|
||||
minetest.swap_node(south_east, {name="trunks:twig_11", param2=1})
|
||||
end
|
||||
end
|
||||
elseif twig_size == 23 then
|
||||
n1 = minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1})
|
||||
n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=2})
|
||||
end
|
||||
if minetest.registered_nodes[node_south.name].buildable_to then
|
||||
minetest.swap_node(south, {name="trunks:twig_10", param2=2})
|
||||
end
|
||||
if minetest.registered_nodes[node_s_w.name].buildable_to then
|
||||
minetest.swap_node(south_west, {name="trunks:twig_11", param2=2})
|
||||
end
|
||||
end
|
||||
elseif twig_size == 24 then
|
||||
n1 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z})
|
||||
n2 = minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1})
|
||||
r1 = n1 and minetest.registered_nodes[n1.name]
|
||||
r2 = n2 and minetest.registered_nodes[n2.name]
|
||||
if not (r1 and r1.buildable_to or r2 and r2.buildable_to) then
|
||||
if minetest.registered_nodes[node_here.name].buildable_to then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_9", param2=3})
|
||||
end
|
||||
if minetest.registered_nodes[node_west.name].buildable_to then
|
||||
minetest.swap_node(west, {name="trunks:twig_10", param2=3})
|
||||
end
|
||||
if minetest.registered_nodes[node_n_w.name].buildable_to then
|
||||
minetest.swap_node(north_west, {name="trunks:twig_11", param2=3})
|
||||
end
|
||||
end
|
||||
elseif twig_size <= 25 then
|
||||
minetest.swap_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
|
||||
end
|
||||
elseif twig_size == 18 then
|
||||
if not (check_node_buildable_to({x=pos.x+1,y=pos.y,z=pos.z-1})
|
||||
|
@ -1,6 +1,8 @@
|
||||
-- Code by Mossmanikin & Neuromancer
|
||||
-- support for i18n
|
||||
local S = minetest.get_translator("trunks")
|
||||
|
||||
local random = math.random
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- TWiGS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
@ -65,7 +67,6 @@ end
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-- MoSS
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
||||
-- 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},
|
||||
|
@ -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
|
||||
Roots = true
|
||||
|
@ -36,6 +36,8 @@ end
|
||||
|
||||
-- FUNCTIONS
|
||||
|
||||
local random = math.random
|
||||
|
||||
local function on_dig(pos, node, player)
|
||||
local vine_name_end = node.name:gsub("_middle", "_end")
|
||||
local drop_item = "vines:vines"
|
||||
@ -136,7 +138,7 @@ vines.register_vine = function( name, defs, biome )
|
||||
on_construct = function(pos)
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
timer:start(math.random(growth_min, growth_max))
|
||||
timer:start(random(growth_min, growth_max))
|
||||
end,
|
||||
|
||||
on_timer = function(pos)
|
||||
@ -146,7 +148,7 @@ vines.register_vine = function( name, defs, biome )
|
||||
local bottom_node = minetest.get_node( bottom )
|
||||
if bottom_node.name == "air" then
|
||||
|
||||
if math.random(defs.average_length) ~= 1 then
|
||||
if random(defs.average_length) ~= 1 then
|
||||
|
||||
minetest.swap_node(pos, {
|
||||
name = vine_name_middle, param2 = node.param2})
|
||||
@ -156,7 +158,7 @@ vines.register_vine = function( name, defs, biome )
|
||||
|
||||
local timer = minetest.get_node_timer(bottom_node)
|
||||
|
||||
timer:start(math.random(growth_min, growth_max))
|
||||
timer:start(random(growth_min, growth_max))
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -1,5 +1,8 @@
|
||||
-- support for i18n
|
||||
local S = minetest.get_translator("youngtrees")
|
||||
|
||||
local random = math.random
|
||||
|
||||
abstract_youngtrees = {}
|
||||
|
||||
local youngtrees_youngtrees_rarity = tonumber(minetest.settings:get("youngtrees_youngtrees_rarity")) or 100
|
||||
@ -105,8 +108,7 @@ minetest.register_node("youngtrees:youngtree_bottom", {
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
@ -147,3 +149,5 @@ biome_lib.register_on_generate({
|
||||
},
|
||||
abstract_youngtrees.grow_youngtree
|
||||
)
|
||||
|
||||
minetest.log("action", "[youngtrees] loaded.")
|
||||
|
Reference in New Issue
Block a user