forked from Mirrorlandia_minetest/minetest
Let mods choose a forceload limit (#13002)
This commit is contained in:
parent
b3ffc4b327
commit
f80ea73bfb
@ -33,7 +33,7 @@ local function get_relevant_tables(transient)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function core.forceload_block(pos, transient)
|
function core.forceload_block(pos, transient, limit)
|
||||||
-- set changed flag
|
-- set changed flag
|
||||||
forceload_blocks_changed = true
|
forceload_blocks_changed = true
|
||||||
|
|
||||||
@ -46,7 +46,8 @@ function core.forceload_block(pos, transient)
|
|||||||
elseif other_table[hash] ~= nil then
|
elseif other_table[hash] ~= nil then
|
||||||
relevant_table[hash] = 1
|
relevant_table[hash] = 1
|
||||||
else
|
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
|
return false
|
||||||
end
|
end
|
||||||
total_forceloaded = total_forceloaded+1
|
total_forceloaded = total_forceloaded+1
|
||||||
|
@ -1875,8 +1875,9 @@ active_block_range (Active block range) int 4 1 65535
|
|||||||
# From how far blocks are sent to clients, stated in mapblocks (16 nodes).
|
# From how far blocks are sent to clients, stated in mapblocks (16 nodes).
|
||||||
max_block_send_distance (Max block send distance) int 12 1 65535
|
max_block_send_distance (Max block send distance) int 12 1 65535
|
||||||
|
|
||||||
# Maximum number of forceloaded mapblocks.
|
# Default maximum number of forceloaded mapblocks.
|
||||||
max_forceloaded_blocks (Maximum forceloaded blocks) int 16 0
|
# Set this to -1 to disable the limit.
|
||||||
|
max_forceloaded_blocks (Maximum forceloaded blocks) int 16 -1
|
||||||
|
|
||||||
# Interval of sending time of day to clients, stated in seconds.
|
# Interval of sending time of day to clients, stated in seconds.
|
||||||
time_send_interval (Time send interval) float 5.0 0.001
|
time_send_interval (Time send interval) float 5.0 0.001
|
||||||
|
@ -6532,12 +6532,16 @@ Misc.
|
|||||||
* You may want to cache and call the old function to allow multiple mods to
|
* You may want to cache and call the old function to allow multiple mods to
|
||||||
change knockback behavior.
|
change knockback behavior.
|
||||||
|
|
||||||
* `minetest.forceload_block(pos[, transient])`
|
* `minetest.forceload_block(pos[, transient[, limit]])`
|
||||||
* forceloads the position `pos`.
|
* forceloads the position `pos`.
|
||||||
* returns `true` if area could be forceloaded
|
* returns `true` if area could be forceloaded
|
||||||
* If `transient` is `false` or absent, the forceload will be persistent
|
* If `transient` is `false` or absent, the forceload will be persistent
|
||||||
(saved between server runs). If `true`, the forceload will be transient
|
(saved between server runs). If `true`, the forceload will be transient
|
||||||
(not saved between server runs).
|
(not saved between server runs).
|
||||||
|
* `limit` is an optional limit on the number of blocks that can be
|
||||||
|
forceloaded at once. If `limit` is negative, there is no limit. If it is
|
||||||
|
absent, the limit is the value of the setting `"max_forceloaded_blocks"`.
|
||||||
|
If the call would put the number of blocks over the limit, the call fails.
|
||||||
|
|
||||||
* `minetest.forceload_free_block(pos[, transient])`
|
* `minetest.forceload_free_block(pos[, transient])`
|
||||||
* stops forceloading the position `pos`
|
* stops forceloading the position `pos`
|
||||||
|
Loading…
Reference in New Issue
Block a user