remove movecount, write LiveStore on servers only

This commit is contained in:
Not 2022-11-25 02:48:29 +01:00
parent d4bbf62945
commit 3c5234f7b2
1 changed files with 4 additions and 9 deletions

View File

@ -275,8 +275,6 @@ local function moveRecords(from, to, modeSep)
return 0
end
local moveCount = #store[from.id][from.checksum]
store[to.id] = $ or {}
store[to.id][to.checksum] = $ or {}
for i, score in ipairs(store[from.id][from.checksum]) do
@ -287,24 +285,21 @@ local function moveRecords(from, to, modeSep)
-- Destroy the original table
store[from.id][from.checksum] = nil
return moveCount
end
-- move livestore records and write to disk
local moveCount = moveRecordsInStore(LiveStore)
dumpStoreToFile(LEADERBOARD_FILE, LiveStore)
moveRecordsInStore(LiveStore)
-- move coldstore records
if isserver then
dumpStoreToFile(LEADERBOARD_FILE, LiveStore)
-- move coldstore records
local ok, coldstore = pcall(loadStoreFile, COLDSTORE_FILE)
if ok and coldstore then
moveRecordsInStore(coldstore)
dumpStoreToFile(COLDSTORE_FILE, coldstore)
end
end
return moveCount
end
rawset(_G, "lb_move_records", moveRecords)