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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
if engine.ActiveGamemode() ~= "sandbox" then return end
AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside
AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent.
include('shared.lua')
ENT.default_data = {
Model = "models/humans/Group02/Male_03.mdl",
NavNodes = {},
Pos = nil
}
ENT.edit_data = {
Size = HULL_TINY,
Type = "navnode",
Model = "models/editor/ground_node.mdl",
get_default_code = function(who)
local default_navnode = [[
local node = {
["Name"] = "%s", --@tagname
["Position"] = Vector(%f, %f, %f), --@tagpos
["OnReached"] = function(npc)
end,
["IsDone"] = function(npc)
end,
}
nrequire("sv_npcsystem.lua").CreateNavNode(node)
]]
local pos = who:GetPos()
local name = "Default Node"
return string.format(default_navnode,name,pos.x,pos.y,pos.z)
end
}
local init = ENT.Initalize
function ENT:Initalize()
print("In towniespawn's initalize")
init(self)
end
function ENT:OnSave()
print("Node's OnSave was called")
local newtxt = file.Read(self.File,"DATA")
print("new text was",newtxt)
local newname = newtxt:match("%[\"Name\"%] = \"(.-)\", %-%-@tagname")
print("new name is,",newname)
self.Name = newname
end
|