예제 #1
0
파일: Compiler.cs 프로젝트: Myvar/LuaBlock
        public void Convert(string script, string schmaticpath)
        {
            Parser p = new Parser();
            var z = p.ParseString(script);

            Methods.Add("classlevel", BuildBody(z.Statements));

            //build clean up code
            List<string> CleanUp = new List<string>();
            int total = 0;
            foreach(var i in Methods)
            {
                foreach(var x in i.Value)
                {
                    total++;
                    if (x.TrimStart('/').StartsWith("scoreboard objectives add"))
                    {
                        CleanUp.Add("/scoreboard objectives remove " + x.TrimStart('/').Split(' ')[3]);
                    }
                }
            }
            Methods["classlevel"].Add("|" + (total / 4));//indicated we need more repeaters
            Methods["classlevel"].AddRange(CleanUp);
            BuildSchematic(schmaticpath);
        }