示例#1
0
        public static string GetDisplayCost(FactorioObject goods)
        {
            var cost = goods.Cost();

            if (float.IsPositiveInfinity(cost))
            {
                return("YAFC analysis: Unable to find a way to fully automate this");
            }

            sb.Clear();

            var    compareCost = cost;
            string costPrefix;

            if (goods is Fluid)
            {
                compareCost = cost * 50;
                costPrefix  = "YAFC cost per 50 units of fluid:";
            }
            else if (goods is Item)
            {
                costPrefix = "YAFC cost per item:";
            }
            else if (goods is Special special && special.isPower)
            {
                costPrefix = "YAFC cost per 1 MW:";
            }
示例#2
0
        public bool IsAccessibleAtNextMilestone(FactorioObject obj)
        {
            var milestoneMask = milestoneResult[obj] & lockedMask;

            if (milestoneMask == 1)
            {
                return(true);
            }
            if ((milestoneMask & 1) != 0)
            {
                return(false);
            }
            return(((milestoneMask - 1) & (milestoneMask - 2)) == 0); // milestoneMask is a power of 2 + 1
        }
示例#3
0
        public FactorioObject GetHighest(FactorioObject target, bool all)
        {
            if (target == null)
            {
                return(null);
            }
            var ms = milestoneResult[target];

            if (!all)
            {
                ms &= lockedMask;
            }
            if (ms == 0)
            {
                return(null);
            }
            var msb = MathUtils.HighestBitSet(ms) - 1;

            return(msb < 0 || msb >= currentMilestones.Length ? null : currentMilestones[msb]);
        }
示例#4
0
 public bool IsAccessibleWithCurrentMilesones(FactorioObject obj) => (milestoneResult[obj] & lockedMask) == 1;
示例#5
0
 private bool ShouldInclude(FactorioObject obj)
 {
     return(onlyCurrentMilestones ? obj.IsAutomatableWithCurrentMilestones() : obj.IsAutomatable());
 }