From 43b4c6d65ae90f5aaf942dca24074511e6a7bc0c Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 8 Jan 2022 22:22:35 +0100 Subject: [PATCH] Move level victory check to end of level update --- mods/lzr_laser/physics.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/lzr_laser/physics.lua b/mods/lzr_laser/physics.lua index aadd97b..4a81755 100644 --- a/mods/lzr_laser/physics.lua +++ b/mods/lzr_laser/physics.lua @@ -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