forked from mtcontrib/plantlife_modpack
		
	fix brain-o in new dtime algorithm
don't actually run the checking loop if there's nothing to do! otherwise it spins the CPU at 100% for no reason
This commit is contained in:
		@@ -425,7 +425,8 @@ end)
 | 
				
			|||||||
-- "Play" them back, populating them with new stuff in the process
 | 
					-- "Play" them back, populating them with new stuff in the process
 | 
				
			||||||
 | 
					
 | 
				
			||||||
minetest.register_globalstep(function(dtime)
 | 
					minetest.register_globalstep(function(dtime)
 | 
				
			||||||
	if dtime < 0.2 then  -- don't attempt to populate if lag is already too high
 | 
						if dtime < 0.2 and    -- don't attempt to populate if lag is already too high
 | 
				
			||||||
 | 
						  (#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) then
 | 
				
			||||||
		plantslib.globalstep_start_time = minetest.get_us_time()
 | 
							plantslib.globalstep_start_time = minetest.get_us_time()
 | 
				
			||||||
		plantslib.globalstep_runtime = 0
 | 
							plantslib.globalstep_runtime = 0
 | 
				
			||||||
		while plantslib.globalstep_runtime < 200000 do  -- 0.2 seconds, in uS.
 | 
							while plantslib.globalstep_runtime < 200000 do  -- 0.2 seconds, in uS.
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user