diff options
Diffstat (limited to 'builtin/game/forceloading.lua')
-rw-r--r-- | builtin/game/forceloading.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/game/forceloading.lua b/builtin/game/forceloading.lua index 8043e5dea..52049af16 100644 --- a/builtin/game/forceloading.lua +++ b/builtin/game/forceloading.lua @@ -33,7 +33,7 @@ local function get_relevant_tables(transient) end end -function core.forceload_block(pos, transient) +function core.forceload_block(pos, transient, limit) -- set changed flag forceload_blocks_changed = true @@ -46,7 +46,8 @@ function core.forceload_block(pos, transient) elseif other_table[hash] ~= nil then relevant_table[hash] = 1 else - if total_forceloaded >= (tonumber(core.settings:get("max_forceloaded_blocks")) or 16) then + limit = limit or tonumber(core.settings:get("max_forceloaded_blocks")) or 16 + if limit >= 0 and total_forceloaded >= limit then return false end total_forceloaded = total_forceloaded+1 |