Ejemplo n.º 1
0
        private static Job FinishUftJob(Pawn pawn, UnfinishedThing uft, Bill_ProductionWithUft bill)
        {
            if (uft.Creator != pawn)
            {
                Log.Error("Tried to get FinishUftJob for " + pawn + " finishing " + uft + " but its creator is " + uft.Creator);
                return(null);
            }
            Job job = WorkGiverUtility.HaulStuffOffBillGiverJob(pawn, bill.billStack.billGiver, uft);

            if (job != null && job.targetA.Thing != uft)
            {
                return(job);
            }
            Job job2 = JobMaker.MakeJob(JobDefOf.DoBill, (Thing)bill.billStack.billGiver);

            job2.bill         = bill;
            job2.targetQueueB = new List <LocalTargetInfo>
            {
                uft
            };
            job2.countQueue = new List <int>
            {
                1
            };
            job2.haulMode = HaulMode.ToCellNonStorage;
            return(job2);
        }
Ejemplo n.º 2
0
        private Job TryStartNewDoBillJob(Pawn pawn, Bill bill, IBillGiver giver)
        {
            Job job = WorkGiverUtility.HaulStuffOffBillGiverJob(pawn, giver, null);
            Job result;

            if (job != null)
            {
                result = job;
            }
            else
            {
                Job job2 = new Job(JobDefOf.DoBill, (Thing)giver);
                job2.targetQueueB = new List <LocalTargetInfo>(this.chosenIngThings.Count);
                job2.countQueue   = new List <int>(this.chosenIngThings.Count);
                for (int i = 0; i < this.chosenIngThings.Count; i++)
                {
                    job2.targetQueueB.Add(this.chosenIngThings[i].Thing);
                    job2.countQueue.Add(this.chosenIngThings[i].Count);
                }
                job2.haulMode = HaulMode.ToCellNonStorage;
                job2.bill     = bill;
                result        = job2;
            }
            return(result);
        }
Ejemplo n.º 3
0
        private static Job FinishUftJob(Pawn pawn, UnfinishedThing uft, Bill_ProductionWithUft bill)
        {
            if (uft.Creator != pawn)
            {
                Log.Error(string.Concat(new object[]
                {
                    "Tried to get FinishUftJob for ",
                    pawn,
                    " finishing ",
                    uft,
                    " but its creator is ",
                    uft.Creator
                }), false);
                return(null);
            }
            Job job = WorkGiverUtility.HaulStuffOffBillGiverJob(pawn, bill.billStack.billGiver, uft);

            if (job != null && job.targetA.Thing != uft)
            {
                return(job);
            }
            return(new Job(JobDefOf.DoBill, (Thing)bill.billStack.billGiver)
            {
                bill = bill,
                targetQueueB = new List <LocalTargetInfo>
                {
                    uft
                },
                countQueue = new List <int>
                {
                    1
                },
                haulMode = HaulMode.ToCellNonStorage
            });
        }
Ejemplo n.º 4
0
        private Job TryStartNewDoBillJob(Pawn pawn, Bill bill, IBillGiver giver)
        {
            Job job = WorkGiverUtility.HaulStuffOffBillGiverJob(pawn, giver, null);

            if (job != null)
            {
                return(job);
            }
            Job job2 = new Job(JobDefOf.DoBill, (Thing)giver);

            job2.targetQueueB = new List <LocalTargetInfo>(this.chosenIngThings.Count);
            job2.countQueue   = new List <int>(this.chosenIngThings.Count);
            for (int i = 0; i < this.chosenIngThings.Count; i++)
            {
                List <LocalTargetInfo> targetQueueB = job2.targetQueueB;
                ThingAmount            thingAmount  = this.chosenIngThings[i];
                targetQueueB.Add(thingAmount.thing);
                List <int>  countQueue   = job2.countQueue;
                ThingAmount thingAmount2 = this.chosenIngThings[i];
                countQueue.Add(thingAmount2.count);
            }
            job2.haulMode = HaulMode.ToCellNonStorage;
            job2.bill     = bill;
            return(job2);
        }
Ejemplo n.º 5
0
        public static Job TryStartNewDoBillJob(Pawn pawn, Bill bill, IBillGiver giver, List <ThingCount> chosenIngThings, out Job haulOffJob, bool dontCreateJobIfHaulOffRequired = true)
        {
            haulOffJob = WorkGiverUtility.HaulStuffOffBillGiverJob(pawn, giver, null);
            if (haulOffJob != null && dontCreateJobIfHaulOffRequired)
            {
                return(haulOffJob);
            }
            Job job = JobMaker.MakeJob(JobDefOf.DoBill, (Thing)giver);

            job.targetQueueB = new List <LocalTargetInfo>(chosenIngThings.Count);
            job.countQueue   = new List <int>(chosenIngThings.Count);
            for (int i = 0; i < chosenIngThings.Count; i++)
            {
                job.targetQueueB.Add(chosenIngThings[i].Thing);
                job.countQueue.Add(chosenIngThings[i].Count);
            }
            job.haulMode = HaulMode.ToCellNonStorage;
            job.bill     = bill;
            return(job);
        }