public void Collects_global_variables_from_VarNames_section() { var compilation = new Compilation(); compilation.AddWorldSaveFile("sphereworld.scp", @"[VarNames] lightlevel=1 middle=165 spawnuid=#040000013 nastaveni_splitShot_delay=450 "); compilation.DefinitionRepository.IsGlobalVariable("lightlevel").Should().BeTrue(); }
private void TranspileWorldFile(string worldFileName, TranspileSaveOptions options) { Console.WriteLine($"Parsing {worldFileName}"); string src = File.ReadAllText(worldFileName); compilation.AddWorldSaveFile(worldFileName, src); CheckCompilationErrors(); var outputWorldFileName = GetOutputFileName(Path.GetFileName(worldFileName), options); var outputDataFileName = GetOutputFileName("spheredata.scp", options); Console.WriteLine($"Transpiling to {outputWorldFileName}"); Console.WriteLine($"Transpiling to {outputDataFileName}"); var transpiler = new WorldTranspiler(compilation.DefinitionRepository); WorldTranspilationResult result = transpiler.Transpile(compilation.CompiledWorldSaveFile.ParsedTree); File.WriteAllText(outputWorldFileName, result.World); File.WriteAllText(outputDataFileName, result.Data); }
private void ParseWorldSave(string savePath) => ParseSaveFile(savePath, "sphereworld.scp", (name, src) => compilation.AddWorldSaveFile(name, src));