mirror of
https://github.com/rubenwardy/forceload.git
synced 2024-11-25 16:23:48 +01:00
Don't redefine API functions
This commit is contained in:
parent
32d2e03828
commit
9d2dfad1a1
13
init.lua
13
init.lua
@ -1,9 +1,8 @@
|
|||||||
local _pts = minetest.pos_to_string
|
local function pos_to_string_no_err(pos)
|
||||||
function minetest.pos_to_string(pos)
|
|
||||||
if not pos then
|
if not pos then
|
||||||
return "(-,-,-)"
|
return "(-,-,-)"
|
||||||
end
|
end
|
||||||
return _pts(pos)
|
return minetest.pos_to_string(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Makes sure that force load areas are handled correctly
|
-- Makes sure that force load areas are handled correctly
|
||||||
@ -23,7 +22,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
end
|
end
|
||||||
for i = 1, #blocks do
|
for i = 1, #blocks do
|
||||||
if not minetest.forceload_block(blocks[i]) then
|
if not minetest.forceload_block(blocks[i]) then
|
||||||
minetest.log("error", "Failed to load block " .. minetest.pos_to_string(blocks[i]))
|
minetest.log("error", "Failed to load block " .. pos_to_string_no_err(blocks[i]))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
@ -33,7 +32,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
table.insert(self._blocks, vector.new(pos))
|
table.insert(self._blocks, vector.new(pos))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
minetest.log("error", "Failed to load block " .. minetest.pos_to_string(pos))
|
minetest.log("error", "Failed to load block " .. pos_to_string_no_err(pos))
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
unload = function(self, pos)
|
unload = function(self, pos)
|
||||||
@ -64,7 +63,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
if not pos.last or elapsed_time > pos.last + 15 then
|
if not pos.last or elapsed_time > pos.last + 15 then
|
||||||
pos.last = elapsed_time
|
pos.last = elapsed_time
|
||||||
if not minetest.forceload_block(pos) then
|
if not minetest.forceload_block(pos) then
|
||||||
minetest.log("error", "Failed to force load " .. minetest.pos_to_string(pos))
|
minetest.log("error", "Failed to force load " .. pos_to_string_no_err(pos))
|
||||||
pos.remove = true
|
pos.remove = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -73,7 +72,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
pos.last = elapsed_time
|
pos.last = elapsed_time
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
minetest.log("error", minetest.pos_to_string(pos) .. " shouldn't be loaded")
|
minetest.log("error", pos_to_string_no_err(pos) .. " shouldn't be loaded")
|
||||||
pos.remove = true
|
pos.remove = true
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user