Beispiel #1
0
        private bool ShouldSatisfy(Need need)
        {
            Need_Chemical need_Chemical = need as Need_Chemical;

            if (need_Chemical != null && (int)need_Chemical.CurCategory <= 1)
            {
                return(true);
            }
            return(false);
        }
        public override bool CheckGive(Pawn pawn, int checkInterval)
        {
            bool        flag     = false;
            List <Need> allNeeds = pawn.needs.AllNeeds;

            for (int i = 0; i < allNeeds.Count; i++)
            {
                Need_Chemical need_Chemical = allNeeds[i] as Need_Chemical;
                if (need_Chemical != null && need_Chemical.CurLevel > 0.001f)
                {
                    flag = true;
                    break;
                }
            }
            return(!flag && base.CheckGive(pawn, checkInterval));
        }
Beispiel #3
0
        private Thing FindDrugFor(Pawn pawn, Need_Chemical need)
        {
            Hediff_Addiction addictionHediff = need.AddictionHediff;

            if (addictionHediff == null)
            {
                return(null);
            }
            ThingOwner <Thing> innerContainer = pawn.inventory.innerContainer;

            for (int i = 0; i < innerContainer.Count; i++)
            {
                if (DrugValidator(pawn, addictionHediff, innerContainer[i]))
                {
                    return(innerContainer[i]);
                }
            }
            return(GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Drug), PathEndMode.ClosestTouch, TraverseParms.For(pawn), 9999f, (Thing x) => DrugValidator(pawn, addictionHediff, x)));
        }
        private Thing FindDrugFor(Pawn pawn, Need_Chemical need)
        {
            Hediff_Addiction addictionHediff = need.AddictionHediff;

            if (addictionHediff == null)
            {
                return(null);
            }
            ThingOwner <Thing> innerContainer = pawn.inventory.innerContainer;

            for (int i = 0; i < innerContainer.Count; i++)
            {
                if (this.DrugValidator(pawn, addictionHediff, innerContainer[i]))
                {
                    return(innerContainer[i]);
                }
            }
            return(GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Drug), PathEndMode.ClosestTouch, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), 9999f, (Thing x) => this.DrugValidator(pawn, addictionHediff, x), null, 0, -1, false, RegionType.Set_Passable, false));
        }
        private bool ShouldSatisfy(Need need)
        {
            Need_Chemical need_Chemical = need as Need_Chemical;

            return(need_Chemical != null && need_Chemical.CurCategory <= DrugDesireCategory.Desire);
        }
 private static float <TryGiveJob> m__1(Need_Chemical x)
 {
     return(x.CurLevel);
 }