diff options
Diffstat (limited to 'gamemode/server/sv_mapconfig.lua')
| -rw-r--r-- | gamemode/server/sv_mapconfig.lua | 19 |
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 |
