allow non netvar stored, cold record loading from lua

This commit is contained in:
Not
2022-10-07 01:35:24 +02:00
parent 1d4eb423d6
commit 3a61ffcabd
4 changed files with 319 additions and 237 deletions

View File

@ -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)