Remove horrible legacy minetest.env

This commit is contained in:
Wuzzy 2016-11-14 01:26:10 +01:00
parent 8d6f957fb0
commit 102aa3de13

View File

@ -28,11 +28,11 @@ minetest.register_entity("pedology:drop_water", {
self.object:setacceleration({x=0, y=-5, z=0})
end
if minetest.env:get_node({x=ownpos.x, y=ownpos.y +0.5, z=ownpos.z}).name == "air" then
if minetest.get_node({x=ownpos.x, y=ownpos.y +0.5, z=ownpos.z}).name == "air" then
self.object:setacceleration({x=0, y=-5, z=0})
end
if minetest.env:get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
if minetest.get_node({x=ownpos.x, y=ownpos.y -0.5, z=ownpos.z}).name ~= "air" then
self.object:remove()
minetest.sound_play({name="pedology_drip"}, {pos = ownpos, gain = 0.5, max_hear_distance = 8})
end
@ -40,10 +40,10 @@ minetest.register_entity("pedology:drop_water", {
})
function pedology.create_drip(pos)
if minetest.env:get_node({x=pos.x, y=pos.y -1, z=pos.z}).name == "air" and
minetest.env:get_node({x=pos.x, y=pos.y -2, z=pos.z}).name == "air" then
if minetest.get_node({x=pos.x, y=pos.y -1, z=pos.z}).name == "air" and
minetest.get_node({x=pos.x, y=pos.y -2, z=pos.z}).name == "air" then
local i = math.random(-45,45) / 100
minetest.env:add_entity({x=pos.x + i, y=pos.y - 0.5, z=pos.z + i}, "pedology:drop_water")
minetest.add_entity({x=pos.x + i, y=pos.y - 0.5, z=pos.z + i}, "pedology:drop_water")
end
end