early exit from the 0.2s loop if there's nothing to do

This commit is contained in:
Vanessa Ezekowitz 2015-02-28 12:23:50 -05:00
parent 3de5c62d87
commit f0e3c1052a

View File

@ -429,7 +429,8 @@ minetest.register_globalstep(function(dtime)
(#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) then
plantslib.globalstep_start_time = minetest.get_us_time()
plantslib.globalstep_runtime = 0
while plantslib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS.
while (#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0)
and plantslib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS.
if #plantslib.blocklist_aircheck > 0 then
plantslib:generate_block_with_air_checking()
end