use set_node(), not add_node()

don't use minetest.env:* method (deprecated), use minetest.* instead
This commit is contained in:
Vanessa Ezekowitz 2014-08-15 19:34:15 -04:00
parent 985111d17c
commit b914e5395b
22 changed files with 261 additions and 261 deletions

View File

@ -75,7 +75,7 @@ biome = {
avoid_nodes = {table}, -- same meaning as savoid, above avoid_nodes = {table}, -- same meaning as savoid, above
avoid_radius = num, -- same as sradius avoid_radius = num, -- same as sradius
seed_diff = num, -- The Perlin seed difference value passed to seed_diff = num, -- The Perlin seed difference value passed to
-- the minetest.env:get_perlin() function. -- the minetest.get_perlin() function.
-- Used along with the global Perlin controls -- Used along with the global Perlin controls
-- below to create the "biome" in which the -- below to create the "biome" in which the
-- plants will spawn. Defaults to 0 if not -- plants will spawn. Defaults to 0 if not
@ -459,7 +459,7 @@ one it finds as a facedir value, or nil if there are no adjacent walls.
===== =====
is_node_loaded(pos) is_node_loaded(pos)
This acts as a wrapper for the minetest.env:get_node_or_nil(node_pos) This acts as a wrapper for the minetest.get_node_or_nil(node_pos)
function and accepts a single position parameter. Returns true if the node in function and accepts a single position parameter. Returns true if the node in
question is already loaded, or false if not. question is already loaded, or false if not.
@ -511,7 +511,7 @@ Fertile Ground Mapping
====================== ======================
The mod uses Perlin noise to create "biomes" of the various plants, via the The mod uses Perlin noise to create "biomes" of the various plants, via the
minetest.env:get_perlin() function. At present, there are three layers of minetest.get_perlin() function. At present, there are three layers of
Perlin noise used. Perlin noise used.
The first one is for a "fertile ground" layer, which I tend to refer to as the The first one is for a "fertile ground" layer, which I tend to refer to as the

View File

@ -182,14 +182,14 @@ abstract_bushes.grow_bush_node = function(pos,dir, leaf_type)
if minetest.get_node(right_here).name == "air" -- instead of check_air = true, if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then or minetest.get_node(right_here).name == "default:junglegrass" then
minetest.add_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir}) minetest.set_node(right_here, {name="bushes:bushbranches"..bush_branch_type , param2=dir})
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")") --minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
minetest.add_node(above_right_here, {name="bushes:BushLeaves"..leaf_type}) minetest.set_node(above_right_here, {name="bushes:BushLeaves"..leaf_type})
local chance_of_high_leaves = math.random(1,10) local chance_of_high_leaves = math.random(1,10)
if chance_of_high_leaves> 5 then if chance_of_high_leaves> 5 then
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
--minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")") --minetest.chat_send_all("leaf_type: (" .. leaf_type .. ")")
minetest.add_node(two_above_right_here, {name="bushes:BushLeaves"..leaf_type}) minetest.set_node(two_above_right_here, {name="bushes:BushLeaves"..leaf_type})
end end
end end
end end
@ -228,12 +228,12 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height)
if height == 4 then if height == 4 then
local two_above_right_here_south = {x=pos.x, y=pos.y+3, z=pos.z-1} 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} local three_above_right_here_south = {x=pos.x, y=pos.y+4, z=pos.z-1}
minetest.add_node(right_here, {name="bushes:youngtree2_bottom"}) minetest.set_node(right_here, {name="bushes:youngtree2_bottom"})
minetest.add_node(above_right_here, {name="bushes:youngtree2_bottom"}) minetest.set_node(above_right_here, {name="bushes:youngtree2_bottom"})
minetest.add_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2}) minetest.set_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2})
minetest.add_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0}) minetest.set_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0})
minetest.add_node(three_above_right_here, {name="bushes:BushLeaves1" }) minetest.set_node(three_above_right_here, {name="bushes:BushLeaves1" })
minetest.add_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) minetest.set_node(three_above_right_here_south, {name="bushes:BushLeaves1" })
end end
end end

View File

@ -54,8 +54,8 @@ plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger)
elseif( capabilities["groupcaps"]["snappy"] ) then elseif( capabilities["groupcaps"]["snappy"] ) then
-- plant a new bush without fruits -- plant a new bush without fruits
minetest.env:add_node(pos,{type='node',name='bushes:fruitless_bush'}) minetest.set_node(pos,{type='node',name='bushes:fruitless_bush'})
local meta = minetest.env:get_meta( pos ); local meta = minetest.get_meta( pos );
meta:set_string( 'bush_type', bush_name ); meta:set_string( 'bush_type', bush_name );
-- construct the stack of fruits the player will get -- construct the stack of fruits the player will get
@ -116,8 +116,8 @@ plantlife_bushes.after_place_node = function(pos, placer, itemstack)
return nil; return nil;
end end
minetest.env:set_node( pos, {type='node',name='bushes:fruitless_bush'}); minetest.set_node( pos, {type='node',name='bushes:fruitless_bush'});
local meta = minetest.env:get_meta( pos ); local meta = minetest.get_meta( pos );
meta:set_string( 'bush_type', name_parts[1] ); meta:set_string( 'bush_type', name_parts[1] );
return nil; return nil;
@ -133,13 +133,13 @@ minetest.register_abm({
chance = 5, chance = 5,
action = function(pos, node, active_object_count, active_object_count_wider) action = function(pos, node, active_object_count, active_object_count_wider)
local meta = minetest.env:get_meta( pos ); local meta = minetest.get_meta( pos );
local bush_name = meta:get_string( 'bush_type' ); local bush_name = meta:get_string( 'bush_type' );
if( bush_name ~= nil and bush_name ~= '' ) then if( bush_name ~= nil and bush_name ~= '' ) then
local dirtpos = { x = pos.x, y = pos.y-1, z = pos.z } local dirtpos = { x = pos.x, y = pos.y-1, z = pos.z }
local dirt = minetest.get_node(dirtpos) local dirt = minetest.get_node(dirtpos)
if dirt.name == "farming:soil_wet" or math.random(1,3) == 1 then if dirt.name == "farming:soil_wet" or math.random(1,3) == 1 then
minetest.env:set_node( pos, {type='node',name='bushes:'..bush_name..'_bush'}) minetest.set_node( pos, {type='node',name='bushes:'..bush_name..'_bush'})
end end
end end
end end

View File

@ -54,7 +54,7 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses)
return return
end end
local node = minetest.env:get_node(pt.under) local node = minetest.get_node(pt.under)
-- check if something that can be cut using fine tools -- check if something that can be cut using fine tools
if minetest.get_item_group(under.name, "snappy") > 0 then if minetest.get_item_group(under.name, "snappy") > 0 then
-- check if flora but no flower -- check if flora but no flower
@ -63,7 +63,7 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses)
minetest.set_node(pt.under, {name="dryplants:grass"}) minetest.set_node(pt.under, {name="dryplants:grass"})
else -- otherwise get the drop else -- otherwise get the drop
local inv = user:get_inventory() local inv = user:get_inventory()
local name = minetest.env: get_node(pt.under).name local name = minetest. get_node(pt.under).name
local the_drop = minetest.registered_nodes[name].drop local the_drop = minetest.registered_nodes[name].drop
@ -76,7 +76,7 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses)
inv:add_item("main", name) inv:add_item("main", name)
end end
end end
minetest.env:remove_node(pt.under) minetest.remove_node(pt.under)
end end
minetest.sound_play("default_dig_crumbly", { minetest.sound_play("default_dig_crumbly", {
pos = pt.under, pos = pt.under,
@ -131,7 +131,7 @@ minetest.register_abm({
interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle
chance = 1, chance = 1,
action = function(pos) action = function(pos)
minetest.env:add_node(pos, {name="dryplants:hay"}) minetest.set_node(pos, {name="dryplants:hay"})
end, end,
}) })
@ -176,10 +176,10 @@ minetest.register_abm({
interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle
chance = 100/GRASS_REGROWING_CHANCE, chance = 100/GRASS_REGROWING_CHANCE,
action = function(pos) action = function(pos)
minetest.env:add_node(pos, {name="default:dirt_with_grass"}) minetest.set_node(pos, {name="default:dirt_with_grass"})
end, end,
}) })
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
----------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------

