mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-06-28 06:11:53 +02:00
use set_node(), not add_node()
don't use minetest.env:* method (deprecated), use minetest.* instead
This commit is contained in:
@ -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...")
|
||||
-----------------------------------------------------------------------------------------------
|
||||
-----------------------------------------------------------------------------------------------
|
||||
|
@ -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()
|
||||
|
@ -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({
|
||||
|
@ -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
|
||||
|
||||
|
@ -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(),
|
||||
})
|
||||
})
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user