-
Notifications
You must be signed in to change notification settings - Fork 0
/
particle-trail.lua
49 lines (44 loc) · 1.19 KB
/
particle-trail.lua
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
-- featherlight/particle-trail.lua
-- /lua require('featherlight.particle-trail').start()
local pkg = {}
local module = ...
function pkg.start()
singleton()
local players = Entities.find("@a")
Events.on("PlayerLoggedInEvent"):call(function(event)
table.insert(players,event.player)
end)
Events.on("PlayerLoggedOutEvent"):call(function(event)
for i,p in pairs(players) do
if players[i] == p then
table.remove(players,i)
break
end
end
end)
while true do
for _,p in pairs(players) do
local item = p.mainhand
if item and item.nbt and item.nbt.tag and item.nbt.tag.Wand == "featherlight-flight" then
if p.motion:sqrMagnitude() > 0.1 then
spell.rotationYaw = p.rotationYaw
spell.pos = p.pos - 0.2 * spell.lookVec
spell:move("up",0.2)
pkg.particle()
end
end
end
sleep(1)
if Time.gametime % (20*10) == 0 then
players = Entities.find("@a")
end
end
end
function pkg.particle()
spell:execute("/particle flame ~ ~0.2 ~ 0 0 0 0.01 100 force @a")
end
function singleton()
spell:execute([[/wol spell break byName "%s"]],module)
spell.name = module
end
return pkg