blob: e37a5f8b27150a5b67fc7a31dfcdaedce09a0ae8 (
plain)
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
|
--[[
Some common functions that a lot of npcs use, take out here to make fixing bugs easier.
]]
local com = {}
com.pausefor10sec = function(npc)
npc.StartActionTime = CurTime() + 10
npc:SetSequence(npc:LookupSequence("idle"))
npc.loco:FaceTowards(Vector(-343, 148, 565))
local oyaw,oacc = npc.loco:GetMaxYawRate(), npc.loco:GetAcceleration()
timer.Simple(0,function()
npc.loco:SetMaxYawRate(0)
npc.loco:SetAcceleration(0)
npc.loco:SetVelocity(Vector(0,0,0))
end)
timer.Simple(10, function()
npc.loco:SetMaxYawRate(oyaw)
npc.loco:SetAcceleration(oacc)
end)
end
com.is10secdone = function(npc)
return npc.StartActionTime < CurTime()
end
com.Rumors = {
"This is a rumor!",
"Here is another!",
"And yet another!",
}
com.GetRumor = function()
local rng = math.random(#com.Rumors)
return com.Rumors[rng]
end
return com
|