1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Let mods choose a forceload limit (#13002)

This commit is contained in:
Jude Melton-Houghton 2022-12-03 10:41:34 -05:00 committed by GitHub
parent b3ffc4b327
commit f80ea73bfb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 5 deletions

View file

@ -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