cleanup water code

This commit is contained in:
Alexander Weber 2018-01-11 21:57:02 +01:00
parent b6350830f5
commit bceb1dac55

View File

@ -1,13 +1,11 @@
water = {}
water.node = minetest.settings:get("water_node") or "default:water_source"
print("---------------------", water.node)
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode"})
end)
-- [[
minetest.register_on_generated(function(minp, maxp, seed)
-- local t1 = os.clock()
if minp.y > 1 or not water.node or water.node == "air" then
return
end
@ -25,26 +23,18 @@ minetest.register_on_generated(function(minp, maxp, seed)
local ni = 1
for z = minp.z, maxp.z do
for y = minp.y, maxp.y do
for x = minp.x, maxp.x do
if y < 1 then
local vi = a:index(x, y, z)
data[vi] = c_water
for y = minp.y, maxp.y do
for x = minp.x, maxp.x do
if y < 1 then
local vi = a:index(x, y, z)
data[vi] = c_water
end
ni = ni + 1
end
end
ni = ni + 1
end
end
end
vm:set_data(data)
vm:calc_lighting(
{x=minp.x-16, y=minp.y, z=minp.z-16},
{x=maxp.x+16, y=maxp.y, z=maxp.z+16}
)
vm:write_to_map(data)
-- print(string.format("[unternull] building water: elapsed time: %.2fms", (os.clock() - t1) * 1000))
end)
--]]