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:
parent
b3ffc4b327
commit
f80ea73bfb
3 changed files with 11 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue