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
-- t = the elapsed time
-- b = begin
-- c = change (ending-beginning)
-- d = duration
local function inquad(t, b, c, d)
t = t / d
return c * (t*t) + b
end
local floor = math.floor
local parameter = 'lua "_pull%(%d,%d,%d,%d,%d,%d,%s%)'
local setpos = 'setpos %d %d %d'
local time = {} -- to determine of the elapsed time
function _pull(i, sx, sy, ex, ey, d, f)
time[i] = time[i] + 1
local x = inquad(time[i], sx, ex-sx, d)
local y = inquad(time[i], sy, ey-sy, d)
if not tile(floor(x/32), floor(y/32), 'walkable') or force then
parse(setpos:format(i, x, y))
end
end
-- id = player ID
-- x, y = to what position does it pull
-- duration = the duration of the pull (in seconds)
-- force = penetrate through walls?
function pull(id, x, y, duration, force)
if not time[id] or time[id] > 0 then
time[id] = 0
end
local param = parameter:format(id,
-- i assume that player coordinates are not
-- integers
floor(player(id, 'x')),
floor(player(id, 'y')),
x, y,
duration,
force)
timer(1000, 'parse', param, duration)
end
I'm following