From b914e5395ba1a5900254e57b29e31f8890972a67 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Fri, 15 Aug 2014 19:34:15 -0400 Subject: [PATCH] use set_node(), not add_node() don't use minetest.env:* method (deprecated), use minetest.* instead --- API.txt | 6 +- bushes/init.lua | 18 ++-- bushes_classic/nodes.lua | 12 +-- dryplants/init.lua | 12 +-- dryplants/juncus.lua | 12 +-- dryplants/meadowvariation.lua | 2 +- dryplants/moregrass.lua | 2 +- dryplants/reed.lua | 28 +++---- dryplants/reedmace.lua | 50 +++++------ ferns/fern.lua | 10 +-- ferns/gianttreefern.lua | 100 +++++++++++----------- ferns/horsetail.lua | 8 +- ferns/treefern.lua | 52 ++++++------ flowers_plus/init.lua | 16 ++-- molehills/init.lua | 2 +- nature_classic/blossom.lua | 2 +- nature_classic/global_function.lua | 2 +- plants_lib/init.lua | 20 ++--- trunks/generating.lua | 128 ++++++++++++++--------------- trunks/nodes.lua | 16 ++-- woodsoils/generating.lua | 12 +-- youngtrees/init.lua | 12 +-- 22 files changed, 261 insertions(+), 261 deletions(-) diff --git a/API.txt b/API.txt index 02adc79..05313db 100644 --- a/API.txt +++ b/API.txt @@ -75,7 +75,7 @@ biome = { avoid_nodes = {table}, -- same meaning as savoid, above avoid_radius = num, -- same as sradius 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 -- below to create the "biome" in which the -- 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) -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 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 -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. The first one is for a "fertile ground" layer, which I tend to refer to as the diff --git a/bushes/init.lua b/bushes/init.lua index 1ca6023..d92187b 100644 --- a/bushes/init.lua +++ b/bushes/init.lua @@ -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, 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.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) if chance_of_high_leaves> 5 then local two_above_right_here = {x=pos.x, y=pos.y+3, z=pos.z} --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 @@ -228,12 +228,12 @@ abstract_bushes.grow_youngtree_node2 = function(pos, height) if height == 4 then local two_above_right_here_south = {x=pos.x, y=pos.y+3, z=pos.z-1} local three_above_right_here_south = {x=pos.x, y=pos.y+4, z=pos.z-1} - minetest.add_node(right_here, {name="bushes:youngtree2_bottom"}) - minetest.add_node(above_right_here, {name="bushes:youngtree2_bottom"}) - minetest.add_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2}) - minetest.add_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0}) - minetest.add_node(three_above_right_here, {name="bushes:BushLeaves1" }) - minetest.add_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) + minetest.set_node(right_here, {name="bushes:youngtree2_bottom"}) + minetest.set_node(above_right_here, {name="bushes:youngtree2_bottom"}) + minetest.set_node(two_above_right_here, {name="bushes:bushbranches2" , param2=2}) + minetest.set_node(two_above_right_here_south, {name="bushes:bushbranches2" , param2=0}) + minetest.set_node(three_above_right_here, {name="bushes:BushLeaves1" }) + minetest.set_node(three_above_right_here_south, {name="bushes:BushLeaves1" }) end end diff --git a/bushes_classic/nodes.lua b/bushes_classic/nodes.lua index 8ffb511..caa886e 100644 --- a/bushes_classic/nodes.lua +++ b/bushes_classic/nodes.lua @@ -54,8 +54,8 @@ plantlife_bushes.after_dig_node = function(pos, oldnode, oldmetadata, digger) elseif( capabilities["groupcaps"]["snappy"] ) then -- plant a new bush without fruits - minetest.env:add_node(pos,{type='node',name='bushes:fruitless_bush'}) - local meta = minetest.env:get_meta( pos ); + minetest.set_node(pos,{type='node',name='bushes:fruitless_bush'}) + local meta = minetest.get_meta( pos ); meta:set_string( 'bush_type', bush_name ); -- construct the stack of fruits the player will get @@ -116,8 +116,8 @@ plantlife_bushes.after_place_node = function(pos, placer, itemstack) return nil; end - minetest.env:set_node( pos, {type='node',name='bushes:fruitless_bush'}); - local meta = minetest.env:get_meta( pos ); + minetest.set_node( pos, {type='node',name='bushes:fruitless_bush'}); + local meta = minetest.get_meta( pos ); meta:set_string( 'bush_type', name_parts[1] ); return nil; @@ -133,13 +133,13 @@ minetest.register_abm({ chance = 5, 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' ); if( bush_name ~= nil and bush_name ~= '' ) then local dirtpos = { x = pos.x, y = pos.y-1, z = pos.z } local dirt = minetest.get_node(dirtpos) 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 diff --git a/dryplants/init.lua b/dryplants/init.lua index 0227771..3c8b30a 100644 --- a/dryplants/init.lua +++ b/dryplants/init.lua @@ -54,7 +54,7 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses) return 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 if minetest.get_item_group(under.name, "snappy") > 0 then -- 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"}) else -- otherwise get the drop 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 @@ -76,7 +76,7 @@ local function sickle_on_use(itemstack, user, pointed_thing, uses) inv:add_item("main", name) end end - minetest.env:remove_node(pt.under) + minetest.remove_node(pt.under) end minetest.sound_play("default_dig_crumbly", { pos = pt.under, @@ -131,7 +131,7 @@ minetest.register_abm({ interval = HAY_DRYING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle chance = 1, action = function(pos) - minetest.env:add_node(pos, {name="dryplants:hay"}) + minetest.set_node(pos, {name="dryplants:hay"}) end, }) @@ -176,10 +176,10 @@ minetest.register_abm({ interval = GRASS_REGROWING_TIME, --1200, -- 20 minutes: a minetest-day/night-cycle chance = 100/GRASS_REGROWING_CHANCE, action = function(pos) - minetest.env:add_node(pos, {name="default:dirt_with_grass"}) + minetest.set_node(pos, {name="default:dirt_with_grass"}) end, }) ----------------------------------------------------------------------------------------------- print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") ------------------------------------------------------------------------------------------------ \ No newline at end of file +----------------------------------------------------------------------------------------------- diff --git a/dryplants/juncus.lua b/dryplants/juncus.lua index 9dedcbd..43ae97a 100644 --- a/dryplants/juncus.lua +++ b/dryplants/juncus.lua @@ -12,12 +12,12 @@ abstract_dryplants.grow_juncus = function(pos) local juncus_type = math.random(2,3) 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, - or minetest.env:get_node(right_here).name == "default:junglegrass" then + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + or minetest.get_node(right_here).name == "default:junglegrass" 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 - minetest.env:add_node(right_here, {name="dryplants:juncus"}) + minetest.set_node(right_here, {name="dryplants:juncus"}) end end end @@ -48,9 +48,9 @@ minetest.register_node("dryplants:juncus", { local juncus_type = math.random(2,3) local right_here = {x=pos.x, y=pos.y+1, z=pos.z} 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 - minetest.env:add_node(right_here, {name="dryplants:juncus"}) + minetest.set_node(right_here, {name="dryplants:juncus"}) end if not minetest.setting_getbool("creative_mode") then itemstack:take_item() diff --git a/dryplants/meadowvariation.lua b/dryplants/meadowvariation.lua index 025733c..31484ff 100644 --- a/dryplants/meadowvariation.lua +++ b/dryplants/meadowvariation.lua @@ -10,7 +10,7 @@ abstract_dryplants.grow_grass_variation = function(pos) 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 plantslib:register_generate_plant({ diff --git a/dryplants/moregrass.lua b/dryplants/moregrass.lua index 1ad4d3e..aec09b9 100644 --- a/dryplants/moregrass.lua +++ b/dryplants/moregrass.lua @@ -13,7 +13,7 @@ abstract_dryplants.grow_grass = function(pos) local grass_size = math.random(1,5) if minetest.get_node(right_here).name == "air" -- instead of check_air = true, or minetest.get_node(right_here).name == "default:junglegrass" then - minetest.add_node(right_here, {name="default:grass_"..grass_size}) + minetest.set_node(right_here, {name="default:grass_"..grass_size}) end end diff --git a/dryplants/reed.lua b/dryplants/reed.lua index f4e97a8..6f29028 100644 --- a/dryplants/reed.lua +++ b/dryplants/reed.lua @@ -94,17 +94,17 @@ if AUTO_ROOF_CORNER == true then chance = 1, action = function(pos) - local node_east = minetest.env: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_north = minetest.env: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_east = minetest.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.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 if ((node_west.name == roof and node_west.param2 == 0) or (node_west.name == corner and node_west.param2 == 1)) and ((node_north.name == roof and node_north.param2 == 3) or (node_north.name == corner and node_north.param2 == 3)) then - minetest.env:add_node(pos, {name=corner, param2=0}) + minetest.set_node(pos, {name=corner, param2=0}) end 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) or (node_east.name == corner and node_east.param2 == 0)) then - minetest.env:add_node(pos, {name=corner, param2=1}) + minetest.set_node(pos, {name=corner, param2=1}) end 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) or (node_south.name == corner and node_south.param2 == 1)) then - minetest.env:add_node(pos, {name=corner, param2=2}) + minetest.set_node(pos, {name=corner, param2=2}) end 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) or (node_west.name == corner and node_west.param2 == 2)) then - minetest.env:add_node(pos, {name=corner, param2=3}) + minetest.set_node(pos, {name=corner, param2=3}) end -- corner 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) or (node_north.name == corner_2 and node_north.param2 == 3)) then - minetest.env:add_node(pos, {name=corner_2, param2=0}) + minetest.set_node(pos, {name=corner_2, param2=0}) end 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) or (node_east.name == corner_2 and node_east.param2 == 0)) then - minetest.env:add_node(pos, {name=corner_2, param2=1}) + minetest.set_node(pos, {name=corner_2, param2=1}) end 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) or (node_south.name == corner_2 and node_south.param2 == 1)) then - minetest.env:add_node(pos, {name=corner_2, param2=2}) + minetest.set_node(pos, {name=corner_2, param2=2}) end 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) or (node_west.name == corner_2 and node_west.param2 == 2)) then - minetest.env:add_node(pos, {name=corner_2, param2=3}) + minetest.set_node(pos, {name=corner_2, param2=3}) end end, @@ -252,7 +252,7 @@ if REED_WILL_DRY == true then chance = 1, action = function(pos) 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 @@ -377,4 +377,4 @@ minetest.register_node("dryplants:reed_roof_corner_2", { }, groups = {snappy=3, flammable=2}, sounds = default.node_sound_leaves_defaults(), -}) \ No newline at end of file +}) diff --git a/dryplants/reedmace.lua b/dryplants/reedmace.lua index 3a01385..81c54d1 100644 --- a/dryplants/reedmace.lua +++ b/dryplants/reedmace.lua @@ -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_02 = {x = pos.x, y = pos.y + 2, 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 - or minetest.env:get_node(pos_01).name == "dryplants:reedmace_sapling" then - if minetest.env:get_node(pos_02).name ~= "air" then - minetest.env:add_node(pos_01, {name="dryplants:reedmace_top"}) - elseif minetest.env:get_node(pos_03).name ~= "air" then - minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_2"}) + if minetest.get_node(pos_01).name == "air" -- bug fix + or minetest.get_node(pos_01).name == "dryplants:reedmace_sapling" then + if minetest.get_node(pos_02).name ~= "air" then + minetest.set_node(pos_01, {name="dryplants:reedmace_top"}) + elseif minetest.get_node(pos_03).name ~= "air" then + minetest.set_node(pos_01, {name="dryplants:reedmace_height_2"}) 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 - 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 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 - minetest.env:add_node(pos_01, {name="dryplants:reedmace_height_3"}) + minetest.set_node(pos_01, {name="dryplants:reedmace_height_3"}) 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_04 = {x = pos.x, y = pos.y + 4, z = pos.z} minetest.add_entity(pos_01, "dryplants:reedmace_water_entity") - if minetest.env:get_node(pos_02).name == "air" then -- bug fix - if minetest.env:get_node(pos_03).name ~= "air" then - minetest.env:add_node(pos_02, {name="dryplants:reedmace_top"}) - elseif minetest.env:get_node(pos_04).name ~= "air" then - minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_2"}) + if minetest.get_node(pos_02).name == "air" then -- bug fix + if minetest.get_node(pos_03).name ~= "air" then + minetest.set_node(pos_02, {name="dryplants:reedmace_top"}) + elseif minetest.get_node(pos_04).name ~= "air" then + minetest.set_node(pos_02, {name="dryplants:reedmace_height_2"}) 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 - 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 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 - minetest.env:add_node(pos_02, {name="dryplants:reedmace_height_3"}) + minetest.set_node(pos_02, {name="dryplants:reedmace_height_3"}) end end end @@ -276,14 +276,14 @@ minetest.register_abm({ interval = REEDMACE_GROWING_TIME, chance = 100/REEDMACE_GROWING_CHANCE, action = function(pos, node, _, _) - if string.find(minetest.env: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.env: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 - if minetest.env:get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then + if string.find(minetest.get_node({x = pos.x + 1, y = pos.y, z = pos.z }).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.get_node({x = pos.x - 1, y = pos.y, z = pos.z }).name, "default:water") + or string.find(minetest.get_node({x = pos.x, y = pos.y, z = pos.z - 1}).name, "default:water") 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}) 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 abstract_dryplants.grow_reedmace({x = pos.x, y = pos.y - 1, z = pos.z}) end diff --git a/ferns/fern.lua b/ferns/fern.lua index fa4d99b..ef7e5b2 100644 --- a/ferns/fern.lua +++ b/ferns/fern.lua @@ -17,15 +17,15 @@ abstract_ferns.grow_fern = function(pos) local fern_size = math.random(1,4) 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, - or minetest.env:get_node(right_here).name == "default:junglegrass" then + if minetest.get_node(right_here).name == "air" -- instead of check_air = true, + or minetest.get_node(right_here).name == "default:junglegrass" 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 - minetest.env:add_node(right_here, {name="ferns:fern_02"}) + minetest.set_node(right_here, {name="ferns:fern_02"}) 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 diff --git a/ferns/gianttreefern.lua b/ferns/gianttreefern.lua index 6897bcd..6b4de26 100644 --- a/ferns/gianttreefern.lua +++ b/ferns/gianttreefern.lua @@ -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_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, - or minetest.env:get_node(pos_01).name == "ferns:sapling_giant_tree_fern" - or minetest.env:get_node(pos_01).name == "default:junglegrass" then + if minetest.get_node(pos_01).name == "air" -- instead of check_air = true, + or minetest.get_node(pos_01).name == "ferns:sapling_giant_tree_fern" + or minetest.get_node(pos_01).name == "default:junglegrass" then 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 - minetest.env:add_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-2, z = pos.z}, {name="ferns:fern_trunk_big_top"}) + 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 - if minetest.env:get_node(leave_a_1).name == "air" then - minetest.env:add_node(leave_a_1, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_a_2).name == "air" then - minetest.env:add_node(leave_a_2, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_a_3).name == "air" then - minetest.env:add_node(leave_a_3, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_a_4).name == "air" then - minetest.env:add_node(leave_a_4, {name="ferns:tree_fern_leave_big_end", param2=3}) + if minetest.get_node(leave_a_1).name == "air" then + minetest.set_node(leave_a_1, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_a_2).name == "air" then + minetest.set_node(leave_a_2, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_a_3).name == "air" then + minetest.set_node(leave_a_3, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_a_4).name == "air" then + minetest.set_node(leave_a_4, {name="ferns:tree_fern_leave_big_end", param2=3}) end end end end - if minetest.env:get_node(leave_b_1).name == "air" then - minetest.env:add_node(leave_b_1, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_b_2).name == "air" then - minetest.env:add_node(leave_b_2, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_b_3).name == "air" then - minetest.env:add_node(leave_b_3, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_b_4).name == "air" then - minetest.env:add_node(leave_b_4, {name="ferns:tree_fern_leave_big_end", param2=1}) + if minetest.get_node(leave_b_1).name == "air" then + minetest.set_node(leave_b_1, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_b_2).name == "air" then + minetest.set_node(leave_b_2, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_b_3).name == "air" then + minetest.set_node(leave_b_3, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_b_4).name == "air" then + minetest.set_node(leave_b_4, {name="ferns:tree_fern_leave_big_end", param2=1}) end end end end - if minetest.env:get_node(leave_c_1).name == "air" then - minetest.env:add_node(leave_c_1, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_c_2).name == "air" then - minetest.env:add_node(leave_c_2, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_c_3).name == "air" then - minetest.env:add_node(leave_c_3, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_c_4).name == "air" then - minetest.env:add_node(leave_c_4, {name="ferns:tree_fern_leave_big_end", param2=2}) + if minetest.get_node(leave_c_1).name == "air" then + minetest.set_node(leave_c_1, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_c_2).name == "air" then + minetest.set_node(leave_c_2, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_c_3).name == "air" then + minetest.set_node(leave_c_3, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_c_4).name == "air" then + minetest.set_node(leave_c_4, {name="ferns:tree_fern_leave_big_end", param2=2}) end end end end - if minetest.env:get_node(leave_d_1).name == "air" then - minetest.env:add_node(leave_d_1, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_d_2).name == "air" then - minetest.env:add_node(leave_d_2, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_d_3).name == "air" then - minetest.env:add_node(leave_d_3, {name="ferns:tree_fern_leave_big"}) - if minetest.env:get_node(leave_d_4).name == "air" then - minetest.env:add_node(leave_d_4, {name="ferns:tree_fern_leave_big_end", param2=0}) + if minetest.get_node(leave_d_1).name == "air" then + minetest.set_node(leave_d_1, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_d_2).name == "air" then + minetest.set_node(leave_d_2, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_d_3).name == "air" then + minetest.set_node(leave_d_3, {name="ferns:tree_fern_leave_big"}) + if minetest.get_node(leave_d_4).name == "air" then + minetest.set_node(leave_d_4, {name="ferns:tree_fern_leave_big_end", param2=0}) end end end end -- 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" - and minetest.env:get_node(leave_a_3).name == "ferns:fern_trunk_big" then - minetest.env:add_node(leave_a_4, {name="air"}) + --[[if minetest.get_node(leave_a_4).name == "ferns:tree_fern_leave_big_end" + and minetest.get_node(leave_a_3).name == "ferns:fern_trunk_big" then + minetest.set_node(leave_a_4, {name="air"}) end - if minetest.env: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 - minetest.env:add_node(leave_b_4, {name="air"}) + if minetest.get_node(leave_b_4).name == "ferns:tree_fern_leave_big_end" + and minetest.get_node(leave_b_3).name == "ferns:fern_trunk_big" then + minetest.set_node(leave_b_4, {name="air"}) end - if minetest.env: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 - minetest.env:add_node(leave_c_4, {name="air"}) + if minetest.get_node(leave_c_4).name == "ferns:tree_fern_leave_big_end" + and minetest.get_node(leave_c_3).name == "ferns:fern_trunk_big" then + minetest.set_node(leave_c_4, {name="air"}) end - if minetest.env: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 - minetest.env:add_node(leave_d_4, {name="air"}) + if minetest.get_node(leave_d_4).name == "ferns:tree_fern_leave_big_end" + and minetest.get_node(leave_d_3).name == "ferns:fern_trunk_big" then + minetest.set_node(leave_d_4, {name="air"}) end]] end diff --git a/ferns/horsetail.lua b/ferns/horsetail.lua index 06608f8..bfab07e 100644 --- a/ferns/horsetail.lua +++ b/ferns/horsetail.lua @@ -12,13 +12,13 @@ abstract_ferns.grow_horsetail = function(pos) local horsetail_size = math.random(1,4) 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 - 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 - 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 - 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 diff --git a/ferns/treefern.lua b/ferns/treefern.lua index bcd11fe..a507620 100644 --- a/ferns/treefern.lua +++ b/ferns/treefern.lua @@ -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_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, - or minetest.env:get_node(pos_01).name == "ferns:sapling_tree_fern" - or minetest.env:get_node(pos_01).name == "default:junglegrass" then + if minetest.get_node(pos_01).name == "air" -- instead of check_air = true, + or minetest.get_node(pos_01).name == "ferns:sapling_tree_fern" + 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 - 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 - minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) + minetest.set_node(pos_01, {name="ferns:fern_trunk"}) 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 - minetest.env:add_node(pos_02, {name="ferns:tree_fern_leaves_02"}) + minetest.set_node(pos_02, {name="ferns:tree_fern_leaves_02"}) end - elseif minetest.env:get_node(pos_04).name ~= "air" + elseif minetest.get_node(pos_04).name ~= "air" or size == 3 then - minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) + minetest.set_node(pos_01, {name="ferns:fern_trunk"}) + minetest.set_node(pos_02, {name="ferns:fern_trunk"}) 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 - minetest.env:add_node(pos_03, {name="ferns:tree_fern_leaves_02"}) + minetest.set_node(pos_03, {name="ferns:tree_fern_leaves_02"}) end - elseif minetest.env:get_node(pos_05).name ~= "air" + elseif minetest.get_node(pos_05).name ~= "air" or size == 4 then - minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_03, {name="ferns:fern_trunk"}) + minetest.set_node(pos_01, {name="ferns:fern_trunk"}) + minetest.set_node(pos_02, {name="ferns:fern_trunk"}) + minetest.set_node(pos_03, {name="ferns:fern_trunk"}) 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 - minetest.env:add_node(pos_04, {name="ferns:tree_fern_leaves_02"}) + minetest.set_node(pos_04, {name="ferns:tree_fern_leaves_02"}) end elseif size == 5 then - minetest.env:add_node(pos_01, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_02, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_03, {name="ferns:fern_trunk"}) - minetest.env:add_node(pos_04, {name="ferns:fern_trunk"}) + minetest.set_node(pos_01, {name="ferns:fern_trunk"}) + minetest.set_node(pos_02, {name="ferns:fern_trunk"}) + minetest.set_node(pos_03, {name="ferns:fern_trunk"}) + minetest.set_node(pos_04, {name="ferns:fern_trunk"}) 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 - 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 diff --git a/flowers_plus/init.lua b/flowers_plus/init.lua index a47e607..de6b3fc 100644 --- a/flowers_plus/init.lua +++ b/flowers_plus/init.lua @@ -99,7 +99,7 @@ for i in ipairs(lilies_list) do local nodename = "default:cobble" -- if this block appears, something went....wrong :-) 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) if waterlily == 1 then nodename = "flowers:waterlily" @@ -118,10 +118,10 @@ for i in ipairs(lilies_list) do elseif waterlily == 8 then nodename = "flowers:waterlily_s4" 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 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 if not plantslib.expect_infinite_stacks then @@ -199,7 +199,7 @@ for i in ipairs(algae_list) do local nodename = "default:cobble" -- :D 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) if seaweed == 1 then nodename = "flowers:seaweed" @@ -210,10 +210,10 @@ for i in ipairs(algae_list) do elseif seaweed == 4 then nodename = "flowers:seaweed_4" 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 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 if not plantslib.expect_infinite_stacks then @@ -307,7 +307,7 @@ flowers_plus.grow_waterlily = function(pos) end 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 @@ -331,7 +331,7 @@ plantslib:register_generate_plant({ flowers_plus.grow_seaweed = function(pos) 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 plantslib:register_generate_plant({ diff --git a/molehills/init.lua b/molehills/init.lua index d901839..28e157a 100644 --- a/molehills/init.lua +++ b/molehills/init.lua @@ -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" then - minetest.add_node(right_here, {name="molehills:molehill"}) + minetest.set_node(right_here, {name="molehills:molehill"}) end end diff --git a/nature_classic/blossom.lua b/nature_classic/blossom.lua index 2f1a490..fb1f3dd 100644 --- a/nature_classic/blossom.lua +++ b/nature_classic/blossom.lua @@ -24,7 +24,7 @@ local function spawn_apple_under(pos) z = pos.z, } if minetest.get_node(below).name == "air" then - minetest.add_node(below, { name = "default:apple" }) + minetest.set_node(below, { name = "default:apple" }) end end diff --git a/nature_classic/global_function.lua b/nature_classic/global_function.lua index 20cd681..659e29d 100644 --- a/nature_classic/global_function.lua +++ b/nature_classic/global_function.lua @@ -28,7 +28,7 @@ function nature:grow_node(pos, nodename) if is_not_young(pos) and light_enough then minetest.remove_node(pos) - minetest.add_node(pos, { name = nodename }) + minetest.set_node(pos, { name = nodename }) set_young_node(pos) minetest.log("info", nodename .. " has grown at " .. pos.x .. "," diff --git a/plants_lib/init.lua b/plants_lib/init.lua index 9c0b0e1..a32e42f 100644 --- a/plants_lib/init.lua +++ b/plants_lib/init.lua @@ -260,7 +260,7 @@ function plantslib:generate_block(minp, maxp, blockseed) spawned = true elseif objtype == "string" and 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 elseif objtype == "function" then 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) if biome.alt_wallnode and walldir 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 else 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) 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 - minetest.add_node(p_top, { name = plant_to_spawn, param2 = fdir }) + minetest.set_node(p_top, { name = plant_to_spawn, param2 = fdir }) end 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 local onside = plantslib:find_open_side(pos) 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 elseif biome.spawn_on_bottom 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 @@ -416,11 +416,11 @@ function plantslib:grow_plants(opts) -- corner case for changing short junglegrass -- to dry shrub in desert 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 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 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) return elseif growtype == "nil" then - minetest.add_node(pos, { name = replacement, param2 = walldir}) + minetest.set_node(pos, { name = replacement, param2 = walldir}) return elseif growtype ~= "nil" and growtype ~= "string" and growtype ~= "table" then 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 elseif objtype == "string" and 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 elseif objtype == "function" then node_or_function_or_model(pos) diff --git a/trunks/generating.lua b/trunks/generating.lua index e46a804..1038423 100644 --- a/trunks/generating.lua +++ b/trunks/generating.lua @@ -37,7 +37,7 @@ abstract_trunks.place_twig = function(pos) local node_n_w = minetest.get_node(north_west) -- small twigs 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 -- big twigs 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 -- 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 @@ -269,70 +269,70 @@ abstract_trunks.place_trunk = function(pos) local trunk_type = math.random(1,3) if trunk_type == 1 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 - minetest.add_node(right_here, {name="default:tree"}) + minetest.set_node(right_here, {name="default:tree"}) end elseif trunk_type == 2 and Horizontal_Trunks == true then if minetest.get_modpath(MoD) ~= nil 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 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 - 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 - minetest.add_node(south, {name=MoD..":"..TRuNK, param2=4}) + minetest.set_node(south, {name=MoD..":"..TRuNK, param2=4}) end 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 else 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 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 - 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 - minetest.add_node(south, {name="default:tree", param2=4}) + minetest.set_node(south, {name="default:tree", param2=4}) end 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 elseif trunk_type == 3 and Horizontal_Trunks == true then if minetest.get_modpath(MoD) ~= nil 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 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 - 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 - minetest.add_node(east, {name=MoD..":"..TRuNK, param2=12}) + minetest.set_node(east, {name=MoD..":"..TRuNK, param2=12}) end 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 else 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 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 - 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 - minetest.add_node(east, {name="default:tree", param2=12}) + minetest.set_node(east, {name="default:tree", param2=12}) end 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 @@ -367,9 +367,9 @@ abstract_trunks.grow_moss_on_ground = function(pos) local moss_type = math.random(1,21) 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 - 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 @@ -418,41 +418,41 @@ abstract_trunks.grow_moss_on_trunk = function(pos) local moss_type = math.random(1,41) if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true, 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 - 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 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 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 - 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 local moss_type = math.random(1,41) if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true, 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 - 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 local moss_type = math.random(1,41) if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true, 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 - 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 local moss_type = math.random(1,41) if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true, 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 - 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 @@ -520,16 +520,16 @@ abstract_trunks.grow_roots = function(pos) and string.find(node_below.name, "dirt") and node_here.param2 == 0 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 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 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 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 diff --git a/trunks/nodes.lua b/trunks/nodes.lua index 734fb63..4f76695 100644 --- a/trunks/nodes.lua +++ b/trunks/nodes.lua @@ -223,7 +223,7 @@ if Auto_Roof_Corner == true then and ((node_north.name == roof and node_north.param2 == 3) or (node_north.name == corner and node_north.param2 == 3)) then - minetest.add_node(pos, {name=corner, param2=0}) + minetest.set_node(pos, {name=corner, param2=0}) end 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) or (node_east.name == corner and node_east.param2 == 0)) then - minetest.add_node(pos, {name=corner, param2=1}) + minetest.set_node(pos, {name=corner, param2=1}) end 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) or (node_south.name == corner and node_south.param2 == 1)) then - minetest.add_node(pos, {name=corner, param2=2}) + minetest.set_node(pos, {name=corner, param2=2}) end 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) or (node_west.name == corner and node_west.param2 == 2)) then - minetest.add_node(pos, {name=corner, param2=3}) + minetest.set_node(pos, {name=corner, param2=3}) end -- corner 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) or (node_north.name == corner_2 and node_north.param2 == 3)) then - minetest.add_node(pos, {name=corner_2, param2=0}) + minetest.set_node(pos, {name=corner_2, param2=0}) end 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) or (node_east.name == corner_2 and node_east.param2 == 0)) then - minetest.add_node(pos, {name=corner_2, param2=1}) + minetest.set_node(pos, {name=corner_2, param2=1}) end 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) or (node_south.name == corner_2 and node_south.param2 == 1)) then - minetest.add_node(pos, {name=corner_2, param2=2}) + minetest.set_node(pos, {name=corner_2, param2=2}) end 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) or (node_west.name == corner_2 and node_west.param2 == 2)) then - minetest.add_node(pos, {name=corner_2, param2=3}) + minetest.set_node(pos, {name=corner_2, param2=3}) end end, diff --git a/woodsoils/generating.lua b/woodsoils/generating.lua index 34b145c..ff84477 100644 --- a/woodsoils/generating.lua +++ b/woodsoils/generating.lua @@ -50,24 +50,24 @@ abstract_woodsoils.place_soil = function(pos) local node_3b = minetest.get_node(radius_3b) -- Dirt with Leaves 1 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 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 -- Grass with Leaves 2 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 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 -- Grass with Leaves 1 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 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 diff --git a/youngtrees/init.lua b/youngtrees/init.lua index 8e9eff0..35999b0 100644 --- a/youngtrees/init.lua +++ b/youngtrees/init.lua @@ -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, or minetest.get_node(right_here).name == "default:junglegrass" then if height == 1 then - minetest.add_node(right_here, {name="youngtrees:youngtree_top"}) + minetest.set_node(right_here, {name="youngtrees:youngtree_top"}) end if height == 2 then - minetest.add_node(right_here, {name="youngtrees:youngtree_bottom"}) - minetest.add_node(above_right_here, {name="youngtrees:youngtree_top"}) + minetest.set_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.set_node(above_right_here, {name="youngtrees:youngtree_top"}) end if height == 3 then 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.add_node(above_right_here, {name="youngtrees:youngtree_middle"}) - minetest.add_node(two_above_right_here, {name="youngtrees:youngtree_top"}) + minetest.set_node(right_here, {name="youngtrees:youngtree_bottom"}) + minetest.set_node(above_right_here, {name="youngtrees:youngtree_middle"}) + minetest.set_node(two_above_right_here, {name="youngtrees:youngtree_top"}) end end end