public void Load(Dungeon D) { this.D = D; LuaLineReader reader = new LuaLineReader(D.DungeonLuaFile); while (true) { string line = reader.Get(); if (line == null) { break; } try { LoadLine(line, reader); } catch (EndOfFileException) { Lint.MsgErr("FATAL: Unexpected end of file."); break; } } Lint.MsgVerbose("{0} entities loaded", D.EntitiesById.Values.Count); D.CreateReverseConnectors(); }
private void LoadLine(string line, LuaLineReader reader) { if (line.StartsWith("mapName(")) { ++m_CurLevel; Lint.MsgVerbose("Reading level {0}", m_CurLevel); } else if (line.StartsWith("setWallSet") || line.StartsWith("playStream")) { return; } else if (line.StartsWith("mapDesc([[")) { while (reader.GetOrThrow() != "]])") { ; // skip map } } else if (line.StartsWith("spawn")) { Tuple <Entity, string> T = LineEntityReader.CreateEntity(m_CurLevel, line, reader, D.Assets); D.AddEntity(T.Item1, m_CurLevel); if (T.Item2 != null) { LoadLine(T.Item2, reader); } } }
void LoadLuaAssetsFromFile(string file) { Lint.MsgVerbose("Loading {0}...", file); m_LuaFiles.Push(file); if (file.StartsWith("assets/")) { return; } if (file.StartsWith("mod_assets/")) { file = Path.Combine(m_DungeonDirectory, file.Replace('/', '\\')); } m_Lua.DoFile(file); m_LuaFiles.Pop(); }
public void Lua_MapName(string mapName) { ++m_Level; Lint.MsgVerbose("Reading level {0}", m_Level); }