-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLizardDancers.txt
87 lines (83 loc) · 2.79 KB
/
LizardDancers.txt
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
--@name LizardDancers
--@author Sparky
--@shared
local radius = 150
local spacing = 80 --How far apart they need to be
local lizards = 20
local speed = 0.9
--local music = "https://dl.dropboxusercontent.com/s/4f5rb3j3jl1o39s/A%20Hat%20in%20Time%20B-Side%20-%20101%20Collapsing%20Rift.mp3"
local music = "https://dl.dropboxusercontent.com/s/rsuv93lbeswu339/A%20Hat%20in%20Time%20OST%20-%2025%20Picture%20Perfect.mp3"
local animation = "taunt_dance"
local models = {
"models/aeonpm/aeon.mdl",
"models/mailer/characters/wow_arakkoa2.mdl",
"models/player/mikier/renamon.mdl",
"models/player/pokemon/blazikenpm.mdl",
"models/highdragon_player/hidrgpl.mdl",
--"models/player/stenli/lycan_werewolf.mdl",
"models/player/shi/awoo.mdl",
}
if SERVER then
local function randPos(postbl, size)
local poses = {}
local best, besti = 0, 1
for i=1, 50 do
local t = math.random()*math.pi*2
local r = math.sqrt(math.random())*size
local pos = Vector(math.cos(t)*r, math.sin(t)*r, 0)
local safe = true
local closest = math.huge
for k, v in ipairs(postbl) do
local d = v:getDistanceSqr(pos)
if d<spacing^2 then
safe = false
end
if d<closest then
closest = d
end
end
if safe then return pos end
if closest>best then
best = closest
besti = i
end
poses[i] = pos
end
return poses[besti]
end
--Create dancing holograms
local chipPos = chip():getPos()
local holos, postbl = {}, {Vector()}
for i=1, lizards do
local pos = randPos(postbl, radius)
local model = models[math.random(#models)]
local holo = holograms.create(chipPos+pos, Angle(0,math.random()*360,0), model)
for o=1, 7 do holo:setBodygroup(o, 1) end
holo:setAnimation(animation, 0.05, speed)
holos[i] = holo
postbl[#postbl+1] = pos
end
local animLen = holos[1]:getAnimationLength()*0.90/speed
function loopBack()
for k, v in ipairs(holos) do v:setAnimation(animation, 0.95, -speed) end
timer.simple(animLen, loopForward)
end
function loopForward()
for k, v in ipairs(holos) do v:setAnimation(animation, 0.05, speed) end
timer.simple(animLen, loopBack)
end
timer.simple(animLen, loopBack)
else
bass.loadURL(music,"3d noblock",function(snd, err, errtxt)
if snd then
snd:setFade(500,10000)
snd:setLooping(true)
--snd:setVolume(1)
hook.add("think","snd",function()
snd:setPos(chip():getPos())
end)
else
print(errtxt)
end
end)
end