blob: b3e7e49eae903ab4cba527cf52ab8e0703bcac16 (
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
|
--[[
Defines some ai primitives for npc's
]]
local log = nrequire("log.lua")
local reg = nrequire("sh_npcsystem.lua")
local npc = {}
npc.Name = "NPC Base"
function npc:Spawn()
local e = ents.Create("art_npc")
if self.Model then self:SetModel(self.Model)
else log.error("NPC created without model, this might be a bug!") end
if self.Pos then self:SetPos(self.Pos)
else log.error("NPC created without a position, this might be a bug!") end
self.talking = false
if self.Name then self:SetName(self.Name)
else log.error("NPC created without a name! They won't be able to open doors!") end
if self.Ang then self:SetAngles(self.Ang) end
if self.OnSpawn then self.OnSpawn(self) end
self.Entity = e
e:Spawn()
end
reg.RegisterNPC(npc)
return npc
|