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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
-- --Loads map config form a file
-- do return end
-- function ART.CreateTownie(tbl)
-- local npcent = ents.Create("npc_townie")
-- for k,v in pairs(tbl) do
-- npcent[k] = v
-- end
-- npcent:Spawn()
-- end
--
-- function ART.CreateNavNode(tbl)
-- local nodeent = ents.Create("info_townienode")
-- assert(tbl ~= nil, "Tried to create a nil navnode")
-- for k,v in pairs(tbl) do
-- nodeent[k] = v
-- end
-- nodeent:Spawn()
-- end
--
-- local removeents = {
-- "npc_townie",
-- -- "art_chest",
-- "info_townienode",
-- "npc_shop",
-- }
--
-- for k,v in pairs(removeents) do
-- local eot = ents.FindByClass(v)
-- for i,j in pairs(eot) do
-- j:Remove()
-- end
-- end
--
-- local mapfields = {
-- "navnodes",
-- "npcs",
-- -- "chests",
-- }
--
-- local function loadMap()
-- for k,v in ipairs(mapfields) do
-- local mapname = game.GetMap()
-- local fpath = string.format("artery/maps/%s/%s/*", mapname, v)
-- local files,dirs = file.Find(fpath,"DATA")
-- for i,j in pairs(files) do
-- if string.GetExtensionFromFilename(j) ~= "lua" then continue end
-- local itempath = string.format("artery/maps/%s/%s/%s", mapname, v, j)
-- local itemtxt = file.Read(itempath, "DATA")
-- assert(itemtxt ~= nil, "Found a file, but it looks like it can't be compiled:" .. itempath)
-- CompileString(itemtxt,itempath)()
-- end
-- end
-- end
--
-- hook.Add( "InitPostEntity", "artery_spawnmapnpcs", function()
-- loadMap()
-- end )
--
-- concommand.Add("artery_reloadmap", function(ply,cmd,args)
-- if not ply:IsAdmin() then return end
-- for k,v in pairs(removeents) do
-- local eot = ents.FindByClass(v)
-- for i,j in pairs(eot) do
-- j:Remove()
-- end
-- end
-- loadMap()
-- end)
|