legacy.lua 558 B

123456789101112131415
  1. -- Un-forceload any forceloaded mapblocks from older versions of Mesecons which
  2. -- used forceloading instead of VoxelManipulators.
  3. local BLOCKSIZE = 16
  4. -- convert block hash --> node position
  5. local function unhash_blockpos(hash)
  6. return vector.multiply(minetest.get_position_from_hash(hash), BLOCKSIZE)
  7. end
  8. local old_forceloaded_blocks = mesecon.file2table("mesecon_forceloaded")
  9. for hash, _ in pairs(old_forceloaded_blocks) do
  10. minetest.forceload_free_block(unhash_blockpos(hash))
  11. end
  12. os.remove(minetest.get_worldpath()..DIR_DELIM.."mesecon_forceloaded")