aboutsummaryrefslogtreecommitdiff
path: root/gamemode/npcsystem/sh_movingnpc.lua
blob: 22ddad1ae4eb11c94115a575e6edcd5cef6c9354 (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
local reg = nrequire("sh_npcsystem.lua")

local base = nrequire("sh_basenpc.lua")
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)
	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)
end

function npc:Face(ang_or_vec)
	print("trying to face:",ang_or_vec,type(ang_or_vec))
end
reg.RegisterNPC(npc)

return npc