Exemple #1
0
        public static SoupIORuleProxy Parse(string altstr)
        {
            altstr = altstr.Replace(";", ",");     // Escape ";" into "," before processing
            string[] cmdArgs = SplitCSV(altstr);
            string   cmd     = cmdArgs[0].ToLower();

            if (cmd.Equals("addiorule"))
            {
                if (cmdArgs[1].Length == 0)
                {
                    cmdArgs[1] = String.Format("GR{0}", (genID++));
                }
                SoupIORuleProxy R = new SoupIORuleProxy(cmdArgs[1], cmdArgs[2], cmdArgs[3], cmdArgs[4], Double.Parse(cmdArgs[5]), Double.Parse(cmdArgs[6]), Double.Parse(cmdArgs[7]), Double.Parse(cmdArgs[8]));
                // R.emitter = true;
                return(R);
            }
            return(null);
        }
Exemple #2
0
        public void tick_chemistry(bool full)
        {
            if (m_cBus != null)
            {
                if (full)
                {
                    Halflifes = m_cBus.getHashTable("ChemHalflifes");
                    while (Halflifes == null)
                    {
                        Application.DoEvents();
                        Halflifes = m_cBus.getHashTable("ChemHalflifes");
                    }
                    Settings = m_cBus.getHashTable("ChemSettings");
                    IORules  = m_cBus.getHashTable("ChemIORules");

                    Stack stk = new Stack();
                    foreach (string key in IORules.Keys)
                    {
                        stk.Push(key);
                    }
                    while (stk.Count > 0)
                    {
                        string key = (string)stk.Pop();
                        if (IORules[key].GetType() == typeof(string))
                        {
                            IORules[key] = SoupIORuleProxy.Parse((string)IORules[key]);
                        }
                    }
                }
                BlackBoard            = m_cBus.getHashTable("ChemBlackBoard");
                subsumptionBlackBoard = m_cBus.getHashTable("ChemsubsumptionBlackBoard");
                Chemicals             = m_cBus.getHashTable("ChemChemicals");
            }
            biochemticks++;
            // Notify interested parties
            foreach (string k in chemWatchers.Keys)
            {
                chemUpdateWatcher watcher = (chemUpdateWatcher)chemWatchers[k];
                if (watcher != null)
                {
                    watcher();
                }
            }
        }