updated nature_pack_controlled
|
@ -1,4 +0,0 @@
|
|||
repo: 5db5c4aa936e2e0a0ee250746fefd147277184cb
|
||||
node: 11f77ef52da7fc9709f3b20c997089afcddb9f32
|
||||
branch: default
|
||||
tag: 0.4.3
|
|
@ -1,4 +0,0 @@
|
|||
Strawberry texture: death_of_seasons (devianart).
|
||||
Strawberry bush texture: http://vxresource.wordpress.com/
|
||||
Vines and blossom textures: kddekadenz
|
||||
Pies textures: emerge
|
|
@ -1,13 +0,0 @@
|
|||
Nature mods pack.
|
||||
Author: neko259.
|
||||
|
||||
Version:
|
||||
|
||||
Contents:
|
||||
* Nature - growing of some nature nodes.
|
||||
* Flowers - flowers growing, with API.
|
||||
* Vines - spawning climbable vines.
|
||||
* Bushes - bushes and berries. And delicious pies!
|
||||
* Irontrees - trees that give iron in the furnace.
|
||||
|
||||
* Legacy - a mod to remove or convert nodes from the old versions
|
|
@ -1 +0,0 @@
|
|||
The presence of this file indicates that the current folder is a modpack.
|
Before Width: | Height: | Size: 173 B After Width: | Height: | Size: 173 B |
|
@ -1,99 +0,0 @@
|
|||
-- Vines
|
||||
|
||||
local VINE_GROW_CHANCE = 5
|
||||
local VINE_GROW_DELAY = 1200
|
||||
|
||||
-- Nodes
|
||||
minetest.register_node("vines:vine", {
|
||||
description = "Vine",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tiles = { "vines_vine.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("vines:vine_rotten", {
|
||||
description = "Rotten vine",
|
||||
walkable = false,
|
||||
climbable = false,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tiles = { "vines_vine_rotten.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine_rotten.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
-- ABMs (growing)
|
||||
minetest.register_abm({
|
||||
nodenames = "vines:vine",
|
||||
interval = VINE_GROW_DELAY,
|
||||
chance = VINE_GROW_CHANCE,
|
||||
|
||||
action = function(pos, node, _, _)
|
||||
local under = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
local under_name = minetest.env:get_node(under).name
|
||||
|
||||
if under_name ~= "vines:vine"
|
||||
and under_name ~= "default:dirt"
|
||||
and under_name ~= "default:dirt_with_grass" then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, { name = "vines:vine_rotten" })
|
||||
else
|
||||
|
||||
if(minetest.env:get_node_light(pos, nil) < 4) then
|
||||
return
|
||||
end
|
||||
|
||||
local above = {
|
||||
x = pos.x,
|
||||
y = pos.y + 1,
|
||||
z = pos.z,
|
||||
}
|
||||
|
||||
if minetest.env:get_node(above).name == "air" then
|
||||
minetest.env:add_node(above, { name = "vines:vine" })
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = "vines:vine_rotten",
|
||||
interval = 1200,
|
||||
chance = VINE_ROT_CHANCE,
|
||||
|
||||
action = function(pos, node, _, _)
|
||||
minetest.env:remove_node(pos)
|
||||
local under = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
local under_name = minetest.env:get_node(under).name
|
||||
|
||||
if under_name == "vines:vine"
|
||||
or under_name == "default:dirt"
|
||||
or under_name == "default:dirt_with_grass" then
|
||||
minetest.env:add_node(pos, { name = "vines:vine" })
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Growing on the ground
|
||||
--
|
||||
grow_blocks_on_surfaces(3600, {
|
||||
"vines:vine",
|
||||
}, {
|
||||
{ name = "default:dirt_with_grass", chance = 3, spacing = 15 },
|
||||
})
|
Before Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 222 B |
|
@ -0,0 +1,2 @@
|
|||
Installation:
|
||||
To install this mod pack place the Nature_Controlled folder inside the mods/mintest folder with the other mods.
|
Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 283 B |
Before Width: | Height: | Size: 285 B After Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 633 B After Width: | Height: | Size: 633 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 918 B After Width: | Height: | Size: 918 B |
Before Width: | Height: | Size: 918 B After Width: | Height: | Size: 918 B |
Before Width: | Height: | Size: 824 B After Width: | Height: | Size: 824 B |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
|
@ -0,0 +1,219 @@
|
|||
--[[
|
||||
-- Flowers mod by ironzorg
|
||||
--]]
|
||||
|
||||
local DEBUG = 0
|
||||
|
||||
local FLOWERS = {
|
||||
"rose",
|
||||
"dandelion_yellow",
|
||||
"dandelion_white",
|
||||
"tulip",
|
||||
"viola",
|
||||
"cotton",
|
||||
}
|
||||
|
||||
local FLOWERS_DESCRIPTION = {
|
||||
"Rose",
|
||||
"Dandelion yellow",
|
||||
"Dandelion white",
|
||||
"Tulip",
|
||||
"Viola",
|
||||
"Cotton",
|
||||
}
|
||||
|
||||
local MAX_RATIO = 30
|
||||
local GROWING_DELAY = 1200
|
||||
|
||||
-- Local Functions
|
||||
local dbg = function(s)
|
||||
if DEBUG == 1 then
|
||||
print('[FLOWERS] ' .. s)
|
||||
end
|
||||
end
|
||||
|
||||
local table_contains = function(t, v)
|
||||
for _, i in ipairs(t) do
|
||||
if (i == v) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
local is_node_in_cube = function(nodenames, node_pos, radius)
|
||||
for x = node_pos.x - radius, node_pos.x + radius do
|
||||
for y = node_pos.y - radius, node_pos.y + radius do
|
||||
for z = node_pos.z - radius, node_pos.z + radius do
|
||||
n = minetest.env:get_node_or_nil({x = x, y = y, z = z})
|
||||
if (n == nil)
|
||||
or (n.name == 'ignore')
|
||||
or (table_contains(nodenames, n.name) == true) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
grow_blocks_on_surfaces = function(growdelay, grownames, surfaces)
|
||||
for _, surface in ipairs(surfaces) do
|
||||
minetest.register_abm({
|
||||
nodenames = { surface.name },
|
||||
interval = growdelay,
|
||||
chance = 10,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local p_top = {
|
||||
x = pos.x,
|
||||
y = pos.y + 1,
|
||||
z = pos.z
|
||||
}
|
||||
local n_top = minetest.env:get_node(p_top)
|
||||
local rnd = math.random(1, MAX_RATIO)
|
||||
|
||||
if (MAX_RATIO - surface.chance < rnd) then
|
||||
local flower_in_range = is_node_in_cube(grownames, p_top, surface.spacing)
|
||||
if (n_top.name == "air") and (flower_in_range == false) then
|
||||
local nnode = grownames[math.random(1, #grownames)]
|
||||
dbg('Adding node ' .. nnode .. ' ('
|
||||
.. pos.x .. ', '
|
||||
.. pos.y .. ', '
|
||||
.. pos.z .. ')')
|
||||
minetest.env:add_node(p_top, { name = nnode })
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function flowers_add_sprite_flower(modname, name, growdelay, surfaces)
|
||||
|
||||
minetest.register_node(modname..':'..name, {
|
||||
drawtype = 'plantlike',
|
||||
visual_scale = 1.0,
|
||||
tiles = { modname.."_"..name .. '.png' },
|
||||
inventory_image = modname.."_"..name .. '.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
furnace_burntime = 1,
|
||||
-- groups = { snappy = 3 },
|
||||
groups = {snappy=3,choppy=2,oddly_breakable_by_hand=2,flammable=3}, -- fix from Neuromancer
|
||||
})
|
||||
|
||||
grow_blocks_on_surfaces(growdelay,{modname..':'..name,},surfaces)
|
||||
end
|
||||
|
||||
|
||||
-- Nodes
|
||||
for i, color in ipairs(FLOWERS) do
|
||||
local fname = 'flower_' .. color
|
||||
|
||||
minetest.register_node('flowers:' .. fname, {
|
||||
description = FLOWERS_DESCRIPTION[i],
|
||||
drawtype = 'plantlike',
|
||||
visual_scale = 1.0,
|
||||
tiles = { fname .. '.png' },
|
||||
inventory_image = fname .. '.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
furnace_burntime = 1,
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node('flowers:flower_waterlily', {
|
||||
description = "Waterlily",
|
||||
drawtype = 'raillike',
|
||||
tiles = { 'flower_waterlily.png', },
|
||||
inventory_image = 'flower_waterlily.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
groups = { snappy = 3 },
|
||||
})
|
||||
|
||||
minetest.register_craftitem('flowers:flower_pot', {
|
||||
description = "Flower pot",
|
||||
drawtype = 'plantlike',
|
||||
image = 'flower_pot.png',
|
||||
stack_max = 1,
|
||||
visual_scale = 1.0,
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
-- groups = { snappy = 3},
|
||||
groups = {snappy=3,choppy=2,oddly_breakable_by_hand=2,flammable=3}, -- fix from Neuromancer
|
||||
})
|
||||
|
||||
for i, color in ipairs(FLOWERS) do
|
||||
local fname = 'flower_' .. color
|
||||
local pname = fname .. '_pot'
|
||||
|
||||
minetest.register_node('flowers:' .. pname, {
|
||||
description = FLOWERS_DESCRIPTION[i] .. " in the pot",
|
||||
drawtype = 'plantlike',
|
||||
tiles = { pname .. '.png' },
|
||||
inventory_image = pname .. '.png',
|
||||
stack_max = 1,
|
||||
visual_scale = 1.2,
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = true,
|
||||
material = minetest.digprop_constanttime(1.0),
|
||||
})
|
||||
end
|
||||
|
||||
-- Crafts
|
||||
minetest.register_craft({
|
||||
output = 'flowers:flower_pot 1',
|
||||
recipe = {
|
||||
{'default:clay_brick 1', '', 'default:clay_brick 1'},
|
||||
{'', 'default:clay_brick 1', ''},
|
||||
}
|
||||
})
|
||||
|
||||
for _, color in ipairs(FLOWERS) do
|
||||
local fname = 'flowers:flower_' .. color
|
||||
local pname = fname .. '_pot'
|
||||
|
||||
minetest.register_craft({
|
||||
output = pname .. ' 1',
|
||||
recipe = {
|
||||
{fname .. ' 1'},
|
||||
{'flowers:flower_pot 1'},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- Make it grow !
|
||||
grow_blocks_on_surfaces(GROWING_DELAY * 2, {
|
||||
"flowers:flower_rose",
|
||||
"flowers:flower_dandelion_white",
|
||||
"flowers:flower_viola",
|
||||
}, {
|
||||
{name = "default:dirt_with_grass", chance = 4, spacing = 15},
|
||||
})
|
||||
|
||||
grow_blocks_on_surfaces(GROWING_DELAY, {
|
||||
"flowers:flower_dandelion_yellow",
|
||||
"flowers:flower_tulip",
|
||||
"flowers:flower_cotton",
|
||||
}, {
|
||||
{name = "default:dirt_with_grass", chance = 2, spacing = 10},
|
||||
})
|
||||
|
||||
grow_blocks_on_surfaces(GROWING_DELAY / 2, {
|
||||
"flowers:flower_waterlily",
|
||||
}, {
|
||||
{name = "default:water_source", chance = 1, spacing = 15},
|
||||
})
|
||||
|
||||
dofile(minetest.get_modpath("flowers") .. "/cotton.lua")
|
|
@ -102,7 +102,8 @@ function flowers_add_sprite_flower(modname, name, growdelay, surfaces)
|
|||
paramtype = 'light',
|
||||
walkable = false,
|
||||
furnace_burntime = 1,
|
||||
groups = { snappy = 3 },
|
||||
-- groups = { snappy = 3 },
|
||||
groups = {snappy=3,choppy=2,oddly_breakable_by_hand=2,flammable=3}, -- fix from Neuromancer
|
||||
})
|
||||
|
||||
grow_blocks_on_surfaces(growdelay,{modname..':'..name,},surfaces)
|
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 680 B |
Before Width: | Height: | Size: 315 B After Width: | Height: | Size: 315 B |
Before Width: | Height: | Size: 498 B After Width: | Height: | Size: 498 B |
Before Width: | Height: | Size: 169 B After Width: | Height: | Size: 169 B |
Before Width: | Height: | Size: 464 B After Width: | Height: | Size: 464 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 462 B After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 479 B After Width: | Height: | Size: 479 B |
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 465 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
|
@ -3,8 +3,9 @@ local ABM_DELAY = 3600
|
|||
local TREE_GROW_DELAY = ABM_DELAY -- 2 hrs
|
||||
local DENSITY = 3 -- allow 3 trunks in one 'cross'
|
||||
local MINIMUM_LIGHT = 8 -- light needed for the trees to grow
|
||||
|
||||
local maxTrue = 0 -- Added by Nubelite
|
||||
local ABM_CHANCE = 20
|
||||
local maxHeight = 10 -- Max height of a tree, this can varry on the tree growth pattern and its surroundings
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "irontrees:iron_leaves" },
|
||||
|
@ -12,7 +13,7 @@ minetest.register_abm({
|
|||
chance = ABM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
maxTrue = 0
|
||||
if (minetest.env:get_node_light(pos, nil) < MINIMUM_LIGHT) then
|
||||
return
|
||||
end
|
||||
|
@ -28,17 +29,27 @@ minetest.register_abm({
|
|||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
local aboveMax = { -- Added by Nubelite
|
||||
x = pos.x, -- Added by Nubelite
|
||||
y = pos.y - maxHeight, -- Added by Nubelite
|
||||
z = pos.z, -- Added by Nubelite
|
||||
}
|
||||
if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
|
||||
if(minetest.env:get_node(current_node).name == "irontrees:irontree") then
|
||||
trunk_count = trunk_count + 1
|
||||
if(minetest.env:get_node(current_node).name == "irontrees:irontree")
|
||||
and (minetest.env:get_node(aboveMax).name ~= "irontrees:irontree") then-- Added by Nubelite
|
||||
trunk_count = trunk_count + 1 else
|
||||
maxTrue = 1 -- Added by Nubelite
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If there is at least 1 trunk and there are not many of them...
|
||||
if (trunk_count > 0) and (trunk_count < DENSITY) then
|
||||
if (trunk_count > 0) and (trunk_count < DENSITY)
|
||||
and (maxTrue == 0) then -- Added by Nubelite
|
||||
grow_iron_tree(pos)
|
||||
end
|
||||
end
|
||||
|
@ -56,6 +67,8 @@ function grow_iron_tree(pos)
|
|||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
|
||||
|
||||
if(minetest.env:get_node(current_node).name == "air") then
|
||||
minetest.env:add_node(current_node, {name = "irontrees:iron_leaves"})
|
||||
end
|
|
@ -0,0 +1,78 @@
|
|||
local ABM_DELAY = 3600
|
||||
|
||||
local TREE_GROW_DELAY = ABM_DELAY -- 2 hrs
|
||||
local DENSITY = 3 -- allow 3 trunks in one 'cross'
|
||||
local MINIMUM_LIGHT = 8 -- light needed for the trees to grow
|
||||
local maxTrue = 0 -- Added by Nubelite
|
||||
local ABM_CHANCE = 20
|
||||
local maxHeight = 15 -- Max height of a tree, this can varry on the tree growth pattern and its surroundings
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "irontrees:iron_leaves" },
|
||||
interval = TREE_GROW_DELAY,
|
||||
chance = ABM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
maxTrue = 0
|
||||
if (minetest.env:get_node_light(pos, nil) < MINIMUM_LIGHT) then
|
||||
return
|
||||
end
|
||||
|
||||
local trunk_count = 0
|
||||
|
||||
-- Check for trunks in area
|
||||
for i = -1, 1 do
|
||||
for j = -1, -1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
local aboveMax = { -- Added by Nubelite
|
||||
x = pos.x, -- Added by Nubelite
|
||||
y = pos.y - maxHeight, -- Added by Nubelite
|
||||
z = pos.z, -- Added by Nubelite
|
||||
}
|
||||
if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
|
||||
if(minetest.env:get_node(current_node).name == "irontrees:irontree")
|
||||
and (minetest.env:get_node(aboveMax).name ~= "irontrees:irontree") then-- Added by Nubelite
|
||||
trunk_count = trunk_count + 1 else
|
||||
maxTrue = 1 -- Added by Nubelite
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If there is at least 1 trunk and there are not many of them...
|
||||
if (trunk_count > 0) and (trunk_count < DENSITY)
|
||||
and (maxTrue == 0) then -- Added by Nubelite
|
||||
grow_iron_tree(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
function grow_iron_tree(pos)
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, {name = "irontrees:irontree"})
|
||||
print ('[nature] A trunk has grown at (' .. pos.x .. ',' .. pos.y .. ',' .. pos.z .. ')')
|
||||
for i = -1, 1 do
|
||||
for j = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
|
||||
|
||||
if(minetest.env:get_node(current_node).name == "air") then
|
||||
minetest.env:add_node(current_node, {name = "irontrees:iron_leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Before Width: | Height: | Size: 798 B After Width: | Height: | Size: 798 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
|
@ -0,0 +1,20 @@
|
|||
Since recent versions of Minetest no longer contain jungle biomes, and
|
||||
hence no jungle grass, I created this mod to re-add said grass back into
|
||||
the game, with a twist: There are now four different sizes of grasses,
|
||||
all of which yield a single junglegrass object when gathered (so all
|
||||
four sizes may be used where jungle grass is called for). The largest
|
||||
size uses the game's standard jungle grass node, while the others are
|
||||
defined by this mod.
|
||||
|
||||
Junglegrass will spawn on dirt, grass, sand, desert sand and the tops of
|
||||
papyrus and cactus (though rarely), and will do so anywhere in the map.
|
||||
Grass on the ground will grow and eventually die (or turn into dry
|
||||
shrubs, in the desert), given enough time.
|
||||
|
||||
Adjusting the overall spawn/growth rate is easily done by tweaking the
|
||||
MAX_RATIO variable at the top of init.lua. A larger value results in
|
||||
less frequent events.
|
||||
|
||||
Dependencies: none (just the game's default stuff)
|
||||
|
||||
License: cc-by-sa 3.0 for the textures, WTFPL for everything else.
|
|
@ -0,0 +1,3 @@
|
|||
Based on flowers mod by ironzorg.
|
||||
Converted to create junglegrass by Vanessa Ezekowitz
|
||||
Adapted jungle grass textures by VanessaE, based on the original one.
|
|
@ -1,2 +1,2 @@
|
|||
default
|
||||
flowers
|
||||
|
|
@ -0,0 +1,223 @@
|
|||
-- Junglegrass mod by VanessaE (using ironzorg's flowers mod as a basis)
|
||||
|
||||
math.randomseed(os.time())
|
||||
|
||||
local DEBUG = 1
|
||||
|
||||
local MAX_RATIO = 500
|
||||
local GROWING_DELAY = 50
|
||||
local RADIUS = 10
|
||||
|
||||
local GRASSES = {
|
||||
"junglegrass:shortest",
|
||||
"junglegrass:short",
|
||||
"junglegrass:medium",
|
||||
"default:junglegrass",
|
||||
"default:dry_shrub",
|
||||
"default:cactus",
|
||||
}
|
||||
|
||||
local dbg = function(s)
|
||||
if DEBUG == 1 then
|
||||
print('[JUNGLEGRASS] ' .. s)
|
||||
end
|
||||
end
|
||||
|
||||
local is_node_loaded = function(nodenames, node_pos)
|
||||
n = minetest.env:get_node_or_nil(node_pos)
|
||||
if (n == nil) or (n.name == 'ignore') then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
spawn_on_surfaces = function(growdelay, grownames, surfaces)
|
||||
for _, surface in ipairs(surfaces) do
|
||||
minetest.register_abm({
|
||||
nodenames = { surface.name },
|
||||
interval = growdelay,
|
||||
chance = 30,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||
local n_top = minetest.env:get_node(p_top)
|
||||
local rnd = math.random(1, MAX_RATIO)
|
||||
|
||||
if (MAX_RATIO - surface.chance < rnd) and (n_top.name == "air") and (is_node_loaded(grownames, p_top) == true) then
|
||||
if ((minetest.env:find_node_near(p_top, RADIUS, GRASSES) == nil ) or (surface.name == "default:cactus")) then
|
||||
local nnode = grownames[math.random(1, #grownames)]
|
||||
dbg('Spawning '
|
||||
.. nnode .. ' at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:add_node(p_top, { name = nnode })
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
grow_on_surfaces = function(growdelay, grownames, surfaces)
|
||||
for _, surface in ipairs(surfaces) do
|
||||
minetest.register_abm({
|
||||
nodenames = { surface.name },
|
||||
interval = growdelay,
|
||||
chance = 30,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local p_top = { x = pos.x, y = pos.y + 1, z = pos.z }
|
||||
local n_top = minetest.env:get_node(p_top)
|
||||
local rnd = math.random(1, MAX_RATIO)
|
||||
local nnode = grownames[math.random(1, #grownames)]
|
||||
|
||||
if (MAX_RATIO - surface.chance < rnd) and (is_node_loaded(grownames, p_top) == true) then
|
||||
if (n_top.name == "junglegrass:shortest") then
|
||||
dbg('Growing shortest into short at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:add_node(p_top, { name = "junglegrass:short" })
|
||||
end
|
||||
|
||||
if (surface.name == "default:desert_sand") then
|
||||
if (n_top.name == "junglegrass:short") or (n_top.name == "junglegrass:medium") or (n_top.name == "default:junglegrass") then
|
||||
dbg(nnode .. ' in desert turns to dry shrub at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:add_node(p_top, { name = "default:dry_shrub" })
|
||||
end
|
||||
else
|
||||
if (n_top.name == "junglegrass:short") then
|
||||
dbg('Growing short into medium at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:add_node(p_top, { name = "junglegrass:medium" })
|
||||
end
|
||||
|
||||
if (n_top.name == "junglegrass:medium") then
|
||||
dbg('Growing medium into full size at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:add_node(p_top, { name = "default:junglegrass" })
|
||||
end
|
||||
|
||||
if (n_top.name == "default:junglegrass") then
|
||||
dbg(nnode .. ' dies at ('
|
||||
.. p_top.x .. ', '
|
||||
.. p_top.y .. ', '
|
||||
.. p_top.z .. ') on '
|
||||
.. surface.name)
|
||||
minetest.env:remove_node(p_top)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- On regular fertile ground, any size can spawn
|
||||
|
||||
spawn_on_surfaces(GROWING_DELAY, {
|
||||
"junglegrass:shortest",
|
||||
"junglegrass:short",
|
||||
"junglegrass:medium",
|
||||
"default:junglegrass",
|
||||
}, {
|
||||
{name = "default:dirt_with_grass", chance = 4},
|
||||
{name = "default:dirt", chance = 5},
|
||||
{name = "default:sand", chance = 4},
|
||||
})
|
||||
|
||||
-- On cactus, papyrus, and desert sand, only the two smallest sizes can spawn
|
||||
|
||||
spawn_on_surfaces(GROWING_DELAY, {
|
||||
"junglegrass:shortest",
|
||||
"junglegrass:short",
|
||||
}, {
|
||||
{name = "default:papyrus", chance = 250},
|
||||
{name = "default:cactus", chance = 150},
|
||||
{name = "default:desert_sand", chance = 2},
|
||||
})
|
||||
|
||||
-- make the grasses grow and die
|
||||
|
||||
grow_on_surfaces(GROWING_DELAY, {
|
||||
"junglegrass:shortest",
|
||||
"junglegrass:short",
|
||||
"junglegrass:medium",
|
||||
"default:junglegrass",
|
||||
}, {
|
||||
{name = "default:dirt_with_grass", chance = 499},
|
||||
{name = "default:dirt", chance = 499},
|
||||
{name = "default:sand", chance = 499},
|
||||
{name = "default:desert_sand", chance = 400}
|
||||
})
|
||||
|
||||
-- The actual node definitions
|
||||
|
||||
minetest.register_node('junglegrass:medium', {
|
||||
description = "Jungle Grass (medium height)",
|
||||
drawtype = 'plantlike',
|
||||
tile_images = { 'junglegrass_medium.png' },
|
||||
inventory_image = 'junglegrass_medium.png',
|
||||
wield_image = 'junglegrass_medium.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
groups = { snappy = 3,flammable=2 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = 'default:junglegrass',
|
||||
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.4, -0.5, -0.4, 0.4, 0.5, 0.4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node('junglegrass:short', {
|
||||
description = "Jungle Grass (short)",
|
||||
drawtype = 'plantlike',
|
||||
tile_images = { 'junglegrass_short.png' },
|
||||
inventory_image = 'junglegrass_short.png',
|
||||
wield_image = 'junglegrass_short.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
groups = { snappy = 3,flammable=2 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = 'default:junglegrass',
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.4, -0.5, -0.4, 0.4, 0.3, 0.4},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_node('junglegrass:shortest', {
|
||||
description = "Jungle Grass (very short)",
|
||||
drawtype = 'plantlike',
|
||||
tile_images = { 'junglegrass_shortest.png' },
|
||||
inventory_image = 'junglegrass_shortest.png',
|
||||
wield_image = 'junglegrass_shortest.png',
|
||||
sunlight_propagates = true,
|
||||
paramtype = 'light',
|
||||
walkable = false,
|
||||
groups = { snappy = 3,flammable=2 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = 'default:junglegrass',
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.3, -0.5, -0.3, 0.3, 0, 0.3},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
print("[Junglegrass] Loaded!")
|
|
@ -0,0 +1,3 @@
|
|||
All code is WTFPL.
|
||||
All textures are cc-by-sa 3.0.
|
||||
|
After Width: | Height: | Size: 537 B |
After Width: | Height: | Size: 370 B |
After Width: | Height: | Size: 325 B |
|
@ -0,0 +1,56 @@
|
|||
-- Blossom
|
||||
|
||||
local BLOSSOM_CHANCE = 5
|
||||
local BLOSSOM_DELAY = 3600
|
||||
local APPLE_SPAWN_CHANCE = 5
|
||||
|
||||
minetest.register_node("nature:blossom", {
|
||||
description = "Blossom",
|
||||
drawtype = "allfaces_optional",
|
||||
tiles = { "default_leaves.png^nature_blossom.png" },
|
||||
paramtype = "light",
|
||||
groups = { snappy = 3, leafdecay = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
recipe = "nature:blossom",
|
||||
burntime = 1,
|
||||
})
|
||||
|
||||
-- Blossoming
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:leaves" },
|
||||
interval = BLOSSOM_DELAY,
|
||||
chance = BLOSSOM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, { name = "nature:blossom" })
|
||||
end
|
||||
})
|
||||
|
||||
-- Apples growing
|
||||
minetest.register_abm({
|
||||
nodenames = { "nature:blossom" },
|
||||
interval = BLOSSOM_DELAY,
|
||||
chance = BLOSSOM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, { name = "default:leaves" })
|
||||
-- Drop and apple
|
||||
if (math.random (1, 100) > APPLE_SPAWN_CHANCE) then
|
||||
return
|
||||
end
|
||||
local below = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
if minetest.env:get_node(below).name == "air" then
|
||||
minetest.env:add_node(below, { name = "default:apple" })
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,57 @@
|
|||
-- Cactus growing
|
||||
|
||||
local CACTUS_GROW_CHANCE = 15
|
||||
local CACTUS_GROW_INDIV_CHANCE = 4
|
||||
local CACTUS_MAX_DENSITY = 3
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:cactus" },
|
||||
interval = 3600,
|
||||
chance = CACTUS_GROW_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
-- Check for existing cacti in radius
|
||||
local cactus_count = 0
|
||||
for i = -1, 1 do
|
||||
for j = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local new_pos = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k,
|
||||
}
|
||||
|
||||
local node_name = minetest.env:get_node(new_pos)
|
||||
if node_name == "default:cactus" then
|
||||
cactus_count = cactus_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if cactus_count > CACTUS_MAX_DENSITY then
|
||||
return
|
||||
end
|
||||
|
||||
-- Grow with a chance (choosing which side to grow)
|
||||
for i = -1, 1 do
|
||||
for j = 0, 1 do
|
||||
for k = -1, 1 do
|
||||
if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
|
||||
if(math.random(1, 100) <= CACTUS_GROW_INDIV_CHANCE) then
|
||||
local new_pos = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
if(minetest.env:get_node(new_pos).name == "air") then
|
||||
minetest.env:add_node(new_pos, {name = "default:cactus"})
|
||||
minetest.log('[nature] A cactus has grown at (' .. new_pos.x .. ',' .. new_pos.y .. ',' .. new_pos.z .. ')')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,11 @@
|
|||
-- Nature (Minetest 0.4 mod)
|
||||
-- Nature is slowly capturing the world!
|
||||
-- Licenced under the GPLv3
|
||||
|
||||
dofile(minetest.get_modpath("nature") .. "/cactus.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/papyrus.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/moss.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/blossom.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/tree_growth.lua")
|
||||
|
||||
print "[nature] Mod loaded!"
|
|
@ -0,0 +1,11 @@
|
|||
-- Nature (Minetest 0.4 mod)
|
||||
-- Nature is slowly capturing the world!
|
||||
-- Licenced under the GPLv3
|
||||
|
||||
dofile(minetest.get_modpath("nature") .. "/cactus.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/papyrus.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/moss.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/blossom.lua")
|
||||
dofile(minetest.get_modpath("nature") .. "/tree_growth.lua")
|
||||
|
||||
print "[nature] Mod loaded!"
|
|
@ -0,0 +1,45 @@
|
|||
-- Turning cobblestone into mossy stone
|
||||
|
||||
local MOSS_CHANCE = 15
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:cobble" },
|
||||
interval = 7200,
|
||||
chance = MOSS_CHANCE,
|
||||
|
||||
action = function(pos, node, _, _)
|
||||
|
||||
local water = false
|
||||
local light = false
|
||||
for i = -1, 1 do
|
||||
for j = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local near_pos = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k,
|
||||
}
|
||||
|
||||
local light_level = minetest.env:get_node_light(near_pos, nil)
|
||||
if light_level ~= nil then
|
||||
if light_level > 0 then
|
||||
light = true
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.env:get_node(near_pos).name == "default:water_source" then
|
||||
water = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if water or (not light) then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, { name = "default:mossycobble" })
|
||||
print("[nature] Turning cobble into mossycobble at ("
|
||||
.. pos.x .. ", " .. pos.y .. ", " .. pos.z .. ")")
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,39 @@
|
|||
-- Papyrus growing
|
||||
|
||||
local PAPYRUS_GROW_CHANCE = 10
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:papyrus" },
|
||||
interval = 1200,
|
||||
chance = PAPYRUS_GROW_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if (minetest.env:get_node_light(pos, nil) < 6) then
|
||||
return
|
||||
end
|
||||
|
||||
local under = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z
|
||||
}
|
||||
|
||||
-- Grow up
|
||||
local above = {
|
||||
x = pos.x,
|
||||
y = pos.y + 1,
|
||||
z = pos.z
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
local aboveMax = { -- Added by Nubelite
|
||||
x = pos.x, -- Added by Nubelite
|
||||
y = pos.y - 5, -- Added by Nubelite
|
||||
z = pos.z, -- Added by Nubelite
|
||||
}
|
||||
if(minetest.env:get_node(above).name == "air")
|
||||
and (minetest.env:get_node(aboveMax).name ~= "default:papyrus") then -- Added by Nubelite
|
||||
minetest.env:add_node(above, {name = "default:papyrus"})
|
||||
minetest.log('[nature] A papyrus has grown at (' .. above.x .. ',' .. above.y .. ',' .. above.z .. ')')
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,39 @@
|
|||
-- Papyrus growing
|
||||
|
||||
local PAPYRUS_GROW_CHANCE = 10
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:papyrus" },
|
||||
interval = 1200,
|
||||
chance = PAPYRUS_GROW_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if (minetest.env:get_node_light(pos, nil) < 6) then
|
||||
return
|
||||
end
|
||||
|
||||
local under = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z
|
||||
}
|
||||
|
||||
-- Grow up
|
||||
local above = {
|
||||
x = pos.x,
|
||||
y = pos.y + 1,
|
||||
z = pos.z
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
local aboveMax = { -- Added by Nubelite
|
||||
x = pos.x, -- Added by Nubelite
|
||||
y = pos.y - 5, -- Added by Nubelite
|
||||
z = pos.z, -- Added by Nubelite
|
||||
}
|
||||
if(minetest.env:get_node(above).name == "air")
|
||||
and minetest.env:get_node(aboveMax).name ~= "default:papyrus" then -- Added by Nubelite
|
||||
minetest.env:add_node(above, {name = "default:papyrus"})
|
||||
minetest.log('[nature] A papyrus has grown at (' .. above.x .. ',' .. above.y .. ',' .. above.z .. ')')
|
||||
end
|
||||
end
|
||||
})
|
After Width: | Height: | Size: 173 B |
|
@ -0,0 +1,156 @@
|
|||
-- Tree growing
|
||||
|
||||
dofile(minetest.get_modpath("nature") .. "/trees.lua")
|
||||
|
||||
local ABM_DELAY = 7200
|
||||
local ABM_CHANCE = 1
|
||||
|
||||
local TREE_GROW_DELAY = ABM_DELAY
|
||||
local DENSITY = 3 -- allow <number> trunks in the radius
|
||||
local MINIMUM_LIGHT = 0 -- light needed for the trees to grow
|
||||
local maxHeight = 15 -- Max height of a tree, this can varry on the tree growth pattern and its surroundings
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:leaves" },
|
||||
interval = TREE_GROW_DELAY,
|
||||
chance = ABM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if(minetest.env:get_node_light(pos, nil) < MINIMUM_LIGHT) then
|
||||
return
|
||||
end
|
||||
|
||||
local trunk_count = 0
|
||||
local jungle_trunk_count = 0
|
||||
|
||||
-- Check for trunks in area
|
||||
for i = -1, 1 do
|
||||
for j = -1, -1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
|
||||
if(minetest.env:get_node(current_node).name == "default:tree") then
|
||||
trunk_count = trunk_count + 1
|
||||
elseif(minetest.env:get_node(current_node).name ==
|
||||
"default:jungletree") then
|
||||
jungle_trunk_count = jungle_trunk_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local all_trunks = trunk_count + jungle_trunk_count
|
||||
|
||||
-- If there is at least 1 trunk and there are not many of them...
|
||||
local aboveMax = {
|
||||
x = pos.x,
|
||||
y = pos.y - maxHeight,
|
||||
z = pos.z,
|
||||
}
|
||||
local nodeunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
local grandom = math.random(8) -- Added by Nubelite
|
||||
local prandom = math.random(-1,1)
|
||||
local growpos
|
||||
local growposunder
|
||||
|
||||
if (all_trunks > 0) and (all_trunks < DENSITY)
|
||||
and (minetest.env:get_node(nodeunder).name == "default:tree"
|
||||
or minetest.env:get_node(nodeunder).name == "default:jungletree")
|
||||
and minetest.env:get_node(aboveMax).name ~= "air"
|
||||
and minetest.env:get_node(aboveMax).name ~= "default:tree" -- Added by Nubelite
|
||||
and minetest.env:get_node(aboveMax).name ~= "default:jungletree" then -- Added by Nubelite then
|
||||
-- minetest.env:remove_node(pos)
|
||||
if(math.random(1, all_trunks) <= trunk_count) then
|
||||
if grandom <= 4 then -- Added by Nubelite
|
||||
minetest.env:add_node(pos, {name = "default:tree"})
|
||||
else if grandom <= 6 then -- Added by Nubelite
|
||||
growpos = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y,
|
||||
z = pos.z,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:tree"})
|
||||
minetest.env:add_node(growpos, {name = "default:tree"})
|
||||
else
|
||||
growpos = {
|
||||
x = pos.x,
|
||||
y = pos.y,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:tree"})
|
||||
minetest.env:add_node(growpos, {name = "default:tree"})
|
||||
end
|
||||
end
|
||||
else
|
||||
if grandom <= 4 then -- Added by Nubelite
|
||||
minetest.env:add_node(pos, {name = "default:jungletree"})
|
||||
else if grandom <= 6 then -- Added by Nubelite
|
||||
growpos = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y,
|
||||
z = pos.z,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:jungletree"})
|
||||
minetest.env:add_node(growpos, {name = "default:jungletree"})
|
||||
else
|
||||
growpos = {
|
||||
x = pos.x,
|
||||
y = pos.y,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:jungletree"})
|
||||
minetest.env:add_node(growpos, {name = "default:jungletree"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
print ('[nature] A trunk has grown at (' .. pos.x .. ',' .. pos.y .. ',' .. pos.z .. ')')
|
||||
for i = -1, 1 do
|
||||
for j = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
if(minetest.env:get_node(current_node).name == "air") then
|
||||
minetest.env:add_node(current_node, {name = "default:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,156 @@
|
|||
-- Tree growing
|
||||
|
||||
dofile(minetest.get_modpath("nature") .. "/trees.lua")
|
||||
|
||||
local ABM_DELAY = 7200
|
||||
local ABM_CHANCE = 1
|
||||
|
||||
local TREE_GROW_DELAY = ABM_DELAY
|
||||
local DENSITY = 3 -- allow <number> trunks in the radius
|
||||
local MINIMUM_LIGHT = 0 -- light needed for the trees to grow
|
||||
local maxHeight = 15 -- Max height of a tree, this can varry on the tree growth pattern and its surroundings
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = { "default:leaves" },
|
||||
interval = TREE_GROW_DELAY,
|
||||
chance = ABM_CHANCE,
|
||||
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
if(minetest.env:get_node_light(pos, nil) < MINIMUM_LIGHT) then
|
||||
return
|
||||
end
|
||||
|
||||
local trunk_count = 0
|
||||
local jungle_trunk_count = 0
|
||||
|
||||
-- Check for trunks in area
|
||||
for i = -1, 1 do
|
||||
for j = -1, -1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
if(math.abs(i) + math.abs(j) + math.abs(k) == 1) then
|
||||
if(minetest.env:get_node(current_node).name == "default:tree") then
|
||||
trunk_count = trunk_count + 1
|
||||
elseif(minetest.env:get_node(current_node).name ==
|
||||
"default:jungletree") then
|
||||
jungle_trunk_count = jungle_trunk_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local all_trunks = trunk_count + jungle_trunk_count
|
||||
|
||||
-- If there is at least 1 trunk and there are not many of them...
|
||||
local aboveMax = {
|
||||
x = pos.x,
|
||||
y = pos.y - maxHeight,
|
||||
z = pos.z,
|
||||
}
|
||||
local nodeunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
local grandom = math.random(8) -- Added by Nubelite
|
||||
local prandom = math.random(-1,1)
|
||||
local growpos
|
||||
local growposunder
|
||||
|
||||
if (all_trunks > 0) and (all_trunks < DENSITY)
|
||||
and (minetest.env:get_node(nodeunder).name == "default:tree"
|
||||
or minetest.env:get_node(nodeunder).name == "default:jungletree")
|
||||
and minetest.env:get_node(aboveMax).name ~= "air"
|
||||
and minetest.env:get_node(aboveMax).name ~= "default:tree" -- Added by Nubelite
|
||||
and minetest.env:get_node(aboveMax).name ~= "default:jungletree" then -- Added by Nubelite then
|
||||
-- minetest.env:remove_node(pos)
|
||||
if(math.random(1, all_trunks) <= trunk_count) then
|
||||
if grandom <= 4 then -- Added by Nubelite
|
||||
minetest.env:add_node(pos, {name = "default:tree"})
|
||||
else if grandom <= 6 then -- Added by Nubelite
|
||||
growpos = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y,
|
||||
z = pos.z,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:tree"})
|
||||
minetest.env:add_node(growpos, {name = "default:tree"})
|
||||
else
|
||||
growpos = {
|
||||
x = pos.x,
|
||||
y = pos.y,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:tree"})
|
||||
minetest.env:add_node(growpos, {name = "default:tree"})
|
||||
end
|
||||
end
|
||||
else
|
||||
if grandom <= 4 then -- Added by Nubelite
|
||||
minetest.env:add_node(pos, {name = "default:jungletree"})
|
||||
else if grandom <= 6 then -- Added by Nubelite
|
||||
growpos = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y,
|
||||
z = pos.z,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x + prandom,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:jungletree"})
|
||||
minetest.env:add_node(growpos, {name = "default:jungletree"})
|
||||
else
|
||||
growpos = {
|
||||
x = pos.x,
|
||||
y = pos.y,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
growposunder = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z + prandom,
|
||||
}
|
||||
minetest.env:add_node(growposunder, {name = "default:jungletree"})
|
||||
minetest.env:add_node(growpos, {name = "default:jungletree"})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
print ('[nature] A trunk has grown at (' .. pos.x .. ',' .. pos.y .. ',' .. pos.z .. ')')
|
||||
for i = -1, 1 do
|
||||
for j = -1, 1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
if(minetest.env:get_node(current_node).name == "air") then
|
||||
minetest.env:add_node(current_node, {name = "default:leaves"})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
TREES = {
|
||||
"default:tree",
|
||||
"default:jungletree",
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
vines
|
||||
=====
|
||||
|
||||
Vines mod for minetest. Also adds ropes.
|
|
@ -0,0 +1 @@
|
|||
default
|
|
@ -0,0 +1,251 @@
|
|||
print("[Vines] v1.0")
|
||||
|
||||
-- Nodes
|
||||
minetest.register_node("vines:rope_block", {
|
||||
description = "Rope",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drops = "",
|
||||
tile_images = {
|
||||
"vines_rope_block.png",
|
||||
"vines_rope_block.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"vines_rope_block.png",
|
||||
"vines_rope_block.png"
|
||||
},
|
||||
drawtype = "cube",
|
||||
groups = { snappy = 3},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = function(pos)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
if n.name == "air" then
|
||||
minetest.env:add_node(p, {name="vines:rope_end"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope", {
|
||||
description = "Rope",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_rope.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope_end", {
|
||||
description = "Rope",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drops = "",
|
||||
tile_images = { "vines_rope.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = function(pos)
|
||||
yesh = {x = pos.x, y= pos.y-1, z=pos.z}
|
||||
minetest.env:add_node(yesh, "vines:rope")
|
||||
end,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("vines:vine", {
|
||||
description = "Vine",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
drop = 'vines:vines',
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_vine.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("vines:vine_rotten", {
|
||||
description = "Rotten vine",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
drop = 'vines:vines',
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_vine_rotten.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine_rotten.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
--ABM
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:leaves", "growing_trees:leaves", "default:dirt_with_grass", },
|
||||
interval = 180,
|
||||
chance = 200,
|
||||
action = function(pos, node)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
if n.name =="air" then
|
||||
minetest.env:add_node(p, {name="vines:vine"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:vine"},
|
||||
interval = 5,
|
||||
chance = 4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
--remove if top node is removed
|
||||
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
|
||||
--the second argument in the random function represents the average height
|
||||
if math.random(0,3)<1 then
|
||||
minetest.env:add_node(pos, {name="vines:vine_rotten"})
|
||||
else
|
||||
if n.name =="air" then
|
||||
minetest.env:add_node(pos, {name="vines:vine_rotten"})
|
||||
minetest.env:add_node(p, {name="vines:vine"})
|
||||
end
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:vine_rotten"},
|
||||
interval = 60,
|
||||
chance = 4,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
-- only remove if nothing is hangin on the bottom of it.
|
||||
if n.name ~="vines:vine" and n.name ~="vines:vine_rotten" then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
|
||||
if minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
|
||||
minetest.env:remove_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 36000,
|
||||
chance = 10,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
--remove if top node is removed
|
||||
if n.name == "air" and is_node_in_cube ({"vines:vine"}, pos, 3) then
|
||||
minetest.env:add_node(p, {name="vines:vine"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:rope_end"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
--remove if top node is removed
|
||||
if n.name == "air" then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, {name="vines:rope"})
|
||||
minetest.env:add_node(p, {name="vines:rope_end"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
is_node_in_cube = function(nodenames, node_pos, radius)
|
||||
for x = node_pos.x - radius, node_pos.x + radius do
|
||||
for y = node_pos.y - radius, node_pos.y + radius do
|
||||
for z = node_pos.z - radius, node_pos.z + radius do
|
||||
n = minetest.env:get_node_or_nil({x = x, y = y, z = z})
|
||||
if (n == nil)
|
||||
or (n.name == 'ignore')
|
||||
or (table_contains(nodenames, n.name) == true) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
table_contains = function(t, v)
|
||||
for _, i in ipairs(t) do
|
||||
if (i == v) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- craft rope
|
||||
minetest.register_craft({
|
||||
output = 'vines:rope_block',
|
||||
recipe = {
|
||||
{'', 'default:wood', ''},
|
||||
{'', 'vines:vines', ''},
|
||||
{'', 'vines:vines', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("vines:vines", {
|
||||
description = "Vines",
|
||||
inventory_image = "vines_vine.png",
|
||||
})
|
||||
|
||||
minetest.register_on_dignode(function (pos, node, player)
|
||||
if node.name == 'vines:rope_block' then
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
while n.name == 'vines:rope' do
|
||||
minetest.env:remove_node(p)
|
||||
p = {x=p.x, y=p.y-1, z=p.z}
|
||||
n = minetest.env:get_node(p)
|
||||
end
|
||||
if n.name == 'vines:rope_end' then
|
||||
minetest.env:remove_node(p)
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,317 @@
|
|||
-- print("[Vines] v1.0")
|
||||
|
||||
local VINE_GROW_CHANCE = 5
|
||||
local VINE_GROW_DELAY = 1200
|
||||
local vine_height = 4
|
||||
local Rot_chance = 5
|
||||
|
||||
-- Nodes
|
||||
minetest.register_node("vines:rope_block", {
|
||||
description = "Rope",
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drops = "",
|
||||
tile_images = {
|
||||
"vines_rope_block.png",
|
||||
"vines_rope_block.png",
|
||||
"default_wood.png",
|
||||
"default_wood.png",
|
||||
"vines_rope_block.png",
|
||||
"vines_rope_block.png"
|
||||
},
|
||||
drawtype = "cube",
|
||||
groups = { snappy = 3},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = function(pos)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
if n.name == "air" then
|
||||
minetest.env:add_node(p, {name="vines:rope_end"})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope", {
|
||||
description = "Rope",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_rope.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node("vines:rope_end", {
|
||||
description = "Rope",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
drops = "",
|
||||
tile_images = { "vines_rope.png" },
|
||||
drawtype = "plantlike",
|
||||
groups = {},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
after_place_node = function(pos)
|
||||
yesh = {x = pos.x, y= pos.y-1, z=pos.z}
|
||||
minetest.env:add_node(yesh, "vines:rope")
|
||||
end,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-1/7, -1/2, -1/7, 1/7, 1/2, 1/7},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_node("vines:vine", {
|
||||
description = "Vine",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
drop = 'vines:vines',
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_vine.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_node("vines:vine_rotten", {
|
||||
description = "Rotten vine",
|
||||
walkable = false,
|
||||
climbable = true,
|
||||
drop = 'vines:vines',
|
||||
sunlight_propagates = true,
|
||||
paramtype = "light",
|
||||
tile_images = { "vines_vine_rotten.png" },
|
||||
drawtype = "plantlike",
|
||||
inventory_image = "vines_vine_rotten.png",
|
||||
groups = { snappy = 3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
})
|
||||
|
||||
--ABM
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:leaves", "growing_trees:leaves", "default:dirt_with_grass", },
|
||||
interval = 180,
|
||||
chance = 200,
|
||||
action = function(pos, node)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
if n.name =="air" then
|
||||
minetest.env:add_node(p, {name="vines:vine"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- grows rom vines
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:vine"},
|
||||
interval = VINE_GROW_DELAY,
|
||||
chance = VINE_GROW_CHANCE,
|
||||
action = function(pos, node, _, _)
|
||||
local under = {
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z,
|
||||
}
|
||||
local above = {
|
||||
x = pos.x,
|
||||
y = pos.y + 1,
|
||||
z = pos.z,
|
||||
}
|
||||
|
||||
local jungle_trunk_count = 0
|
||||
|
||||
-- Check for jungle trunks in area
|
||||
for i = -1, 1 do
|
||||
for j = -1, -1 do
|
||||
for k = -1, 1 do
|
||||
local current_node = {
|
||||
x = pos.x + i,
|
||||
y = pos.y + j,
|
||||
z = pos.z + k
|
||||
}
|
||||
if(minetest.env:get_node(current_node).name == "default:jungletree") then
|
||||
jungle_trunk_count = jungle_trunk_count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local under_name = minetest.env:get_node(under).name
|
||||
|
||||
if under_name ~= "vines:vine"
|
||||
and under_name ~= "default:dirt"
|
||||
and under_name ~= "default:dirt_with_grass"
|
||||
and minetest.env:get_node(above).name ~= "air"
|
||||
and minetest.env:get_node(above).name ~= "deault:leaves" then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, { name = "vines:vine_rotten" })
|
||||
else
|
||||
|
||||
if(minetest.env:get_node_light(pos, nil) < 4) then
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
-- maximum hieght for growth, checks whats under the current node
|
||||
local belowMax = {
|
||||
x = pos.x,
|
||||
y = pos.y - vine_height,
|
||||
z = pos.z,
|
||||
}
|
||||
local aboveMax = {
|
||||
x = pos.x,
|
||||
y = pos.y + vine_height,
|
||||
z = pos.z,
|
||||
}
|
||||
if jungle_trunk_count == 0 then -- grows above ground
|
||||
if minetest.env:get_node(above).name == "air"
|
||||
and minetest.env:get_node(pose).name == "vines:vine"
|
||||
and minetest.env:get_node(belowMax).name ~= "vines:vine" then
|
||||
minetest.env:add_node(above, { name = "vines:vine" })
|
||||
end
|
||||
else -- Grows below leaves
|
||||
if minetest.env:get_node(above).name == "deault:leaves"
|
||||
and (minetest.env:get_node(pose).name == "vines:vine" or minetest.env:get_node(pose).name == "air")
|
||||
and minetest.env:get_node(aboveMax).name ~= "vines:vine" then
|
||||
minetest.env:add_node(under, { name = "vines:vine" })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
-- deteriorate vines_rotten
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:vine_rotten"},
|
||||
interval = 60,
|
||||
chance = Rot_chance,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
-- only remove if there is no vine or dirt under the node
|
||||
if n.name ~= "vines:vine"
|
||||
or n.name ~= "default:dirt"
|
||||
or n.name ~= "default:dirt_with_grass" then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
|
||||
-- if the node is a vine_rotten then it will be removed
|
||||
if minetest.env:get_node(pos).name == "vines:vine_rotten" then
|
||||
-- and math.random(0,100) > Rot_chance then
|
||||
minetest.env:remove_node(pos)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
-- Grows from dirt
|
||||
minetest.register_abm({
|
||||
nodenames = {"default:dirt", "default:dirt_with_grass"},
|
||||
interval = 36000,
|
||||
chance = 2,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
local under = minetest.env:get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
--remove if top node is removed
|
||||
if n.name == "air" and (under.name == "default:dirt" or under.name == "default:dirt_with_grass") then
|
||||
minetest.env:add_node(p, {name="vines:vine"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {"vines:rope_end"},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
|
||||
--remove if top node is removed
|
||||
if n.name == "air" then
|
||||
minetest.env:remove_node(pos)
|
||||
minetest.env:add_node(pos, {name="vines:rope"})
|
||||
minetest.env:add_node(p, {name="vines:rope_end"})
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
is_node_in_cube = function(nodenames, node_pos, radius)
|
||||
for x = node_pos.x - radius, node_pos.x + radius do
|
||||
for y = node_pos.y - radius, node_pos.y + radius do
|
||||
for z = node_pos.z - radius, node_pos.z + radius do
|
||||
n = minetest.env:get_node_or_nil({x = x, y = y, z = z})
|
||||
if (n == nil)
|
||||
or (n.name == 'ignore')
|
||||
or (table_contains(nodenames, n.name) == true) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
table_contains = function(t, v)
|
||||
for _, i in ipairs(t) do
|
||||
if (i == v) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- craft rope
|
||||
minetest.register_craft({
|
||||
output = 'vines:rope_block',
|
||||
recipe = {
|
||||
{'', 'default:wood', ''},
|
||||
{'', 'vines:vines', ''},
|
||||
{'', 'vines:vines', ''},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("vines:vines", {
|
||||
description = "Vines",
|
||||
inventory_image = "vines_vine.png",
|
||||
})
|
||||
|
||||
minetest.register_on_dignode(function (pos, node, player)
|
||||
if node.name == 'vines:rope_block' then
|
||||
local p = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||
local n = minetest.env:get_node(p)
|
||||
while n.name == 'vines:rope' do
|
||||
minetest.env:remove_node(p)
|
||||
p = {x=p.x, y=p.y-1, z=p.z}
|
||||
n = minetest.env:get_node(p)
|
||||
end
|
||||
if n.name == 'vines:rope_end' then
|
||||
minetest.env:remove_node(p)
|
||||
end
|
||||
end
|
||||
end)
|
After Width: | Height: | Size: 244 B |
After Width: | Height: | Size: 625 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 463 B |