mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-11-17 23:58:27 +01:00
Duplicate unhash_blockpos code to legacy.lua
Duplicating that small piece of code seems like a better idea than putting the undo-forceloading code back into util.lua. This way, it is easier to remember to remove that unneccesary code after a couple of months / years, when people have transitioned. This also means we can make changes to the code in util.lua without breaking old code.
This commit is contained in:
parent
dfeb070a20
commit
54efc64558
@ -1,5 +1,12 @@
|
|||||||
-- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
|
-- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
|
||||||
-- used forceloading instead of VoxelManipulators.
|
-- used forceloading instead of VoxelManipulators.
|
||||||
|
local BLOCKSIZE = 16
|
||||||
|
|
||||||
|
-- convert block hash --> node position
|
||||||
|
local function unhash_blockpos(hash)
|
||||||
|
return vector.multiply(minetest.get_position_from_hash(hash), BLOCKSIZE)
|
||||||
|
end
|
||||||
|
|
||||||
local old_forceloaded_blocks = mesecon.file2table("mesecon_forceloaded")
|
local old_forceloaded_blocks = mesecon.file2table("mesecon_forceloaded")
|
||||||
for hash, _ in pairs(old_forceloaded_blocks) do
|
for hash, _ in pairs(old_forceloaded_blocks) do
|
||||||
minetest.forceload_free_block(unhash_blockpos(hash))
|
minetest.forceload_free_block(unhash_blockpos(hash))
|
||||||
|
Loading…
Reference in New Issue
Block a user