View File

@ -12,12 +12,12 @@
abstract_dryplants.grow_juncus = function(pos) abstract_dryplants.grow_juncus = function(pos)
local juncus_type = math.random(2,3) local juncus_type = math.random(2,3)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
if minetest.env:get_node(right_here).name == "air" -- instead of check_air = true, if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.env:get_node(right_here).name == "default:junglegrass" then or minetest.get_node(right_here).name == "default:junglegrass" then
if juncus_type == 2 then if juncus_type == 2 then
minetest.env:add_node(right_here, {name="dryplants:juncus_02"}) minetest.set_node(right_here, {name="dryplants:juncus_02"})
else else
minetest.env:add_node(right_here, {name="dryplants:juncus"}) minetest.set_node(right_here, {name="dryplants:juncus"})
end end
end end
end end
@ -48,9 +48,9 @@ minetest.register_node("dryplants:juncus", {
local juncus_type = math.random(2,3) local juncus_type = math.random(2,3)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
if juncus_type == 2 then if juncus_type == 2 then
minetest.env:add_node(right_here, {name="dryplants:juncus_02"}) minetest.set_node(right_here, {name="dryplants:juncus_02"})
else else
minetest.env:add_node(right_here, {name="dryplants:juncus"}) minetest.set_node(right_here, {name="dryplants:juncus"})
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()

View File

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

View File

@ -13,7 +13,7 @@ abstract_dryplants.grow_grass = function(pos)
local grass_size = math.random(1,5) local grass_size = math.random(1,5)
if minetest.get_node(right_here).name == "air" -- instead of check_air = true, if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then or minetest.get_node(right_here).name == "default:junglegrass" then
minetest.add_node(right_here, {name="default:grass_"..grass_size}) minetest.set_node(right_here, {name="default:grass_"..grass_size})
end end
end end

View File

@ -94,17 +94,17 @@ if AUTO_ROOF_CORNER == true then
chance = 1, chance = 1,
action = function(pos) action = function(pos)
local node_east = minetest.env:get_node({x=pos.x+1, y=pos.y, z=pos.z }) local node_east = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z })
local node_west = minetest.env:get_node({x=pos.x-1, y=pos.y, z=pos.z }) local node_west = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z })
local node_north = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z+1}) local node_north = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
local node_south = minetest.env:get_node({x=pos.x, y=pos.y, z=pos.z-1}) local node_south = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
-- corner 1 -- corner 1
if ((node_west.name == roof and node_west.param2 == 0) if ((node_west.name == roof and node_west.param2 == 0)
or (node_west.name == corner and node_west.param2 == 1)) or (node_west.name == corner and node_west.param2 == 1))
and ((node_north.name == roof and node_north.param2 == 3) and ((node_north.name == roof and node_north.param2 == 3)
or (node_north.name == corner and node_north.param2 == 3)) or (node_north.name == corner and node_north.param2 == 3))
then then
minetest.env:add_node(pos, {name=corner, param2=0}) minetest.set_node(pos, {name=corner, param2=0})
end end
if ((node_north.name == roof and node_north.param2 == 1) if ((node_north.name == roof and node_north.param2 == 1)
@ -112,7 +112,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_east.name == roof and node_east.param2 == 0) and ((node_east.name == roof and node_east.param2 == 0)
or (node_east.name == corner and node_east.param2 == 0)) or (node_east.name == corner and node_east.param2 == 0))
then then
minetest.env:add_node(pos, {name=corner, param2=1}) minetest.set_node(pos, {name=corner, param2=1})
end end
if ((node_east.name == roof and node_east.param2 == 2) if ((node_east.name == roof and node_east.param2 == 2)
@ -120,7 +120,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_south.name == roof and node_south.param2 == 1) and ((node_south.name == roof and node_south.param2 == 1)
or (node_south.name == corner and node_south.param2 == 1)) or (node_south.name == corner and node_south.param2 == 1))
then then
minetest.env:add_node(pos, {name=corner, param2=2}) minetest.set_node(pos, {name=corner, param2=2})
end end
if ((node_south.name == roof and node_south.param2 == 3) if ((node_south.name == roof and node_south.param2 == 3)
@ -128,7 +128,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_west.name == roof and node_west.param2 == 2) and ((node_west.name == roof and node_west.param2 == 2)
or (node_west.name == corner and node_west.param2 == 2)) or (node_west.name == corner and node_west.param2 == 2))
then then
minetest.env:add_node(pos, {name=corner, param2=3}) minetest.set_node(pos, {name=corner, param2=3})
end end
-- corner 2 -- corner 2
if ((node_west.name == roof and node_west.param2 == 2) if ((node_west.name == roof and node_west.param2 == 2)
@ -136,7 +136,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_north.name == roof and node_north.param2 == 1) and ((node_north.name == roof and node_north.param2 == 1)
or (node_north.name == corner_2 and node_north.param2 == 3)) or (node_north.name == corner_2 and node_north.param2 == 3))
then then
minetest.env:add_node(pos, {name=corner_2, param2=0}) minetest.set_node(pos, {name=corner_2, param2=0})
end end
if ((node_north.name == roof and node_north.param2 == 3) if ((node_north.name == roof and node_north.param2 == 3)
@ -144,7 +144,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_east.name == roof and node_east.param2 == 2) and ((node_east.name == roof and node_east.param2 == 2)
or (node_east.name == corner_2 and node_east.param2 == 0)) or (node_east.name == corner_2 and node_east.param2 == 0))
then then
minetest.env:add_node(pos, {name=corner_2, param2=1}) minetest.set_node(pos, {name=corner_2, param2=1})
end end
if ((node_east.name == roof and node_east.param2 == 0) if ((node_east.name == roof and node_east.param2 == 0)
@ -152,7 +152,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_south.name == roof and node_south.param2 == 3) and ((node_south.name == roof and node_south.param2 == 3)
or (node_south.name == corner_2 and node_south.param2 == 1)) or (node_south.name == corner_2 and node_south.param2 == 1))
then then
minetest.env:add_node(pos, {name=corner_2, param2=2}) minetest.set_node(pos, {name=corner_2, param2=2})
end end
if ((node_south.name == roof and node_south.param2 == 1) if ((node_south.name == roof and node_south.param2 == 1)
@ -160,7 +160,7 @@ if AUTO_ROOF_CORNER == true then
and ((node_west.name == roof and node_west.param2 == 0) and ((node_west.name == roof and node_west.param2 == 0)
or (node_west.name == corner_2 and node_west.param2 == 2)) or (node_west.name == corner_2 and node_west.param2 == 2))
then then
minetest.env:add_node(pos, {name=corner_2, param2=3}) minetest.set_node(pos, {name=corner_2, param2=3})
end end
end, end,
@ -252,7 +252,7 @@ if REED_WILL_DRY == true then
chance = 1, chance = 1,
action = function(pos) action = function(pos)
local direction = minetest.get_node(pos).param2 local direction = minetest.get_node(pos).param2
minetest.env:add_node(pos, {name=DRy, param2=direction}) minetest.set_node(pos, {name=DRy, param2=direction})
end, end,
}) })
end end
@ -377,4 +377,4 @@ minetest.register_node("dryplants:reed_roof_corner_2", {
}, },
groups = {snappy=3, flammable=2}, groups = {snappy=3, flammable=2},
sounds = default.node_sound_leaves_defaults(), sounds = default.node_sound_leaves_defaults(),
}) })

View File

