forked from minetest-mods/areas
		
	Limit recalculations.
Setting based - limit area recalculation and allow tuning of the interval.
This commit is contained in:
		
							
								
								
									
										9
									
								
								hud.lua
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								hud.lua
									
									
									
									
									
								
							| @@ -1,8 +1,17 @@ | ||||
| -- This is inspired by the landrush mod by Bremaweb | ||||
|  | ||||
| areas.hud = {} | ||||
| areas.hud.refresh = 0 | ||||
|  | ||||
| minetest.register_globalstep(function(dtime) | ||||
|  | ||||
| 	areas.hud.refresh = areas.hud.refresh + dtime | ||||
| 	if areas.hud.refresh > areas.config["tick"] then | ||||
| 		areas.hud.refresh = 0 | ||||
| 	else | ||||
| 		return | ||||
| 	end | ||||
|  | ||||
| 	for _, player in pairs(minetest.get_connected_players()) do | ||||
| 		local name = player:get_player_name() | ||||
| 		local pos = vector.round(player:getpos()) | ||||
|   | ||||
| @@ -40,3 +40,6 @@ setting("number",   "self_protection_max_areas_high", 32) | ||||
|  | ||||
| -- legacy_table (owner_defs) compatibility.  Untested and has known issues. | ||||
| setting("boolean", "legacy_table", false) | ||||
|  | ||||
| -- configure the refresh delay for the name displays in the HUD | ||||
| setting("number", "tick", 0.5) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user