aboutsummaryrefslogtreecommitdiff
path: root/gamemode/server/sv_mapconfig.lua
diff options
context:
space:
mode:
authorAlexander Pickering <alexandermpickering@gmail.com>2016-07-10 17:04:29 -0400
committerAlexander Pickering <alexandermpickering@gmail.com>2016-07-10 17:04:29 -0400
commit1de5f9ac6f038bfed2230cc1272b253794b2f41a (patch)
tree15bc9d515f1f48c036522afb7cc71f60243849a9 /gamemode/server/sv_mapconfig.lua
downloadartery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.tar.gz
artery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.tar.bz2
artery-1de5f9ac6f038bfed2230cc1272b253794b2f41a.zip
Initial commit
Diffstat (limited to 'gamemode/server/sv_mapconfig.lua')
-rw-r--r--gamemode/server/sv_mapconfig.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/gamemode/server/sv_mapconfig.lua b/gamemode/server/sv_mapconfig.lua
new file mode 100644
index 0000000..67a20ae
--- /dev/null
+++ b/gamemode/server/sv_mapconfig.lua
@@ -0,0 +1,19 @@
+--Loads map config form a file
+
+local chests = file.Read("artery/maps/" .. game.GetMap() .. "/chests.txt")
+local npcs = file.Read("artery/maps/" .. game.GetMap() .. "/npcs.txt")
+
+if chests == nil then return end
+if npcs == nil then return end
+
+for _,line in pairs(string.Explode("\n",chests,false)) do
+ local chest = util.JSONToTable(line)
+ local chestent = ents.Create("art_chest")
+ for k,v in pairs(chest.data) do
+ chestent[k] = v
+ end
+ for k,v in pairs(chest.procedures) do
+ chestent[k](unpack(v))
+ end
+ chestent:Spawn()
+end