summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <norrepli@gmail.com>2016-08-31 08:46:11 +0200
committerJeija <norrepli@gmail.com>2016-08-31 08:46:11 +0200
commit54efc64558ec21847c0b8d668bd206e88403a410 (patch)
treef87970cd0966a9be02f96d68662542cbfb3af18a
parentdfeb070a2066e9a0c7e41c6c509ec7c2b3d95f8b (diff)
downloadmesecons-54efc64558ec21847c0b8d668bd206e88403a410.tar
mesecons-54efc64558ec21847c0b8d668bd206e88403a410.tar.gz
mesecons-54efc64558ec21847c0b8d668bd206e88403a410.tar.bz2
mesecons-54efc64558ec21847c0b8d668bd206e88403a410.tar.xz
mesecons-54efc64558ec21847c0b8d668bd206e88403a410.zip
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.
-rw-r--r--mesecons/legacy.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/mesecons/legacy.lua b/mesecons/legacy.lua
index aba2e9b..ad7093a 100644
--- a/mesecons/legacy.lua
+++ b/mesecons/legacy.lua
@@ -1,5 +1,12 @@
-- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
-- 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")
for hash, _ in pairs(old_forceloaded_blocks) do
minetest.forceload_free_block(unhash_blockpos(hash))