@ -28,21 +28,21 @@ abstract_dryplants.grow_reedmace = function(pos)
local pos_01 = {x = pos.x, y = pos.y + 1, z = pos.z} 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_02 = {x = pos.x, y = pos.y + 2, z = pos.z}
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z} local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
if minetest.env:get_node(pos_01).name == "air" -- bug fix if minetest.get_node(pos_01).name == "air" -- bug fix
or minetest.env:get_node(pos_01).name == "dryplants:reedmace_sapling" then or minetest.get_node(pos_01).name == "dryplants:reedmace_sapling" then
if minetest.env:get_node(pos_02).name ~= "air" then if minetest.get_node(pos_02).name ~= "air" then
minetest.env:add_node(pos_01, {name="dryplants:reedmace_top"}) minetest.set_node(pos_01, {name="dryplants:reedmace_top"})
elseif minetest.env:get_node(pos_03).name ~= "air" then elseif minetest.get_node(pos_03).name ~= "air" then
minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_2"}) minetest.set_node(pos_01, {name="dryplants:reedmace_height_2"})
elseif size == 1 then elseif size == 1 then
minetest.env:add_node(pos_01, {name="dryplants:reedmace_top"}) minetest.set_node(pos_01, {name="dryplants:reedmace_top"})
elseif size == 2 then elseif size == 2 then
minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_2"}) minetest.set_node(pos_01, {name="dryplants:reedmace_height_2"})
elseif size == 3 then elseif size == 3 then
if spikes == 1 then if spikes == 1 then
minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_3_spikes"}) minetest.set_node(pos_01, {name="dryplants:reedmace_height_3_spikes"})
else else
minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_3"}) minetest.set_node(pos_01, {name="dryplants:reedmace_height_3"})
end end
end end
end end
@ -56,20 +56,20 @@ abstract_dryplants.grow_reedmace_water = function(pos)
local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z} local pos_03 = {x = pos.x, y = pos.y + 3, z = pos.z}
local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z} local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z}
minetest.add_entity(pos_01, "dryplants:reedmace_water_entity") minetest.add_entity(pos_01, "dryplants:reedmace_water_entity")
if minetest.env:get_node(pos_02).name == "air" then -- bug fix if minetest.get_node(pos_02).name == "air" then -- bug fix
if minetest.env:get_node(pos_03).name ~= "air" then if minetest.get_node(pos_03).name ~= "air" then
minetest.env:add_node(pos_02, {name="dryplants:reedmace_top"}) minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif minetest.env:get_node(pos_04).name ~= "air" then elseif minetest.get_node(pos_04).name ~= "air" then
minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_2"}) minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 1 then elseif size == 1 then
minetest.env:add_node(pos_02, {name="dryplants:reedmace_top"}) minetest.set_node(pos_02, {name="dryplants:reedmace_top"})
elseif size == 2 then elseif size == 2 then
minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_2"}) minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"})
elseif size == 3 then elseif size == 3 then
if spikes == 1 then if spikes == 1 then
minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_3_spikes"}) minetest.set_node(pos_02, {name="dryplants:reedmace_height_3_spikes"})
else else
minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_3"}) minetest.set_node(pos_02, {name="dryplants:reedmace_height_3"})
end end
end end
end end
@ -276,14 +276,14 @@ minetest.register_abm({
interval = REEDMACE_GROWING_TIME, interval = REEDMACE_GROWING_TIME,
chance = 100/REEDMACE_GROWING_CHANCE, chance = 100/REEDMACE_GROWING_CHANCE,
action = function(pos, node, _, _) action = function(pos, node, _, _)
if string.find(minetest.env:get_node({x = pos.x + 1, y = pos.y, z = pos.z }).name, "default:water") if string.find(minetest.get_node({x = pos.x + 1, y = pos.y, z = pos.z }).name, "default:water")
or string.find(minetest.env:get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name, "default:water") or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z + 1}).name, "default:water")
or string.find(minetest.env:get_node({x = pos.x - 1, y = pos.y, z = pos.z }).name, "default:water") or string.find(minetest.get_node({x = pos.x - 1, y = pos.y, z = pos.z }).name, "default:water")
or string.find(minetest.env:get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name, "default:water") then or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name, "default:water") then
if minetest.env:get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then if minetest.get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then
abstract_dryplants.grow_reedmace_water({x = pos.x, y = pos.y - 1, z = pos.z}) abstract_dryplants.grow_reedmace_water({x = pos.x, y = pos.y - 1, z = pos.z})
end end
minetest.env:add_node({x=pos.x, y=pos.y, z=pos.z}, {name="default:water_source"}) minetest.set_node({x=pos.x, y=pos.y, z=pos.z}, {name="default:water_source"})
else else
abstract_dryplants.grow_reedmace({x = pos.x, y = pos.y - 1, z = pos.z}) abstract_dryplants.grow_reedmace({x = pos.x, y = pos.y - 1, z = pos.z})
end end

View File

@ -17,15 +17,15 @@ abstract_ferns.grow_fern = function(pos)
local fern_size = math.random(1,4) local fern_size = math.random(1,4)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
if minetest.env:get_node(right_here).name == "air" -- instead of check_air = true, if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.env:get_node(right_here).name == "default:junglegrass" then or minetest.get_node(right_here).name == "default:junglegrass" then
if fern_size == 1 then if fern_size == 1 then
minetest.env:add_node(right_here, {name="ferns:fern_01"}) minetest.set_node(right_here, {name="ferns:fern_01"})
elseif fern_size <= 3 then elseif fern_size <= 3 then
minetest.env:add_node(right_here, {name="ferns:fern_02"}) minetest.set_node(right_here, {name="ferns:fern_02"})
else -- fern_size == 4 then else -- fern_size == 4 then
minetest.env:add_node(right_here, {name="ferns:fern_03"}) minetest.set_node(right_here, {name="ferns:fern_03"})
end end
end end
end end

View File

