Move level victory check to end of level update

master
Wuzzy 2022-01-08 22:22:35 +01:00
parent 28ec2a24be
commit 43b4c6d65a
1 changed files with 5 additions and 4 deletions

View File

@ -108,10 +108,6 @@ function lzr_laser.add_laser(pos, dir, varea, vdata)
if active then
-- Activate node
vdata[vi] = minetest.get_content_id(active)
local done = lzr_laser.check_detectors_in_area(lzr_globals.PLAYFIELD_START, lzr_globals.PLAYFIELD_END)
if done then
lzr_levels.next_level()
end
end
end
-- Laser ends here
@ -234,6 +230,11 @@ function lzr_laser.full_laser_update(pos1, pos2)
vmanip:set_param2_data(vdata_p2)
vmanip:write_to_map()
local done = lzr_laser.check_detectors_in_area(lzr_globals.PLAYFIELD_START, lzr_globals.PLAYFIELD_END)
if done then
lzr_levels.next_level()
end
-- Print benchmark time
local benchmark_time_2 = minetest.get_us_time()
local diff = benchmark_time_2 - benchmark_time_1