mirror of
https://github.com/HybridDog/nether-pack.git
synced 2025-01-12 19:00:24 +01:00
Use the light update parameter of write_to_map instead of the obsolete update_map (vmanip)
And use minetest.fix_light instead of a custom function (surprisingly it didn't cause a noticeable performance difference) Also, a few code style changes
This commit is contained in:
parent
12dc8ae004
commit
2ce9440fdf
@ -170,28 +170,9 @@ end
|
|||||||
|
|
||||||
local function set_vm_data(manip, nodes, pos, t1, name, generated)
|
local function set_vm_data(manip, nodes, pos, t1, name, generated)
|
||||||
manip:set_data(nodes)
|
manip:set_data(nodes)
|
||||||
manip:write_to_map()
|
manip:write_to_map(not generated)
|
||||||
local spam = 2
|
nether:inform(name.." grew at " .. minetest.pos_to_string(pos),
|
||||||
if generated then
|
generated and 3 or 2, t1)
|
||||||
spam = 3
|
|
||||||
end
|
|
||||||
nether:inform(name.." grew at " .. minetest.pos_to_string(pos), spam, t1)
|
|
||||||
if not generated then
|
|
||||||
local t1 = os.clock()
|
|
||||||
manip:update_map()
|
|
||||||
nether:inform("map updated", spam, t1)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function fix_light(minp, maxp)
|
|
||||||
local manip = minetest.get_voxel_manip()
|
|
||||||
local emerged_pos1, emerged_pos2 = manip:read_from_map(minp, maxp)
|
|
||||||
area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
|
|
||||||
nodes = manip:get_data()
|
|
||||||
|
|
||||||
manip:set_data(nodes)
|
|
||||||
manip:write_to_map()
|
|
||||||
manip:update_map()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Generated variables
|
-- Generated variables
|
||||||
@ -611,13 +592,13 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
-- vm:set_lighting(12)
|
-- vm:set_lighting(12)
|
||||||
-- vm:calc_lighting()
|
-- vm:calc_lighting()
|
||||||
-- vm:update_liquids()
|
-- vm:update_liquids()
|
||||||
vm:write_to_map()
|
vm:write_to_map(false)
|
||||||
|
|
||||||
nether:inform("nodes set", 2, t1)
|
nether:inform("nodes set", 2, t1)
|
||||||
|
|
||||||
local t2 = os.clock()
|
local t2 = os.clock()
|
||||||
|
|
||||||
if structures_enabled then --Trees:
|
if structures_enabled then
|
||||||
for _,v in ipairs(tab) do
|
for _,v in ipairs(tab) do
|
||||||
nether.grow_netherstructure(v, true)
|
nether.grow_netherstructure(v, true)
|
||||||
end
|
end
|
||||||
@ -632,9 +613,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
|||||||
nether:inform("trees set", 2, t2)
|
nether:inform("trees set", 2, t2)
|
||||||
|
|
||||||
t2 = os.clock()
|
t2 = os.clock()
|
||||||
fix_light(minp, maxp)
|
minetest.fix_light(minp, maxp)
|
||||||
|
|
||||||
nether:inform("map updated", 2, t2)
|
nether:inform("light fixed", 2, t2)
|
||||||
|
|
||||||
nether:inform("done", 1, t1)
|
nether:inform("done", 1, t1)
|
||||||
end)
|
end)
|
||||||
@ -904,18 +885,10 @@ function nether.grow_tree(pos, generated)
|
|||||||
|
|
||||||
manip:set_data(nodes)
|
manip:set_data(nodes)
|
||||||
manip:set_param2_data(param2s)
|
manip:set_param2_data(param2s)
|
||||||
manip:write_to_map()
|
manip:write_to_map(not generated)
|
||||||
local spam = 2
|
|
||||||
if generated then
|
|
||||||
spam = 3
|
|
||||||
end
|
|
||||||
nether:inform("a nether tree with " .. trunk_count ..
|
nether:inform("a nether tree with " .. trunk_count ..
|
||||||
" branch trunk nodes grew at " .. minetest.pos_to_string(pos), spam, t1)
|
" branch trunk nodes grew at " .. minetest.pos_to_string(pos),
|
||||||
if not generated then
|
generated and 3 or 2, t1)
|
||||||
local t1 = os.clock()
|
|
||||||
manip:update_map()
|
|
||||||
nether:inform("map updated", spam, t1)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user