@ -34,89 +34,89 @@ abstract_ferns.grow_giant_tree_fern = function(pos)
local leave_d_3 = {x = pos.x , y = pos.y + size - 1, z = pos.z - 3} local leave_d_3 = {x = pos.x , y = pos.y + size - 1, z = pos.z - 3}
local leave_d_4 = {x = pos.x , y = pos.y + size - 2, z = pos.z - 4} local leave_d_4 = {x = pos.x , y = pos.y + size - 2, z = pos.z - 4}
if minetest.env:get_node(pos_01).name == "air" -- instead of check_air = true, if minetest.get_node(pos_01).name == "air" -- instead of check_air = true,
or minetest.env:get_node(pos_01).name == "ferns:sapling_giant_tree_fern" or minetest.get_node(pos_01).name == "ferns:sapling_giant_tree_fern"
or minetest.env:get_node(pos_01).name == "default:junglegrass" then or minetest.get_node(pos_01).name == "default:junglegrass" then
for i = 1, size-3 do for i = 1, size-3 do
minetest.env:add_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"}) minetest.set_node({x = pos.x, y = pos.y + i, z = pos.z}, {name="ferns:fern_trunk_big"})
end end
minetest.env:add_node({x = pos.x, y = pos.y + size-2, z = pos.z}, {name="ferns:fern_trunk_big_top"}) minetest.set_node({x = pos.x, y = pos.y + size-2, z = pos.z}, {name="ferns:fern_trunk_big_top"})
minetest.env:add_node({x = pos.x, y = pos.y + size-1, z = pos.z}, {name="ferns:tree_fern_leaves_giant"}) minetest.set_node({x = pos.x, y = pos.y + size-1, z = pos.z}, {name="ferns:tree_fern_leaves_giant"})
-- all the checking for air below is to prevent some ugly bugs (incomplete trunks of neighbouring trees), it's a bit slower, but worth the result -- all the checking for air below is to prevent some ugly bugs (incomplete trunks of neighbouring trees), it's a bit slower, but worth the result
if minetest.env:get_node(leave_a_1).name == "air" then if minetest.get_node(leave_a_1).name == "air" then
minetest.env:add_node(leave_a_1, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_a_1, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_a_2).name == "air" then if minetest.get_node(leave_a_2).name == "air" then
minetest.env:add_node(leave_a_2, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_a_2, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_a_3).name == "air" then if minetest.get_node(leave_a_3).name == "air" then
minetest.env:add_node(leave_a_3, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_a_3, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_a_4).name == "air" then if minetest.get_node(leave_a_4).name == "air" then
minetest.env:add_node(leave_a_4, {name="ferns:tree_fern_leave_big_end", param2=3}) minetest.set_node(leave_a_4, {name="ferns:tree_fern_leave_big_end", param2=3})
end end
end end
end end
end end
if minetest.env:get_node(leave_b_1).name == "air" then if minetest.get_node(leave_b_1).name == "air" then
minetest.env:add_node(leave_b_1, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_b_1, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_b_2).name == "air" then if minetest.get_node(leave_b_2).name == "air" then
minetest.env:add_node(leave_b_2, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_b_2, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_b_3).name == "air" then if minetest.get_node(leave_b_3).name == "air" then
minetest.env:add_node(leave_b_3, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_b_3, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_b_4).name == "air" then if minetest.get_node(leave_b_4).name == "air" then
minetest.env:add_node(leave_b_4, {name="ferns:tree_fern_leave_big_end", param2=1}) minetest.set_node(leave_b_4, {name="ferns:tree_fern_leave_big_end", param2=1})
end end
end end
end end
end end
if minetest.env:get_node(leave_c_1).name == "air" then if minetest.get_node(leave_c_1).name == "air" then
minetest.env:add_node(leave_c_1, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_c_1, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_c_2).name == "air" then if minetest.get_node(leave_c_2).name == "air" then
minetest.env:add_node(leave_c_2, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_c_2, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_c_3).name == "air" then if minetest.get_node(leave_c_3).name == "air" then
minetest.env:add_node(leave_c_3, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_c_3, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_c_4).name == "air" then if minetest.get_node(leave_c_4).name == "air" then
minetest.env:add_node(leave_c_4, {name="ferns:tree_fern_leave_big_end", param2=2}) minetest.set_node(leave_c_4, {name="ferns:tree_fern_leave_big_end", param2=2})
end end
end end
end end
end end
if minetest.env:get_node(leave_d_1).name == "air" then if minetest.get_node(leave_d_1).name == "air" then
minetest.env:add_node(leave_d_1, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_d_1, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_d_2).name == "air" then if minetest.get_node(leave_d_2).name == "air" then
minetest.env:add_node(leave_d_2, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_d_2, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_d_3).name == "air" then if minetest.get_node(leave_d_3).name == "air" then
minetest.env:add_node(leave_d_3, {name="ferns:tree_fern_leave_big"}) minetest.set_node(leave_d_3, {name="ferns:tree_fern_leave_big"})
if minetest.env:get_node(leave_d_4).name == "air" then if minetest.get_node(leave_d_4).name == "air" then
minetest.env:add_node(leave_d_4, {name="ferns:tree_fern_leave_big_end", param2=0}) minetest.set_node(leave_d_4, {name="ferns:tree_fern_leave_big_end", param2=0})
end end
end end
end end
end end
-- bug fixes # 2 - doesn't really work, so disabled for now -- bug fixes # 2 - doesn't really work, so disabled for now
--[[if minetest.env:get_node(leave_a_4).name == "ferns:tree_fern_leave_big_end" --[[if minetest.get_node(leave_a_4).name == "ferns:tree_fern_leave_big_end"
and minetest.env:get_node(leave_a_3).name == "ferns:fern_trunk_big" then and minetest.get_node(leave_a_3).name == "ferns:fern_trunk_big" then
minetest.env:add_node(leave_a_4, {name="air"}) minetest.set_node(leave_a_4, {name="air"})
end end
if minetest.env:get_node(leave_b_4).name == "ferns:tree_fern_leave_big_end" if minetest.get_node(leave_b_4).name == "ferns:tree_fern_leave_big_end"
and minetest.env:get_node(leave_b_3).name == "ferns:fern_trunk_big" then and minetest.get_node(leave_b_3).name == "ferns:fern_trunk_big" then
minetest.env:add_node(leave_b_4, {name="air"}) minetest.set_node(leave_b_4, {name="air"})
end end
if minetest.env:get_node(leave_c_4).name == "ferns:tree_fern_leave_big_end" if minetest.get_node(leave_c_4).name == "ferns:tree_fern_leave_big_end"
and minetest.env:get_node(leave_c_3).name == "ferns:fern_trunk_big" then and minetest.get_node(leave_c_3).name == "ferns:fern_trunk_big" then
minetest.env:add_node(leave_c_4, {name="air"}) minetest.set_node(leave_c_4, {name="air"})
end end
if minetest.env:get_node(leave_d_4).name == "ferns:tree_fern_leave_big_end" if minetest.get_node(leave_d_4).name == "ferns:tree_fern_leave_big_end"
and minetest.env:get_node(leave_d_3).name == "ferns:fern_trunk_big" then and minetest.get_node(leave_d_3).name == "ferns:fern_trunk_big" then
minetest.env:add_node(leave_d_4, {name="air"}) minetest.set_node(leave_d_4, {name="air"})
end]] end]]
end end

View File

@ -12,13 +12,13 @@
abstract_ferns.grow_horsetail = function(pos) abstract_ferns.grow_horsetail = function(pos)
local horsetail_size = math.random(1,4) local horsetail_size = math.random(1,4)
if horsetail_size == 1 then if horsetail_size == 1 then
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_01"}) minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_01"})
elseif horsetail_size == 2 then elseif horsetail_size == 2 then
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_02"}) minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_02"})
elseif horsetail_size == 3 then elseif horsetail_size == 3 then
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_03"}) minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_03"})
elseif horsetail_size == 4 then elseif horsetail_size == 4 then
minetest.env:add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_04"}) minetest.set_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="ferns:horsetail_04"})
end end
end end

View File

@ -16,53 +16,53 @@ abstract_ferns.grow_tree_fern = function(pos)
local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z} local pos_04 = {x = pos.x, y = pos.y + 4, z = pos.z}
local pos_05 = {x = pos.x, y = pos.y + 5, z = pos.z} local pos_05 = {x = pos.x, y = pos.y + 5, z = pos.z}
if minetest.env:get_node(pos_01).name == "air" -- instead of check_air = true, if minetest.get_node(pos_01).name == "air" -- instead of check_air = true,
or minetest.env:get_node(pos_01).name == "ferns:sapling_tree_fern" or minetest.get_node(pos_01).name == "ferns:sapling_tree_fern"
or minetest.env:get_node(pos_01).name == "default:junglegrass" then or minetest.get_node(pos_01).name == "default:junglegrass" then
if minetest.env:get_node(pos_02).name ~= "air" if minetest.get_node(pos_02).name ~= "air"
or size == 1 then or size == 1 then
minetest.env:add_node(pos_01, {name="ferns:tree_fern_leaves"}) minetest.set_node(pos_01, {name="ferns:tree_fern_leaves"})
elseif minetest.env:get_node(pos_03).name ~= "air" elseif minetest.get_node(pos_03).name ~= "air"
or size == 2 then or size == 2 then
minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) minetest.set_node(pos_01, {name="ferns:fern_trunk"})
if crown == 1 then if crown == 1 then
minetest.env:add_node(pos_02, {name="ferns:tree_fern_leaves"}) minetest.set_node(pos_02, {name="ferns:tree_fern_leaves"})
else else
minetest.env:add_node(pos_02, {name="ferns:tree_fern_leaves_02"}) minetest.set_node(pos_02, {name="ferns:tree_fern_leaves_02"})
end end
elseif minetest.env:get_node(pos_04).name ~= "air" elseif minetest.get_node(pos_04).name ~= "air"
or size == 3 then or size == 3 then
minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) minetest.set_node(pos_01, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) minetest.set_node(pos_02, {name="ferns:fern_trunk"})
if crown == 1 then if crown == 1 then
minetest.env:add_node(pos_03, {name="ferns:tree_fern_leaves"}) minetest.set_node(pos_03, {name="ferns:tree_fern_leaves"})
else else
minetest.env:add_node(pos_03, {name="ferns:tree_fern_leaves_02"}) minetest.set_node(pos_03, {name="ferns:tree_fern_leaves_02"})
end end
elseif minetest.env:get_node(pos_05).name ~= "air" elseif minetest.get_node(pos_05).name ~= "air"
or size == 4 then or size == 4 then
minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) minetest.set_node(pos_01, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) minetest.set_node(pos_02, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_03, {name="ferns:fern_trunk"}) minetest.set_node(pos_03, {name="ferns:fern_trunk"})
if crown == 1 then if crown == 1 then
minetest.env:add_node(pos_04, {name="ferns:tree_fern_leaves"}) minetest.set_node(pos_04, {name="ferns:tree_fern_leaves"})
else else
minetest.env:add_node(pos_04, {name="ferns:tree_fern_leaves_02"}) minetest.set_node(pos_04, {name="ferns:tree_fern_leaves_02"})
end end
elseif size == 5 then elseif size == 5 then
minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) minetest.set_node(pos_01, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) minetest.set_node(pos_02, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_03, {name="ferns:fern_trunk"}) minetest.set_node(pos_03, {name="ferns:fern_trunk"})
minetest.env:add_node(pos_04, {name="ferns:fern_trunk"}) minetest.set_node(pos_04, {name="ferns:fern_trunk"})
if crown == 1 then if crown == 1 then
minetest.env:add_node(pos_05, {name="ferns:tree_fern_leaves"}) minetest.set_node(pos_05, {name="ferns:tree_fern_leaves"})
else else
minetest.env:add_node(pos_05, {name="ferns:tree_fern_leaves_02"}) minetest.set_node(pos_05, {name="ferns:tree_fern_leaves_02"})
end end
end end

