mirror of
https://github.com/mt-mods/biome_lib.git
synced 2024-12-26 02:40:17 +01:00
add "random return" CPU limiter to active queue playback
set `biome_lib_queue_run_ratio = <1 to 100>` to use default 100 (basically, a percentage of max runtime).
This commit is contained in:
parent
e6bfd4c31b
commit
8fd0789ad2
6
API.txt
6
API.txt
@ -481,6 +481,12 @@ Set this to true if you want the mod to spam your console with debug info :-)
|
|||||||
|
|
||||||
plantlife_debug = false
|
plantlife_debug = false
|
||||||
|
|
||||||
|
To slow down the playback of the queue (e.g. for really slow machines where
|
||||||
|
the 0.2 second max limiter isn't enough), set:
|
||||||
|
|
||||||
|
biome_lib_queue_run_ratio = <some value 1 to 100>
|
||||||
|
|
||||||
|
Default is 100 (basically percent of maximum runtime)
|
||||||
|
|
||||||
======================
|
======================
|
||||||
Fertile Ground Mapping
|
Fertile Ground Mapping
|
||||||
|
7
init.lua
7
init.lua
@ -31,6 +31,8 @@ biome_lib.modpath = minetest.get_modpath("biome_lib")
|
|||||||
|
|
||||||
biome_lib.total_no_aircheck_calls = 0
|
biome_lib.total_no_aircheck_calls = 0
|
||||||
|
|
||||||
|
biome_lib.queue_run_ratio = tonumber(minetest.settings:get("biome_lib_queue_run_ratio")) or 100
|
||||||
|
|
||||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||||
local S
|
local S
|
||||||
if minetest.get_modpath("intllib") then
|
if minetest.get_modpath("intllib") then
|
||||||
@ -427,8 +429,9 @@ 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 and -- don't attempt to populate if lag is already too high
|
if dtime < 0.2 -- don't attempt to populate if lag is already too high
|
||||||
(#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) then
|
and math.random(100) <= biome_lib.queue_run_ratio
|
||||||
|
and (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0) then
|
||||||
biome_lib.globalstep_start_time = minetest.get_us_time()
|
biome_lib.globalstep_start_time = minetest.get_us_time()
|
||||||
biome_lib.globalstep_runtime = 0
|
biome_lib.globalstep_runtime = 0
|
||||||
while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0)
|
while (#biome_lib.blocklist_aircheck > 0 or #biome_lib.blocklist_no_aircheck > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user