forked from Not/srb2k-leaderboard
allow non netvar stored, cold record loading from lua
This commit is contained in:
@ -24,3 +24,23 @@ rawset(_G, "lb_ZoneAct", function(map)
|
||||
|
||||
return z
|
||||
end)
|
||||
|
||||
rawset(_G, "lb_stat_t", function(speed, weight)
|
||||
if speed and weight then
|
||||
return (speed << 4) | weight
|
||||
end
|
||||
return 0
|
||||
end)
|
||||
|
||||
|
||||
local F_SPBBIG = 0x4
|
||||
local F_SPBEXP = 0x8
|
||||
-- True if a is better than b
|
||||
rawset(_G, "lb_comp", function(a, b)
|
||||
-- Calculates the difficulty, harder has higher priority
|
||||
-- if s is positive then a is harder
|
||||
-- if s is negative then b is harder
|
||||
-- if s is 0 then compare time
|
||||
local s = (a.flags & (F_SPBEXP | F_SPBBIG)) - (b.flags & (F_SPBEXP | F_SPBBIG))
|
||||
return s > 0 or not(s < 0 or a.time >= b.time)
|
||||
end)
|
||||
|
Reference in New Issue
Block a user