aboutsummaryrefslogtreecommitdiff
path: root/gamemode/npcsystem/sh_movingnpc.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2019-05-04 16:05:01 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2019-05-04 16:05:01 -0400
commit100342bdd0a979f283f90875663784f20282dd5e (patch)
tree8188ab5f9dd979d552df3d41fb31b1166b01d150 /gamemode/npcsystem/sh_movingnpc.lua
parentfaa8312074e6ea8a96efd70d6188ef592f81e579 (diff)
downloadartery-100342bdd0a979f283f90875663784f20282dd5e.tar.gz
artery-100342bdd0a979f283f90875663784f20282dd5e.tar.bz2
artery-100342bdd0a979f283f90875663784f20282dd5e.zip
Started on the NPC overhual
Added some bits to start on the npcs overhaul
Diffstat (limited to 'gamemode/npcsystem/sh_movingnpc.lua')
-rw-r--r--gamemode/npcsystem/sh_movingnpc.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/gamemode/npcsystem/sh_movingnpc.lua b/gamemode/npcsystem/sh_movingnpc.lua
index 21f302e..22ddad1 100644
--- a/gamemode/npcsystem/sh_movingnpc.lua
+++ b/gamemode/npcsystem/sh_movingnpc.lua
@@ -1,16 +1,19 @@
local reg = nrequire("sh_npcsystem.lua")
local base = nrequire("sh_basenpc.lua")
-local nextbot = scripted_ents.Get("base_nextbot")
+local nextbot = nil --Nextbots aren't registered until after this script is run,
+--So we need the hacks below to get a "real" nextbot.
local npc = {}
npc.Name = "Walkable NPC Base"
setmetatable(npc,{__index = function(self,key)
- return self[key] or base[key] or nextbot[key]
+ if nextbot == nil then nextbot = scripted_ents.Get("base_nextbot") end
+ return base[key] or nextbot[key]
end})
function npc:Initalize()
+ if nextbot == nil then nextbot = scripted_ents.Get("base_nextbot") end
if base.Initalize then base.Initalize(self) end
if nextbot.Initalize then nextbot.Initalize(self) end
print("After initalizeing walkable, self.loco is", self.loco)
@@ -20,3 +23,5 @@ function npc:Face(ang_or_vec)
print("trying to face:",ang_or_vec,type(ang_or_vec))
end
reg.RegisterNPC(npc)
+
+return npc