View File

@ -99,7 +99,7 @@ for i in ipairs(lilies_list) do
local nodename = "default:cobble" -- if this block appears, something went....wrong :-) local nodename = "default:cobble" -- if this block appears, something went....wrong :-)
if not keys["sneak"] then if not keys["sneak"] then
local node = minetest.env:get_node(pt.under) local node = minetest.get_node(pt.under)
local waterlily = math.random(1,8) local waterlily = math.random(1,8)
if waterlily == 1 then if waterlily == 1 then
nodename = "flowers:waterlily" nodename = "flowers:waterlily"
@ -118,10 +118,10 @@ for i in ipairs(lilies_list) do
elseif waterlily == 8 then elseif waterlily == 8 then
nodename = "flowers:waterlily_s4" nodename = "flowers:waterlily_s4"
end end
minetest.add_node(place_pos, {name = nodename, param2 = math.random(0,3) }) minetest.set_node(place_pos, {name = nodename, param2 = math.random(0,3) })
else else
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(place_pos, {name = "flowers:waterlily", param2 = fdir}) minetest.set_node(place_pos, {name = "flowers:waterlily", param2 = fdir})
end end
if not plantslib.expect_infinite_stacks then if not plantslib.expect_infinite_stacks then
@ -199,7 +199,7 @@ for i in ipairs(algae_list) do
local nodename = "default:cobble" -- :D local nodename = "default:cobble" -- :D
if not keys["sneak"] then if not keys["sneak"] then
--local node = minetest.env:get_node(pt.under) --local node = minetest.get_node(pt.under)
local seaweed = math.random(1,4) local seaweed = math.random(1,4)
if seaweed == 1 then if seaweed == 1 then
nodename = "flowers:seaweed" nodename = "flowers:seaweed"
@ -210,10 +210,10 @@ for i in ipairs(algae_list) do
elseif seaweed == 4 then elseif seaweed == 4 then
nodename = "flowers:seaweed_4" nodename = "flowers:seaweed_4"
end end
minetest.add_node(place_pos, {name = nodename, param2 = math.random(0,3) }) minetest.set_node(place_pos, {name = nodename, param2 = math.random(0,3) })
else else
local fdir = minetest.dir_to_facedir(placer:get_look_dir()) local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.add_node(place_pos, {name = "flowers:seaweed", param2 = fdir}) minetest.set_node(place_pos, {name = "flowers:seaweed", param2 = fdir})
end end
if not plantslib.expect_infinite_stacks then if not plantslib.expect_infinite_stacks then
@ -307,7 +307,7 @@ flowers_plus.grow_waterlily = function(pos)
end end
if chance == num then if chance == num then
minetest.add_node(right_here, {name="flowers:waterlily"..ext, param2=math.random(0,3)}) minetest.set_node(right_here, {name="flowers:waterlily"..ext, param2=math.random(0,3)})
end end
end end
end end
@ -331,7 +331,7 @@ plantslib:register_generate_plant({
flowers_plus.grow_seaweed = function(pos) flowers_plus.grow_seaweed = function(pos)
local right_here = {x=pos.x, y=pos.y+1, z=pos.z} local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
minetest.add_node(right_here, {name="along_shore:seaweed_"..math.random(1,4), param2=math.random(1,3)}) minetest.set_node(right_here, {name="along_shore:seaweed_"..math.random(1,4), param2=math.random(1,3)})
end end
plantslib:register_generate_plant({ plantslib:register_generate_plant({

View File

@ -88,7 +88,7 @@ abstract_molehills.place_molehill = function(pos)
and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air" and minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z-1}).name ~= "air"
and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air" and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z+1}).name ~= "air"
and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name ~= "air" then and minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z-1}).name ~= "air" then
minetest.add_node(right_here, {name="molehills:molehill"}) minetest.set_node(right_here, {name="molehills:molehill"})
end end
end end

View File

@ -24,7 +24,7 @@ local function spawn_apple_under(pos)
z = pos.z, z = pos.z,
} }
if minetest.get_node(below).name == "air" then if minetest.get_node(below).name == "air" then
minetest.add_node(below, { name = "default:apple" }) minetest.set_node(below, { name = "default:apple" })
end end
end end

View File

@ -28,7 +28,7 @@ function nature:grow_node(pos, nodename)
if is_not_young(pos) and light_enough then if is_not_young(pos) and light_enough then
minetest.remove_node(pos) minetest.remove_node(pos)
minetest.add_node(pos, { name = nodename }) minetest.set_node(pos, { name = nodename })
set_young_node(pos) set_young_node(pos)
minetest.log("info", nodename .. " has grown at " .. pos.x .. "," minetest.log("info", nodename .. " has grown at " .. pos.x .. ","

View File

@ -260,7 +260,7 @@ function plantslib:generate_block(minp, maxp, blockseed)
spawned = true spawned = true
elseif objtype == "string" and elseif objtype == "string" and
minetest.registered_nodes[node_or_function_or_model] then minetest.registered_nodes[node_or_function_or_model] then
minetest.add_node(p_top, { name = node_or_function_or_model }) minetest.set_node(p_top, { name = node_or_function_or_model })
spawned = true spawned = true
elseif objtype == "function" then elseif objtype == "function" then
node_or_function_or_model(pos) node_or_function_or_model(pos)
@ -340,7 +340,7 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa)
local walldir = plantslib:find_adjacent_wall(p_top, biome.verticals_list) local walldir = plantslib:find_adjacent_wall(p_top, biome.verticals_list)
if biome.alt_wallnode and walldir then if biome.alt_wallnode and walldir then
if n_top.name == "air" then if n_top.name == "air" then
minetest.add_node(p_top, { name = biome.alt_wallnode, param2 = walldir }) minetest.set_node(p_top, { name = biome.alt_wallnode, param2 = walldir })
end end
else else
local currentsurface = minetest.get_node(pos).name local currentsurface = minetest.get_node(pos).name
@ -357,19 +357,19 @@ function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa)
assert(loadstring(spawn_plants.."(...)"))(pos) assert(loadstring(spawn_plants.."(...)"))(pos)
elseif not biome.spawn_on_side and not biome.spawn_on_bottom and not biome.spawn_replace_node then elseif not biome.spawn_on_side and not biome.spawn_on_bottom and not biome.spawn_replace_node then
if n_top.name == "air" then if n_top.name == "air" then
minetest.add_node(p_top, { name = plant_to_spawn, param2 = fdir }) minetest.set_node(p_top, { name = plant_to_spawn, param2 = fdir })
end end
elseif biome.spawn_replace_node then elseif biome.spawn_replace_node then
minetest.add_node(pos, { name = plant_to_spawn, param2 = fdir }) minetest.set_node(pos, { name = plant_to_spawn, param2 = fdir })
elseif biome.spawn_on_side then elseif biome.spawn_on_side then
local onside = plantslib:find_open_side(pos) local onside = plantslib:find_open_side(pos)
if onside then if onside then
minetest.add_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir }) minetest.set_node(onside.newpos, { name = plant_to_spawn, param2 = onside.facedir })
end end
elseif biome.spawn_on_bottom then elseif biome.spawn_on_bottom then
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "air" then
minetest.add_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = plant_to_spawn, param2 = fdir} ) minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, { name = plant_to_spawn, param2 = fdir} )
end end
end end
end end
@ -416,11 +416,11 @@ function plantslib:grow_plants(opts)
-- corner case for changing short junglegrass -- corner case for changing short junglegrass
-- to dry shrub in desert -- to dry shrub in desert
if n_bot.name == options.dry_early_node and options.grow_plant == "junglegrass:short" then if n_bot.name == options.dry_early_node and options.grow_plant == "junglegrass:short" then
minetest.add_node(pos, { name = "default:dry_shrub" }) minetest.set_node(pos, { name = "default:dry_shrub" })
elseif options.grow_vertically and walldir then elseif options.grow_vertically and walldir then
if plantslib:search_downward(pos, options.height_limit, options.ground_nodes) then if plantslib:search_downward(pos, options.height_limit, options.ground_nodes) then
minetest.add_node(p_top, { name = options.grow_plant, param2 = walldir}) minetest.set_node(p_top, { name = options.grow_plant, param2 = walldir})
end end
elseif not options.grow_result and not options.grow_function then elseif not options.grow_result and not options.grow_function then
@ -456,7 +456,7 @@ function plantslib:replace_object(pos, replacement, grow_function, walldir, seed
assert(loadstring(grow_function.."(...)"))(pos,noise1,noise2,walldir) assert(loadstring(grow_function.."(...)"))(pos,noise1,noise2,walldir)
return return
elseif growtype == "nil" then elseif growtype == "nil" then
minetest.add_node(pos, { name = replacement, param2 = walldir}) minetest.set_node(pos, { name = replacement, param2 = walldir})
return return
elseif growtype ~= "nil" and growtype ~= "string" and growtype ~= "table" then elseif growtype ~= "nil" and growtype ~= "string" and growtype ~= "table" then
error("Invalid grow function "..dump(grow_function).." used on object at ("..dump(pos)..")") error("Invalid grow function "..dump(grow_function).." used on object at ("..dump(pos)..")")
@ -611,7 +611,7 @@ function plantslib:generate_block_legacy(minp, maxp, biomedef, node_or_function_
spawned = true spawned = true
elseif objtype == "string" and elseif objtype == "string" and
minetest.registered_nodes[node_or_function_or_model] then minetest.registered_nodes[node_or_function_or_model] then
minetest.add_node(p_top, { name = node_or_function_or_model }) minetest.set_node(p_top, { name = node_or_function_or_model })
spawned = true spawned = true
elseif objtype == "function" then elseif objtype == "function" then
node_or_function_or_model(pos) node_or_function_or_model(pos)

View File

@ -37,7 +37,7 @@ abstract_trunks.place_twig = function(pos)
local node_n_w = minetest.get_node(north_west) local node_n_w = minetest.get_node(north_west)
-- small twigs -- small twigs
if twig_size <= 16 then if twig_size <= 16 then
minetest.add_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)}) minetest.set_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
end end
-- big twigs -- big twigs
if Big_Twigs == true then if Big_Twigs == true then
@ -47,13 +47,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_5"}) minetest.set_node(right_here, {name="trunks:twig_5"})
end end
if minetest.registered_nodes[node_n_e.name].buildable_to then if minetest.registered_nodes[node_n_e.name].buildable_to then
minetest.add_node(north_east, {name="trunks:twig_7"}) minetest.set_node(north_east, {name="trunks:twig_7"})
end end
if minetest.registered_nodes[node_east.name].buildable_to then if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name="trunks:twig_8"}) minetest.set_node(east, {name="trunks:twig_8"})
end end
end end
elseif twig_size == 18 then elseif twig_size == 18 then
@ -61,13 +61,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_5", param2=1}) minetest.set_node(right_here, {name="trunks:twig_5", param2=1})
end end
if minetest.registered_nodes[node_s_e.name].buildable_to then if minetest.registered_nodes[node_s_e.name].buildable_to then
minetest.add_node(south_east, {name="trunks:twig_7", param2=1}) minetest.set_node(south_east, {name="trunks:twig_7", param2=1})
end end
if minetest.registered_nodes[node_south.name].buildable_to then if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name="trunks:twig_8", param2=1}) minetest.set_node(south, {name="trunks:twig_8", param2=1})
end end
end end
elseif twig_size == 19 then elseif twig_size == 19 then
@ -75,13 +75,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_5", param2=2}) minetest.set_node(right_here, {name="trunks:twig_5", param2=2})
end end
if minetest.registered_nodes[node_s_w.name].buildable_to then if minetest.registered_nodes[node_s_w.name].buildable_to then
minetest.add_node(south_west, {name="trunks:twig_7", param2=2}) minetest.set_node(south_west, {name="trunks:twig_7", param2=2})
end end
if minetest.registered_nodes[node_west.name].buildable_to then if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name="trunks:twig_8", param2=2}) minetest.set_node(west, {name="trunks:twig_8", param2=2})
end end
end end
elseif twig_size == 20 then elseif twig_size == 20 then
@ -89,13 +89,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_5", param2=3}) minetest.set_node(right_here, {name="trunks:twig_5", param2=3})
end end
if minetest.registered_nodes[node_n_w.name].buildable_to then if minetest.registered_nodes[node_n_w.name].buildable_to then
minetest.add_node(north_west, {name="trunks:twig_7", param2=3}) minetest.set_node(north_west, {name="trunks:twig_7", param2=3})
end end
if minetest.registered_nodes[node_north.name].buildable_to then if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name="trunks:twig_8", param2=3}) minetest.set_node(north, {name="trunks:twig_8", param2=3})
end end
end end
-- big twig 2 -- big twig 2
@ -104,13 +104,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_9"}) minetest.set_node(right_here, {name="trunks:twig_9"})
end end
if minetest.registered_nodes[node_north.name].buildable_to then if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name="trunks:twig_10"}) minetest.set_node(north, {name="trunks:twig_10"})
end end
if minetest.registered_nodes[node_n_e.name].buildable_to then if minetest.registered_nodes[node_n_e.name].buildable_to then
minetest.add_node(north_east, {name="trunks:twig_11"}) minetest.set_node(north_east, {name="trunks:twig_11"})
end end
end end
elseif twig_size == 22 then elseif twig_size == 22 then
@ -118,13 +118,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_9", param2=1}) minetest.set_node(right_here, {name="trunks:twig_9", param2=1})
end end
if minetest.registered_nodes[node_east.name].buildable_to then if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name="trunks:twig_10", param2=1}) minetest.set_node(east, {name="trunks:twig_10", param2=1})
end end
if minetest.registered_nodes[node_s_e.name].buildable_to then if minetest.registered_nodes[node_s_e.name].buildable_to then
minetest.add_node(south_east, {name="trunks:twig_11", param2=1}) minetest.set_node(south_east, {name="trunks:twig_11", param2=1})
end end
end end
elseif twig_size == 23 then elseif twig_size == 23 then
@ -132,13 +132,13 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_9", param2=2}) minetest.set_node(right_here, {name="trunks:twig_9", param2=2})
end end
if minetest.registered_nodes[node_south.name].buildable_to then if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name="trunks:twig_10", param2=2}) minetest.set_node(south, {name="trunks:twig_10", param2=2})
end end
if minetest.registered_nodes[node_s_w.name].buildable_to then if minetest.registered_nodes[node_s_w.name].buildable_to then
minetest.add_node(south_west, {name="trunks:twig_11", param2=2}) minetest.set_node(south_west, {name="trunks:twig_11", param2=2})
end end
end end
elseif twig_size == 24 then elseif twig_size == 24 then
@ -146,17 +146,17 @@ abstract_trunks.place_twig = function(pos)
or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) then or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) then
if minetest.registered_nodes[node_here.name].buildable_to then if minetest.registered_nodes[node_here.name].buildable_to then
minetest.add_node(right_here, {name="trunks:twig_9", param2=3}) minetest.set_node(right_here, {name="trunks:twig_9", param2=3})
end end
if minetest.registered_nodes[node_west.name].buildable_to then if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name="trunks:twig_10", param2=3}) minetest.set_node(west, {name="trunks:twig_10", param2=3})
end end
if minetest.registered_nodes[node_n_w.name].buildable_to then if minetest.registered_nodes[node_n_w.name].buildable_to then
minetest.add_node(north_west, {name="trunks:twig_11", param2=3}) minetest.set_node(north_west, {name="trunks:twig_11", param2=3})
end end
end end
elseif twig_size <= 25 then elseif twig_size <= 25 then
minetest.add_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)}) minetest.set_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
end end
end end
end end
@ -269,70 +269,70 @@ abstract_trunks.place_trunk = function(pos)
local trunk_type = math.random(1,3) local trunk_type = math.random(1,3)
if trunk_type == 1 then if trunk_type == 1 then
if minetest.get_modpath(MoD) ~= nil then if minetest.get_modpath(MoD) ~= nil then
minetest.add_node(right_here, {name=MoD..":"..TRuNK}) minetest.set_node(right_here, {name=MoD..":"..TRuNK})
else else
minetest.add_node(right_here, {name="default:tree"}) minetest.set_node(right_here, {name="default:tree"})
end end
elseif trunk_type == 2 and Horizontal_Trunks == true then elseif trunk_type == 2 and Horizontal_Trunks == true then
if minetest.get_modpath(MoD) ~= nil then if minetest.get_modpath(MoD) ~= nil then
if minetest.registered_nodes[node_north.name].buildable_to then if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name=MoD..":"..TRuNK, param2=4}) minetest.set_node(north, {name=MoD..":"..TRuNK, param2=4})
end end
if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then
minetest.add_node(north2, {name=MoD..":"..TRuNK, param2=4}) minetest.set_node(north2, {name=MoD..":"..TRuNK, param2=4})
end end
minetest.add_node(right_here, {name=MoD..":"..TRuNK, param2=4}) minetest.set_node(right_here, {name=MoD..":"..TRuNK, param2=4})
if minetest.registered_nodes[node_south.name].buildable_to then if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name=MoD..":"..TRuNK, param2=4}) minetest.set_node(south, {name=MoD..":"..TRuNK, param2=4})
end end
if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then
minetest.add_node(south2, {name=MoD..":"..TRuNK, param2=4}) minetest.set_node(south2, {name=MoD..":"..TRuNK, param2=4})
end end
else else
if minetest.registered_nodes[node_north.name].buildable_to then if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name="default:tree", param2=4}) minetest.set_node(north, {name="default:tree", param2=4})
end end
if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then
minetest.add_node(north2, {name="default:tree", param2=4}) minetest.set_node(north2, {name="default:tree", param2=4})
end end
minetest.add_node(right_here, {name="default:tree", param2=4}) minetest.set_node(right_here, {name="default:tree", param2=4})
if minetest.registered_nodes[node_south.name].buildable_to then if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name="default:tree", param2=4}) minetest.set_node(south, {name="default:tree", param2=4})
end end
if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then
minetest.add_node(south2, {name="default:tree", param2=4}) minetest.set_node(south2, {name="default:tree", param2=4})
end end
end end
elseif trunk_type == 3 and Horizontal_Trunks == true then elseif trunk_type == 3 and Horizontal_Trunks == true then
if minetest.get_modpath(MoD) ~= nil then if minetest.get_modpath(MoD) ~= nil then
if minetest.registered_nodes[node_west.name].buildable_to then if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name=MoD..":"..TRuNK, param2=12}) minetest.set_node(west, {name=MoD..":"..TRuNK, param2=12})
end end
if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then
minetest.add_node(west2, {name=MoD..":"..TRuNK, param2=12}) minetest.set_node(west2, {name=MoD..":"..TRuNK, param2=12})
end end
minetest.add_node(right_here, {name=MoD..":"..TRuNK, param2=12}) minetest.set_node(right_here, {name=MoD..":"..TRuNK, param2=12})
if minetest.registered_nodes[node_east.name].buildable_to then if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name=MoD..":"..TRuNK, param2=12}) minetest.set_node(east, {name=MoD..":"..TRuNK, param2=12})
end end
if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then
minetest.add_node(east2, {name=MoD..":"..TRuNK, param2=12}) minetest.set_node(east2, {name=MoD..":"..TRuNK, param2=12})
end end
else else
if minetest.registered_nodes[node_west.name].buildable_to then if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name="default:tree", param2=12}) minetest.set_node(west, {name="default:tree", param2=12})
end end
if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then
minetest.add_node(west2, {name="default:tree", param2=12}) minetest.set_node(west2, {name="default:tree", param2=12})
end end
minetest.add_node(right_here, {name="default:tree", param2=12}) minetest.set_node(right_here, {name="default:tree", param2=12})
if minetest.registered_nodes[node_east.name].buildable_to then if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name="default:tree", param2=12}) minetest.set_node(east, {name="default:tree", param2=12})
end end
if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then
minetest.add_node(east2, {name="default:tree", param2=12}) minetest.set_node(east2, {name="default:tree", param2=12})
end end
end end
end end
@ -367,9 +367,9 @@ abstract_trunks.grow_moss_on_ground = function(pos)
local moss_type = math.random(1,21) local moss_type = math.random(1,21)
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)}) minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)})
else else
minetest.add_node(on_ground, {name="trunks:moss", param2=math.random(0,3)}) minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3)})
end end
end end
@ -418,41 +418,41 @@ abstract_trunks.grow_moss_on_trunk = function(pos)
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]}) minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.add_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]}) minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]})
end end
end end
local moss_type = math.random(1,31) -- cliche of more moss at north 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, if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true,
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7 minetest.set_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.add_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)}) minetest.set_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)})
end end
end end
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true, if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true,
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)}) minetest.set_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.add_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)}) minetest.set_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)})
end end
end end
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true, if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true,
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)}) minetest.set_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.add_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)}) minetest.set_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)})
end end
end end
local moss_type = math.random(1,41) local moss_type = math.random(1,41)
if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true, if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true,
if moss_type == 1 then if moss_type == 1 then
minetest.add_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)}) minetest.set_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)})
elseif moss_type < 22 then elseif moss_type < 22 then
minetest.add_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)}) minetest.set_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)})
end end
end end
--end --end
@ -520,16 +520,16 @@ abstract_trunks.grow_roots = function(pos)
and string.find(node_below.name, "dirt") and string.find(node_below.name, "dirt")
and node_here.param2 == 0 then and node_here.param2 == 0 then
if minetest.registered_nodes[node_north.name].buildable_to then if minetest.registered_nodes[node_north.name].buildable_to then
minetest.add_node(north, {name="trunks:"..TRuNK.."root", param2=2}) minetest.set_node(north, {name="trunks:"..TRuNK.."root", param2=2})
end end
if minetest.registered_nodes[node_east.name].buildable_to then if minetest.registered_nodes[node_east.name].buildable_to then
minetest.add_node(east, {name="trunks:"..TRuNK.."root", param2=3}) minetest.set_node(east, {name="trunks:"..TRuNK.."root", param2=3})
end end
if minetest.registered_nodes[node_south.name].buildable_to then if minetest.registered_nodes[node_south.name].buildable_to then
minetest.add_node(south, {name="trunks:"..TRuNK.."root", param2=0}) minetest.set_node(south, {name="trunks:"..TRuNK.."root", param2=0})
end end
if minetest.registered_nodes[node_west.name].buildable_to then if minetest.registered_nodes[node_west.name].buildable_to then
minetest.add_node(west, {name="trunks:"..TRuNK.."root", param2=1}) minetest.set_node(west, {name="trunks:"..TRuNK.."root", param2=1})
end end
end end
end end

