示例#1
0
        // Function from file: recipe.dm
        public int check_reagents(Reagents avail_reagents = null)
        {
            int _default = 0;

            dynamic r_r         = null;
            bool    aval_r_amnt = false;

            _default = 1;

            foreach (dynamic _a in Lang13.Enumerate(this.reagents))
            {
                r_r = _a;

                aval_r_amnt = avail_reagents.get_reagent_amount(r_r);

                if (!(Math.Abs((aval_r_amnt ?1:0) - Convert.ToDouble(this.reagents[r_r])) < 0.5))
                {
                    if ((aval_r_amnt ?1:0) > Convert.ToDouble(this.reagents[r_r]))
                    {
                        _default = -1;
                    }
                    else
                    {
                        return(0);
                    }
                }
            }

            if ((this.reagents != null ? this.reagents.len : 0) < avail_reagents.reagent_list.len)
            {
                return(-1);
            }
            return(_default);
        }