mirror of
https://github.com/rubenwardy/forceload.git
synced 2024-11-22 15:03:42 +01:00
Fix bug
This commit is contained in:
parent
728742a969
commit
25a405df34
11
init.lua
11
init.lua
@ -39,21 +39,13 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
unload = function(self, pos)
|
unload = function(self, pos)
|
||||||
for i = 1, #self._blocks do
|
for i = 1, #self._blocks do
|
||||||
if vector.equals(pos, self._blocks[i]) then
|
if vector.equals(pos, self._blocks[i]) then
|
||||||
minetest.forceload_block(pos)
|
minetest.forceload_free_block(pos)
|
||||||
table.remove(self._blocks, i)
|
table.remove(self._blocks, i)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
iter = function(self, func)
|
|
||||||
for i = 1, #self._blocks do
|
|
||||||
if func(i, self._blocks[i]) == true then
|
|
||||||
table.remove(self._blocks, i)
|
|
||||||
i = i - 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
save = function(self, filename)
|
save = function(self, filename)
|
||||||
local file = io.open(filename, "w")
|
local file = io.open(filename, "w")
|
||||||
if file then
|
if file then
|
||||||
@ -104,6 +96,7 @@ function ForceloadManager(filetoopen, hide_file_errors)
|
|||||||
local i = 1
|
local i = 1
|
||||||
while i <= #self._blocks do
|
while i <= #self._blocks do
|
||||||
if self._blocks[i].remove then
|
if self._blocks[i].remove then
|
||||||
|
minetest.forceload_free_block(self._blocks[i])
|
||||||
table.remove(self._blocks, i)
|
table.remove(self._blocks, i)
|
||||||
else
|
else
|
||||||
i = i + 1
|
i = i + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user