View File

@ -223,7 +223,7 @@ if Auto_Roof_Corner == true then
and ((node_north.name == roof and node_north.param2 == 3) and ((node_north.name == roof and node_north.param2 == 3)
or (node_north.name == corner and node_north.param2 == 3)) or (node_north.name == corner and node_north.param2 == 3))
then then
minetest.add_node(pos, {name=corner, param2=0}) minetest.set_node(pos, {name=corner, param2=0})
end end
if ((node_north.name == roof and node_north.param2 == 1) if ((node_north.name == roof and node_north.param2 == 1)
@ -231,7 +231,7 @@ if Auto_Roof_Corner == true then
and ((node_east.name == roof and node_east.param2 == 0) and ((node_east.name == roof and node_east.param2 == 0)
or (node_east.name == corner and node_east.param2 == 0)) or (node_east.name == corner and node_east.param2 == 0))
then then
minetest.add_node(pos, {name=corner, param2=1}) minetest.set_node(pos, {name=corner, param2=1})
end end
if ((node_east.name == roof and node_east.param2 == 2) if ((node_east.name == roof and node_east.param2 == 2)
@ -239,7 +239,7 @@ if Auto_Roof_Corner == true then
and ((node_south.name == roof and node_south.param2 == 1) and ((node_south.name == roof and node_south.param2 == 1)
or (node_south.name == corner and node_south.param2 == 1)) or (node_south.name == corner and node_south.param2 == 1))
then then
minetest.add_node(pos, {name=corner, param2=2}) minetest.set_node(pos, {name=corner, param2=2})
end end
if ((node_south.name == roof and node_south.param2 == 3) if ((node_south.name == roof and node_south.param2 == 3)
@ -247,7 +247,7 @@ if Auto_Roof_Corner == true then
and ((node_west.name == roof and node_west.param2 == 2) and ((node_west.name == roof and node_west.param2 == 2)
or (node_west.name == corner and node_west.param2 == 2)) or (node_west.name == corner and node_west.param2 == 2))
then then
minetest.add_node(pos, {name=corner, param2=3}) minetest.set_node(pos, {name=corner, param2=3})
end end
-- corner 2 -- corner 2
if ((node_west.name == roof and node_west.param2 == 2) if ((node_west.name == roof and node_west.param2 == 2)
@ -255,7 +255,7 @@ if Auto_Roof_Corner == true then
and ((node_north.name == roof and node_north.param2 == 1) and ((node_north.name == roof and node_north.param2 == 1)
or (node_north.name == corner_2 and node_north.param2 == 3)) or (node_north.name == corner_2 and node_north.param2 == 3))
then then
minetest.add_node(pos, {name=corner_2, param2=0}) minetest.set_node(pos, {name=corner_2, param2=0})
end end
if ((node_north.name == roof and node_north.param2 == 3) if ((node_north.name == roof and node_north.param2 == 3)
@ -263,7 +263,7 @@ if Auto_Roof_Corner == true then
and ((node_east.name == roof and node_east.param2 == 2) and ((node_east.name == roof and node_east.param2 == 2)
or (node_east.name == corner_2 and node_east.param2 == 0)) or (node_east.name == corner_2 and node_east.param2 == 0))
then then
minetest.add_node(pos, {name=corner_2, param2=1}) minetest.set_node(pos, {name=corner_2, param2=1})
end end
if ((node_east.name == roof and node_east.param2 == 0) if ((node_east.name == roof and node_east.param2 == 0)
@ -271,7 +271,7 @@ if Auto_Roof_Corner == true then
and ((node_south.name == roof and node_south.param2 == 3) and ((node_south.name == roof and node_south.param2 == 3)
or (node_south.name == corner_2 and node_south.param2 == 1)) or (node_south.name == corner_2 and node_south.param2 == 1))
then then
minetest.add_node(pos, {name=corner_2, param2=2}) minetest.set_node(pos, {name=corner_2, param2=2})
end end
if ((node_south.name == roof and node_south.param2 == 1) if ((node_south.name == roof and node_south.param2 == 1)
@ -279,7 +279,7 @@ if Auto_Roof_Corner == true then
and ((node_west.name == roof and node_west.param2 == 0) and ((node_west.name == roof and node_west.param2 == 0)
or (node_west.name == corner_2 and node_west.param2 == 2)) or (node_west.name == corner_2 and node_west.param2 == 2))
then then
minetest.add_node(pos, {name=corner_2, param2=3}) minetest.set_node(pos, {name=corner_2, param2=3})
end end
end, end,

View File

@ -50,24 +50,24 @@ abstract_woodsoils.place_soil = function(pos)
local node_3b = minetest.get_node(radius_3b) local node_3b = minetest.get_node(radius_3b)
-- Dirt with Leaves 1 -- Dirt with Leaves 1
if minetest.get_item_group(minetest.get_node(radius_1a).name, "soil") > 0 then if minetest.get_item_group(minetest.get_node(radius_1a).name, "soil") > 0 then
minetest.add_node(radius_1a, {name="woodsoils:dirt_with_leaves_1"}) minetest.set_node(radius_1a, {name="woodsoils:dirt_with_leaves_1"})
end end
if minetest.get_item_group(minetest.get_node(radius_1b).name, "soil") > 0 then if minetest.get_item_group(minetest.get_node(radius_1b).name, "soil") > 0 then
minetest.add_node(radius_1b, {name="woodsoils:dirt_with_leaves_1"}) minetest.set_node(radius_1b, {name="woodsoils:dirt_with_leaves_1"})
end end
-- Grass with Leaves 2 -- Grass with Leaves 2
if string.find(node_2a.name, "dirt_with_grass") then if string.find(node_2a.name, "dirt_with_grass") then
minetest.add_node(radius_2a, {name="woodsoils:grass_with_leaves_2"}) minetest.set_node(radius_2a, {name="woodsoils:grass_with_leaves_2"})
end end
if string.find(node_2b.name, "dirt_with_grass") then if string.find(node_2b.name, "dirt_with_grass") then
minetest.add_node(radius_2b, {name="woodsoils:grass_with_leaves_2"}) minetest.set_node(radius_2b, {name="woodsoils:grass_with_leaves_2"})
end end
-- Grass with Leaves 1 -- Grass with Leaves 1
if string.find(node_3a.name, "dirt_with_grass") then if string.find(node_3a.name, "dirt_with_grass") then
minetest.add_node(radius_3a, {name="woodsoils:grass_with_leaves_1"}) minetest.set_node(radius_3a, {name="woodsoils:grass_with_leaves_1"})
end end
if string.find(node_3b.name, "dirt_with_grass") then if string.find(node_3b.name, "dirt_with_grass") then
minetest.add_node(radius_3b, {name="woodsoils:grass_with_leaves_1"}) minetest.set_node(radius_3b, {name="woodsoils:grass_with_leaves_1"})
end end
end end
end end

View File

@ -122,17 +122,17 @@ abstract_youngtrees.grow_youngtree_node = function(pos, height)
if minetest.get_node(right_here).name == "air" -- instead of check_air = true, if minetest.get_node(right_here).name == "air" -- instead of check_air = true,
or minetest.get_node(right_here).name == "default:junglegrass" then or minetest.get_node(right_here).name == "default:junglegrass" then
if height == 1 then if height == 1 then
minetest.add_node(right_here, {name="youngtrees:youngtree_top"}) minetest.set_node(right_here, {name="youngtrees:youngtree_top"})
end end
if height == 2 then if height == 2 then
minetest.add_node(right_here, {name="youngtrees:youngtree_bottom"}) minetest.set_node(right_here, {name="youngtrees:youngtree_bottom"})
minetest.add_node(above_right_here, {name="youngtrees:youngtree_top"}) minetest.set_node(above_right_here, {name="youngtrees:youngtree_top"})
end end
if height == 3 then if height == 3 then
local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z}
minetest.add_node(right_here, {name="youngtrees:youngtree_bottom"}) minetest.set_node(right_here, {name="youngtrees:youngtree_bottom"})
minetest.add_node(above_right_here, {name="youngtrees:youngtree_middle"}) minetest.set_node(above_right_here, {name="youngtrees:youngtree_middle"})
minetest.add_node(two_above_right_here, {name="youngtrees:youngtree_top"}) minetest.set_node(two_above_right_here, {name="youngtrees:youngtree_top"})
end end
end end
end end