Move areas:save() into async

On newer Minetest servers, handles saving jobs in async environment. To prevent conflicts, the save file is locked whie saving, and if a code requests saving while the file is locked, data is saved again immediately after finishing the current save.
This commit is contained in:
1F616EMO
2024-10-25 18:25:16 +08:00
committed by SmallJoker
parent ec77a57f42
commit 79e799cfa1
3 changed files with 57 additions and 18 deletions

View File

@ -12,6 +12,10 @@ areas.startTime = os.clock()
areas.modpath = minetest.get_modpath("areas")
dofile(areas.modpath.."/settings.lua")
dofile(areas.modpath.."/api.lua")
local async_dofile = core.register_async_dofile or dofile
async_dofile(areas.modpath.."/async.lua")
dofile(areas.modpath.."/internal.lua")
dofile(areas.modpath.."/chatcommands.lua")
dofile(areas.modpath.."/pos.lua")