-
Notifications
You must be signed in to change notification settings - Fork 11
/
simplemults.xml
54 lines (42 loc) · 1.65 KB
/
simplemults.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<SimpleMults Version = "4.20.69" Author = "sorae" LoadCommand = "%xero(function(self)
-- syntax: notemult {beat, len, multiplier, plr = pn or nil}
local allmults = {}
-- very stolen from oatmealine
local function throw(msg)
local _, err = pcall(error, msg, 4)
SCREENMAN:SystemMessage(err)
end
-- partially stolen from sudospective (error messages stolen from oatmealine)
function notemult(t)
-- get players
local pn = t.plr or get_plr()
if type(pn) == 'number' then pn = {pn} end
-- error messages, you should probably never see these
if type(t[1]) ~= 'number' then throw('invalid SimpleMults beat: expected number, got ' .. type(t[1])); return notemult end
if type(t[2]) ~= 'number' then throw('invalid SimpleMults duration: expected number, got ' .. type(t[2])); return notemult end
if type(t[3]) ~= 'number' then throw('invalid SimpleMults multiplier: expected number, got ' .. type(t[3])); return notemult end
-- insert notemults into the big table to all get set at once
table.insert(allmults, {t[1], t[3], pn})
table.insert(allmults, {t[1] + t[2], 1, pn})
return notemult
end
-- stolen from oatmealine and then retooled
-- set every notemult at once at beat 0
func{0, function()
local res = {}
-- create a table for each player
for pn = 1, max_pn do
res[pn] = {}
end
-- add stuff from the big notemults table into each player specific table
for _, r in ipairs(allmults) do
for _, pl in ipairs(r[3]) do
table.insert(res[pl], {r[1], r[2]})
end
end
-- actually set the notemults lol
for i, pl in ipairs(res) do
P[i]:SetNoteTypeMults(res[i])
end
end}
end)" />