コード例 #1
0
        public static bool CaravanOrRichestColonyHasAnyOf(ThingDef thingdef, Caravan caravan, out Thing thing)
        {
            if (CaravanInventoryUtility.TryGetThingOfDef(caravan, thingdef, out thing, out Pawn owner))
            {
                return(true);
            }

            List <Map> maps = Find.Maps.FindAll(x => x.IsPlayerHome);

            if (maps.NullOrEmpty())
            {
                return(false);
            }

            maps.SortBy(x => x.PlayerWealthForStoryteller);
            Map richestMap = maps.First();

            if (thingdef.IsBuildingArtificial)
            {
                return(FindBuildingOrMinifiedVersionThereOf(thingdef, richestMap, out thing));
            }
            var thingsOfDef = richestMap.listerThings.ThingsOfDef(thingdef);

            thing = thingsOfDef.FirstOrDefault();
            return(thingsOfDef.Any());
        }
コード例 #2
0
 // Token: 0x06000047 RID: 71 RVA: 0x00005074 File Offset: 0x00003274
 public static bool CaravanHasDrug(Caravan car, ThingDef drugDef, out Thing drug, out Pawn owner)
 {
     owner = null;
     drug  = null;
     if (CaravanInventoryUtility.TryGetThingOfDef(car, drugDef, out Thing thing, out Pawn carOwner))
     {
         drug  = thing;
         owner = carOwner;
         return(true);
     }
     return(false);
 }