aboutsummaryrefslogtreecommitdiff
path: root/gamemode/core/npc/sv_common.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2017-05-07 13:47:40 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2017-05-07 13:47:40 -0400
commit9e0537b0aa417e88a6a61238484ddcef74080ae0 (patch)
treee2bd590ec3de41d384aa5f6206b14e1a73647846 /gamemode/core/npc/sv_common.lua
parent191ba416c8b611ea4901cead138789a357c56134 (diff)
downloadartery-9e0537b0aa417e88a6a61238484ddcef74080ae0.tar.gz
artery-9e0537b0aa417e88a6a61238484ddcef74080ae0.tar.bz2
artery-9e0537b0aa417e88a6a61238484ddcef74080ae0.zip
Added tons of stuff
Diffstat (limited to 'gamemode/core/npc/sv_common.lua')
-rw-r--r--gamemode/core/npc/sv_common.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/gamemode/core/npc/sv_common.lua b/gamemode/core/npc/sv_common.lua
new file mode 100644
index 0000000..e37a5f8
--- /dev/null
+++ b/gamemode/core/npc/sv_common.lua
@@ -0,0 +1,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