mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-06-07 06:06:10 -04:00
Replace minetest.env: with minetest.
This commit is contained in:
parent
dfad095884
commit
31a74ede18
13 changed files with 169 additions and 169 deletions
|
@ -127,40 +127,40 @@ minetest.register_abm({
|
|||
chance = 25,
|
||||
action = function(pos, node)
|
||||
pos.y = pos.y - 1
|
||||
local under = minetest.env:get_node(pos)
|
||||
local under = minetest.get_node(pos)
|
||||
pos.y = pos.y + 1
|
||||
if under.name == "default:desert_sand" then
|
||||
minetest.env:set_node(pos, {name="default:dry_shrub"})
|
||||
minetest.set_node(pos, {name="default:dry_shrub"})
|
||||
elseif under.name ~= "default:dirt_with_grass" then
|
||||
return
|
||||
end
|
||||
|
||||
local light = minetest.env:get_node_light(pos)
|
||||
local light = minetest.get_node_light(pos)
|
||||
if not light or light < 13 then
|
||||
return
|
||||
end
|
||||
|
||||
local pos0 = {x=pos.x-4,y=pos.y-4,z=pos.z-4}
|
||||
local pos1 = {x=pos.x+4,y=pos.y+4,z=pos.z+4}
|
||||
if #minetest.env:find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
|
||||
if #minetest.find_nodes_in_area(pos0, pos1, "group:flora_block") > 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local flowers = minetest.env:find_nodes_in_area(pos0, pos1, "group:flora")
|
||||
local flowers = minetest.find_nodes_in_area(pos0, pos1, "group:flora")
|
||||
if #flowers > 3 then
|
||||
return
|
||||
end
|
||||
|
||||
local seedling = minetest.env:find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
|
||||
local seedling = minetest.find_nodes_in_area(pos0, pos1, "default:dirt_with_grass")
|
||||
if #seedling > 0 then
|
||||
seedling = seedling[math.random(#seedling)]
|
||||
seedling.y = seedling.y + 1
|
||||
light = minetest.env:get_node_light(seedling)
|
||||
light = minetest.get_node_light(seedling)
|
||||
if not light or light < 13 then
|
||||
return
|
||||
end
|
||||
if minetest.env:get_node(seedling).name == "air" then
|
||||
minetest.env:set_node(seedling, {name=node.name})
|
||||
if minetest.get_node(seedling).name == "air" then
|
||||
minetest.set_node(seedling, {name=node.name})
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
minetest.register_on_generated(function(minp, maxp, seed)
|
||||
if maxp.y >= 2 and minp.y <= 0 then
|
||||
-- Generate flowers
|
||||
local perlin1 = minetest.env:get_perlin(436, 3, 0.6, 100)
|
||||
local perlin1 = minetest.get_perlin(436, 3, 0.6, 100)
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 16
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
|
@ -21,7 +21,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
-- Find ground level (0...15)
|
||||
local ground_y = nil
|
||||
for y=30,0,-1 do
|
||||
if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||
if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then
|
||||
ground_y = y
|
||||
break
|
||||
end
|
||||
|
@ -29,11 +29,11 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
|
||||
if ground_y then
|
||||
local p = {x=x,y=ground_y+1,z=z}
|
||||
local nn = minetest.env:get_node(p).name
|
||||
local nn = minetest.get_node(p).name
|
||||
-- Check if the node can be replaced
|
||||
if minetest.registered_nodes[nn] and
|
||||
minetest.registered_nodes[nn].buildable_to then
|
||||
nn = minetest.env:get_node({x=x,y=ground_y,z=z}).name
|
||||
nn = minetest.get_node({x=x,y=ground_y,z=z}).name
|
||||
if nn == "default:dirt_with_grass" then
|
||||
local flower_choice = pr:next(1, 6)
|
||||
local flower
|
||||
|
@ -50,7 +50,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||
elseif flower_choice == 6 then
|
||||
flower = "flowers:viola"
|
||||
end
|
||||
minetest.env:set_node(p, {name=flower})
|
||||
minetest.set_node(p, {name=flower})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue