Ludicrous Speed: Fix reported PPS being higher than actual PPS

This commit is contained in:
Milla 2022-08-11 20:52:55 -07:00 committed by GitHub
parent 93c221f33b
commit 2ba4a23ebf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,7 +31,7 @@ end
local function mean(t)
local sum = 0
for _, v in ipairs(t) do
for _, v in pairs(t) do
sum = sum + v
end
@ -55,7 +55,7 @@ function LudicrousSpeed:getDropSpeed() return 20 end
function LudicrousSpeed:getPPS()
if #self.delays == 0 then return 0 end
local delays = copy(self.delays)
delays[#delays + 1] = self.frames - self.last_piece
delays[0] = self.frames - self.last_piece
return (mean(delays) / 60) ^ -1
end
@ -132,4 +132,4 @@ function LudicrousSpeed:getHighscoreData()
}
end
return LudicrousSpeed
return LudicrousSpeed