diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-12-03 10:41:34 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-03 10:41:34 -0500 |
commit | f80ea73bfb668b1999bcc134aaa7fc126724e6d6 (patch) | |
tree | 956a750a4bf25285805fe9a8dcf19526e644f96c /builtin/game/forceloading.lua | |
parent | b3ffc4b327622bec63793476191b95bc174bf33c (diff) | |
download | minetest-f80ea73bfb668b1999bcc134aaa7fc126724e6d6.tar.xz |
Let mods choose a forceload limit (#13002)
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 |