Ejemplo n.º 1
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol)
        {
            Map currentMap = Find.CurrentMap;

            if (def.HasComp(typeof(CompAffectedByFacilities)))
            {
                CompAffectedByFacilities.DrawLinesToPotentialThingsToLinkTo(def, center, rot, currentMap);
            }

            if (def.HasComp(typeof(CompFacility)))
            {
                CompFacility.DrawLinesToPotentialThingsToLinkTo(def, center, rot, currentMap);
            }
        }
Ejemplo n.º 2
0
        public static void InjectPowerSwitch()
        {
            ThingDef thingDef = DefDatabase <ThingDef> .GetNamed("PowerSwitch");

            if (!thingDef.HasComp(typeof(CompRTPowerSwitch)))
            {
                thingDef.comps.Add(new CompProperties_RTPowerSwitch());
            }
            foreach (Building building in Find.ListerBuildings.AllBuildingsColonistOfClass <Building_PowerSwitch>())
            {
                if (building.TryGetComp <CompRTPowerSwitch>() == null)
                {
                    List <CompProperties> componentsBackup = new List <CompProperties>();
                    foreach (CompProperties compProperties in building.def.comps)
                    {
                        componentsBackup.Add(compProperties);
                    }
                    building.def.comps.Clear();
                    building.def.comps.Add(new CompProperties_RTPowerSwitch());
                    building.InitializeComps();
                    building.TryGetComp <CompRTPowerSwitch>().PostSpawnSetup();
                    building.def.comps.Clear();
                    foreach (CompProperties compProperties in componentsBackup)
                    {
                        building.def.comps.Add(compProperties);
                    }
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Determines if the specified thingDef is a hopper user.
 /// </summary>
 /// <returns><c>true</c> if the specified thingDef is a hopper user; otherwise, <c>false</c>.</returns>
 /// <param name="thingDef">ThingDef to test</param>
 public static bool                  IsHopperUser(this ThingDef thingDef)
 {
     return
         ((thingDef.building != null) &&
          (thingDef.building.wantsHopperAdjacent) &&
          (thingDef.HasComp(typeof(CompHopperUser))));
 }
Ejemplo n.º 4
0
 static void Postfix(ThingRequestGroup group, ThingDef def, ref bool __result)
 {
     if (group == ThingRequestGroup.ProjectileInterceptor && !__result)
     {
         __result = def.HasComp(typeof(CompBETAProjectileInterceptor));
     }
 }
Ejemplo n.º 5
0
        private void WeaponCompsNew()
        {
            // ReSharper disable once PossibleNullReferenceException
            foreach (WeaponExtensionDef weaponExtensionDef in DefDatabase <WeaponExtensionDef> .AllDefsListForReading)
            {
                ThingDef thingDef = ThingDef.Named(weaponExtensionDef.weapon);

                if (thingDef == null)
                {
                    continue;
                }

                if (thingDef.HasComp(typeof(CompProperties_WeaponExtensions)))
                {
                    return;
                }

                CompProperties_WeaponExtensions weaponExtensions =
                    new CompProperties_WeaponExtensions
                {
                    compClass                 = typeof(CompWeaponExtensions),
                    AttackAngleOffset         = weaponExtensionDef.attackAngleOffset,
                    WeaponPositionOffset      = weaponExtensionDef.weaponPositionOffset,
                    AimedWeaponPositionOffset = weaponExtensionDef.aimedWeaponPositionOffset,
                    RightHandPosition         = weaponExtensionDef.firstHandPosition,
                    LeftHandPosition          = weaponExtensionDef.secondHandPosition
                };

                thingDef.comps?.Add(weaponExtensions);
            }

            this.LaserLoad();
        }
Ejemplo n.º 6
0
        private void AnimalPawnCompsBodyDefImport()
        {
            // ReSharper disable once PossibleNullReferenceException
            foreach (BodyAnimDef def in DefDatabase <BodyAnimDef> .AllDefsListForReading)
            {
                string target = def.thingTarget;
                if (target.NullOrEmpty())
                {
                    continue;
                }

                ThingDef thingDef = ThingDef.Named(target);
                if (thingDef == null)
                {
                    continue;
                }
                //if (DefDatabase<BodyAnimDef>
                //   .AllDefsListForReading.Any(x => x.defName.Contains(thingDef.defName))) continue;
                if (thingDef.HasComp(typeof(CompBodyAnimator)))
                {
                    continue;
                }

                CompProperties_BodyAnimator animator = new CompProperties_BodyAnimator
                {
                    compClass      = typeof(CompBodyAnimator),
                    bodyDrawers    = def.bodyDrawers,
                    handType       = def.handType,
                    quadruped      = def.quadruped,
                    bipedWithHands = def.bipedWithHands
                };

                thingDef.comps?.Add(animator);
            }
        }
Ejemplo n.º 7
0
 static bool InjectPredicate(ThingDef def)
 {
     if (!def.HasComp(typeof(CompQuality)))
     {
         return(false);
     }
     if (def.HasComp(typeof(CompInfused)))
     {
         return(false);
     }
     if (def.Verbs.Any(v => typeof(Verb_ShootOneUse).IsAssignableFrom(v.GetType())))
     {
         return(false);
     }
     return(true);
 }
 public ThingStuffPairWithQuality(ThingDef thing, ThingDef stuff, QualityCategory quality)
 {
     this.thing   = thing;
     this.stuff   = stuff;
     this.quality = new QualityCategory?(quality);
     if (quality != QualityCategory.Normal && !thing.HasComp(typeof(CompQuality)))
     {
         Log.Warning(string.Concat(new object[]
         {
             "Created ThingStuffPairWithQuality with quality",
             quality,
             " but ",
             thing,
             " doesn't have CompQuality."
         }), false);
         quality = QualityCategory.Normal;
     }
     if (stuff != null && !thing.MadeFromStuff)
     {
         Log.Warning(string.Concat(new object[]
         {
             "Created ThingStuffPairWithQuality with stuff ",
             stuff,
             " but ",
             thing,
             " is not made from stuff."
         }), false);
         stuff = null;
     }
 }
Ejemplo n.º 9
0
        public override void Resolve(ResolveParams rp)
        {
            Map     map = BaseGen.globalSettings.map;
            Faction faction;

            if ((faction = rp.faction) == null)
            {
                faction = (Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Industrial) ?? Find.FactionManager.RandomEnemyFaction(false, false, true, TechLevel.Undefined));
            }
            Faction  faction2 = faction;
            Rot4?    thingRot = rp.thingRot;
            Rot4     rot      = (thingRot == null) ? Rot4.Random : thingRot.Value;
            ThingDef thingDef;

            if ((thingDef = rp.mortarDef) == null)
            {
                thingDef = (from x in DefDatabase <ThingDef> .AllDefsListForReading
                            where x.category == ThingCategory.Building && x.building.IsMortar
                            select x).RandomElement <ThingDef>();
            }
            ThingDef thingDef2 = thingDef;
            IntVec3  intVec;

            if (this.TryFindMortarSpawnCell(rp.rect, rot, thingDef2, out intVec))
            {
                if (thingDef2.HasComp(typeof(CompMannable)))
                {
                    IntVec3               c = ThingUtility.InteractionCellWhenAt(thingDef2, intVec, rot, map);
                    Lord                  singlePawnLord = LordMaker.MakeNewLord(faction2, new LordJob_ManTurrets(), map, null);
                    PawnKindDef           kind           = faction2.RandomPawnKind();
                    Faction               faction3       = faction2;
                    int                   tile           = map.Tile;
                    PawnGenerationRequest value          = new PawnGenerationRequest(kind, faction3, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, true, 1f, false, true, true, true, false, false, false, null, null, null, null, null, null, null, null);
                    ResolveParams         resolveParams  = rp;
                    resolveParams.faction = faction2;
                    resolveParams.singlePawnGenerationRequest = new PawnGenerationRequest?(value);
                    resolveParams.rect           = CellRect.SingleCell(c);
                    resolveParams.singlePawnLord = singlePawnLord;
                    BaseGen.symbolStack.Push("pawn", resolveParams);
                }
                ThingDef  turret    = thingDef2;
                bool      allowEMP  = false;
                TechLevel techLevel = faction2.def.techLevel;
                ThingDef  thingDef3 = TurretGunUtility.TryFindRandomShellDef(turret, allowEMP, true, techLevel, false, 250f);
                if (thingDef3 != null)
                {
                    ResolveParams resolveParams2 = rp;
                    resolveParams2.faction               = faction2;
                    resolveParams2.singleThingDef        = thingDef3;
                    resolveParams2.singleThingStackCount = new int?(Rand.RangeInclusive(5, Mathf.Min(8, thingDef3.stackLimit)));
                    BaseGen.symbolStack.Push("thing", resolveParams2);
                }
                ResolveParams resolveParams3 = rp;
                resolveParams3.faction        = faction2;
                resolveParams3.singleThingDef = thingDef2;
                resolveParams3.rect           = CellRect.SingleCell(intVec);
                resolveParams3.thingRot       = new Rot4?(rot);
                BaseGen.symbolStack.Push("thing", resolveParams3);
            }
        }
        // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
        private bool CheckDef(ThingDef conduit)
        {
            if (conduit == null)
            {
                return(false);
            }
            bool   flag    = conduit != null;
            string defName = conduit.defName;
            string text    = defName;

            if (text != null)
            {
                if (text == "MUR_SubsurfaceConduit")
                {
                    return(true);
                }
                if (text == "M13PowerConduit")
                {
                    return(true);
                }
                if (text == "M13WaterproofConduit")
                {
                    return(true);
                }
            }
            if (conduit.thingClass != typeof(Building))
            {
                return(false);
            }
            if (conduit.graphicData.linkType != LinkDrawerType.Transmitter)
            {
                return(false);
            }
            if ((conduit.graphicData.linkFlags & LinkFlags.PowerConduit) == LinkFlags.None)
            {
                return(false);
            }
            if (!conduit.placeWorkers.Contains(typeof(PlaceWorker_Conduit)))
            {
                return(false);
            }
            if (conduit.placingDraggableDimensions != 1)
            {
                return(false);
            }
            if (!conduit.EverTransmitsPower)
            {
                return(false);
            }
            if (!conduit.HasComp(typeof(CompPowerTransmitter)))
            {
                return(false);
            }
            if (conduit.altitudeLayer != AltitudeLayer.Conduits)
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 11
0
        public ANRule(TradeRequestComp Comp) : this()
        {
            Quant_       = Comp.requestCount;
            NotifyUnder_ = false;

            ThingDef def = Comp.requestThingDef;

            RuleLabel = "Generated: " + Comp.CompInspectStringExtra();

            //Get type via label
            Type t = ASLibMod.GetSingleton.GetBaseFilters.First(x => x.GetType().FullName == "RWAutoSell.Filters.FilterCat").GetType();    //.First(x. => x.Label == "RWAutoSell.FilterCat".Translate()).GetType();

            //create filtercontainer using type, and populate data
            FilterContainer cat = new FilterContainer(t)
            {
                FilterData = new List <string>()
                {
                    "thg." + def.defName
                }
            };

            Nodes_[0].RootNode.Filters.Add(cat);

            if (def.HasComp(typeof(CompQuality)))
            {
                //and another type/container pair for quality, underlying byte value for normal is '2'
                Type t2 = ASLibMod.GetSingleton.GetBaseFilters.First(x => x.GetType().FullName == "RWAutoSell.Filters.FilterQuality").GetType();
                //Type t2 = ASLibMod.GetSingleton.GetBaseFilters.First(x => x.Label == "Quality".Translate()).GetType();

                List <string> data = new List <string>();
                foreach (QualityCategory qc in QualityUtility.AllQualityCategories)
                {
                    if ((int)qc >= 2)
                    {
                        data.Add(((byte)qc).ToString());
                    }
                }

                FilterContainer qlt = new FilterContainer(t2)
                {
                    FilterData = data
                };
                Nodes_[0].RootNode.Filters.Add(qlt);
            }

            if (def.IsApparel)
            {
                Type t3 = ASLibMod.GetSingleton.GetBaseFilters.First(x => x.GetType().FullName == "RWAutoSell.Filters.FilterApparel").GetType();

                List <string> data = new List <string>();
                data.Add("tnt.1");

                FilterContainer app = new FilterContainer(t3)
                {
                    FilterData = data
                };
                Nodes_[0].RootNode.Filters.Add(app);
            }
        }
Ejemplo n.º 12
0
 public override bool CanEverMatch(ThingDef def)
 {
     if (def.IsApparel)
     {
         return(def.HasComp(typeof(CompBiocodableApparel)));
     }
     return(false);
 }
Ejemplo n.º 13
0
 public override IEnumerable <string> ConfigErrors(ThingDef parentDef)
 {
     // No CompFlickable
     if (!parentDef.HasComp(typeof(CompFlickable)))
     {
         yield return("Does not have CompFlickable.");
     }
 }
Ejemplo n.º 14
0
        private static void IsHumanlikeMeat_Postfix(ThingDef def, ref bool __result)
        {
            //meat and blood are indistinguishable to the original method. Use CompBlood to flag as not meat
            bool newResult = __result && !def.HasComp(typeof(CompBlood));

            //Log.Message($"{def.defName}.IsHumanlikeMeat postfix. Original result: {__result}. New result: {newResult}");
            __result = newResult;
        }
Ejemplo n.º 15
0
        protected override bool LongSearchMatch(ThingDef thing)
        {
            if (!base.LongSearchMatch(thing))
            {
                return(false);
            }
            if (!fromCategory.NullOrEmpty())
            {
                if (thing.thingCategories.NullOrEmpty() || !thing.thingCategories.Exists(cat => fromCategory.Contains(cat)))
                {
                    return(false);
                }
            }
            if (!fromRessource.NullOrEmpty())
            {
                if (!fromRessource.Exists(ress => ress.stuffProps.CanMake(thing)))
                {
                    return(false);
                }
            }
            if (!neededStats.NullOrEmpty())
            {
                if (thing.statBases.NullOrEmpty())
                {
                    return(false);
                }
                QualityCategory quality;
                List <ThingDef> stuffs;
                for (int i = 0; i < neededStats.Count; i++)
                {
                    if (!thing.statBases.StatListContains(neededStats[i].def))
                    {
                        return(false);
                    }
                    quality = thing.HasComp(typeof(CompQuality)) ? QualityCategory.Legendary : QualityCategory.Normal;
                    if (thing.MadeFromStuff)
                    {
                        stuffs = fromRessource.NullOrEmpty() ?
                                 DefDatabase <ThingDef> .AllDefsListForReading.FindAll(def => def.IsStuff && def.stuffProps.CanMake(thing)) :
                                 fromRessource.FindAll(def => def.stuffProps.CanMake(thing));

                        for (int j = 0; j < stuffs.Count; j++)
                        {
                            if (neededStats[i].def.Worker.GetValue(StatRequest.For(thing, stuffs[i], quality)) < neededStats[i].minValue)
                            {
                                return(false);
                            }
                        }
                    }
                    else if (neededStats[i].def.Worker.GetValue(StatRequest.For(thing, null, quality)) < neededStats[i].minValue)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 16
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol, Thing thing = null)
        {
            Map currentMap = Find.CurrentMap;

            if (def.HasComp(typeof(CompShipLandingBeacon)))
            {
                ShipLandingBeaconUtility.DrawLinesToNearbyBeacons(def, center, rot, currentMap, thing);
            }
        }
Ejemplo n.º 17
0
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot, Color ghostCol)
        {
            Map currentMap = Find.CurrentMap;

            if (def.HasComp(typeof(CompResonancePowerPlant)))
            {
                CompResonancePowerPlant.DrawLinesToPotentialThingsToLinkTo(def, center, rot, currentMap);
            }
        }
        public static string RequestedThingLabel(ThingDef def, int count)
        {
            string text = GenLabel.ThingLabel(def, null, count);

            if (def.HasComp(typeof(CompQuality)))
            {
                text = text + " (" + "NormalQualityOrBetter".Translate() + ")";
            }
            return(text);
        }
Ejemplo n.º 19
0
        private static void OpenLoadoutWindow(Pawn pawn, CompAwesomeInventoryLoadout comp, ThingGroupSelector groupSelector)
        {
            Find.WindowStack.Add(AwesomeInventoryServiceProvider.MakeInstanceOf <Dialog_ManageLoadouts>(new object[] { comp.Loadout, pawn, false }));
            ThingDef allowedThing = groupSelector.AllowedThing;

            if (allowedThing.MadeFromStuff || allowedThing.HasComp(typeof(CompQuality)) || allowedThing.useHitPoints)
            {
                Find.WindowStack.Add(new Dialog_StuffAndQuality(groupSelector));
            }
        }
Ejemplo n.º 20
0
 public static bool Markable(this ThingDef p, out CompProperties_Markable props)
 {
     props = null;
     if (p.HasComp(typeof(Comp_Markable)))
     {
         props = p.GetCompProperties <CompProperties_Markable>();
         return(true);
     }
     return(false);
 }
Ejemplo n.º 21
0
 public static void ApparelUtility__HasPartsToWearPostfix
     (Pawn p, ThingDef apparel, ref bool __result)
 {
     if (apparel.HasComp(typeof(CompApparelBodyRestriction)))
     {
         CompProperties_ApparelBodyRestriction compProperties = apparel.GetCompProperties <CompProperties_ApparelBodyRestriction>();
         if (compProperties != null)
         {
             __result = compProperties.AllowedBodyTypes.Contains(p.story.bodyType);
         } // end if
     }     // end if
 }         // end method
Ejemplo n.º 22
0
 public static bool FollowQualityThingFilter(this ThingDef def)
 {
     if (def.stackLimit == 1)
     {
         return(true);
     }
     if (def.HasComp(typeof(CompQuality)))
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 23
0
        private void AnimalPawnCompsImportFromAnimationTargetDefs()
        {
            // ReSharper disable once PossibleNullReferenceException
            foreach (AnimationTargetDef def in DefDatabase <AnimationTargetDef> .AllDefsListForReading)
            {
                if (def.CompLoaderTargets.NullOrEmpty())
                {
                    continue;
                }

                foreach (CompLoaderTargets pawnSets in def.CompLoaderTargets)
                {
                    if (pawnSets == null)
                    {
                        continue;
                    }

                    if (pawnSets.thingTargets.NullOrEmpty())
                    {
                        continue;
                    }

                    foreach (string target in pawnSets.thingTargets)
                    {
                        ThingDef thingDef = ThingDef.Named(target);
                        if (thingDef == null)
                        {
                            continue;
                        }
                        //if (DefDatabase<BodyAnimDef>
                        //   .AllDefsListForReading.Any(x => x.defName.Contains(thingDef.defName))) continue;
                        if (thingDef.HasComp(typeof(CompBodyAnimator)))
                        {
                            continue;
                        }

                        CompProperties_BodyAnimator bodyAnimator = new CompProperties_BodyAnimator
                        {
                            compClass   = typeof(CompBodyAnimator),
                            bodyDrawers = pawnSets.bodyDrawers,
                            handType    = pawnSets.handType,
                            // footType = pawnSets.footType,
                            // pawType = pawnSets.pawType,
                            quadruped      = pawnSets.quadruped,
                            bipedWithHands = pawnSets.bipedWithHands
                        };
                        thingDef.comps?.Add(bodyAnimator);
                    }
                }
            }

            this.LaserLoad();
        }
Ejemplo n.º 24
0
 private bool                        CanInjectInto(ThingDef thingDef, Type compClass, Type compProps)
 {
     if (compClass != null)
     {
         return(!thingDef.HasComp(compClass));
     }
     else if (compProps != typeof(CompProperties))
     {
         return(thingDef.GetCompProperty(compProps) == null);
     }
     return(false);
 }
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
        {
            Map visibleMap = Find.VisibleMap;

            if (def.HasComp(typeof(CompAffectedByFacilities)))
            {
                CompAffectedByFacilities.DrawLinesToPotentialThingsToLinkTo(def, center, rot, visibleMap);
            }
            else
            {
                CompFacility.DrawLinesToPotentialThingsToLinkTo(def, center, rot, visibleMap);
            }
        }
        public override IEnumerable <string> ConfigErrors(ThingDef parentDef)
        {
            // Parent def does not have CompQuality
            if (!parentDef.HasComp(typeof(CompQuality)))
            {
                yield return($"{parentDef} does not have CompQuality but is using CompProperties_IngestedThoughtFromQuality.");
            }

            // Ingested thought is not a memory
            if (!ingestedThought.IsMemory)
            {
                yield return($"{parentDef} CompProperties_IngestedThoughtFromQuality {ingestedThought}'s thoughtClass is not a Thought_Memory.");
            }
        }
        public static bool Prefix(ref ThingRequestGroup group, ref ThingDef def, ref bool __result)
        {
            if (def == null || def.IsBlueprint || __result)
            {
                return(true);
            }
            if (group != ThingRequestGroup.Blueprint || !def.HasComp(typeof(CompUpgradable)))
            {
                return(true);
            }

            __result = true;
            return(false);
        }
Ejemplo n.º 28
0
        public override IEnumerable <string> ConfigErrors(ThingDef parentDef)
        {
            foreach (string e in base.ConfigErrors(parentDef))
            {
                yield return(e);
            }

            if (onlyApplyWhenUpgraded && !parentDef.HasComp(typeof(CompUpgradable)))
            {
                yield return("has onlyApplyWhenUpgraded set to true but doesn't have CompUpgradable");

                onlyApplyWhenUpgraded = false;
            }
            yield break;
        }
Ejemplo n.º 29
0
        public override void DrawWorker(Vector3 loc, Rot4 rot, ThingDef thingDef, Thing thing, float extraRotation)
        {
            if (thingDef == null)
            {
                Log.Error("Graphic_Animated with null thingDef", false);
                return;
            }
            if (this.subGraphics == null)
            {
                Log.Error("Graphic_Animated has no subgraphics", false);
                return;
            }
            Graphic graphic;

            if (thing == null)
            {
                graphic = this.SubGraphicFor(thing);
            }
            else
            {
                if (thingDef.HasComp(typeof(CompGTAnimation)) && !this.initFromComps)
                {
                    CompGTAnimation comp = thing.TryGetComp <CompGTAnimation>();
                    this.ticksPerFrame = comp.Props.frameSpeed;
                    this.randomized    = comp.Props.randomized;
                    this.initFromComps = true;
                }
                int ticksCurrent = Find.TickManager.TicksGame;
                if (ticksCurrent >= this.ticksPrev + this.ticksPerFrame)
                {
                    this.ticksPrev = ticksCurrent;
                    if (this.randomized)
                    {
                        this.currentFrame = Rand.Range(0, this.subGraphics.Length - 1);
                    }
                    else
                    {
                        this.currentFrame++;
                    }
                }
                if (this.currentFrame >= this.subGraphics.Length)
                {
                    this.currentFrame = 0;
                }
                graphic = this.subGraphics[this.currentFrame];
            }
            graphic.DrawWorker(loc, rot, thingDef, thing, extraRotation);
        }
 public ThingStuffPairWithQuality(ThingDef thing, ThingDef stuff, QualityCategory quality)
 {
     this.thing   = thing;
     this.stuff   = stuff;
     this.quality = quality;
     if (quality != QualityCategory.Normal && !thing.HasComp(typeof(CompQuality)))
     {
         Log.Warning("Created ThingStuffPairWithQuality with quality" + quality + " but " + thing + " doesn't have CompQuality.");
         quality = QualityCategory.Normal;
     }
     if (stuff != null && !thing.MadeFromStuff)
     {
         Log.Warning("Created ThingStuffPairWithQuality with stuff " + stuff + " but " + thing + " is not made from stuff.");
         stuff = null;
     }
 }
 internal static bool _Includes( this ThingRequestGroup group, ThingDef def )
 {
     switch( group )
     {
     case ThingRequestGroup.Undefined:
         return false;
     case ThingRequestGroup.Nothing:
         return false;
     case ThingRequestGroup.Everything:
         return true;
     case ThingRequestGroup.HaulableEver:
         return def.EverHaulable;
     case ThingRequestGroup.HaulableAlways:
         return def.alwaysHaulable;
     case ThingRequestGroup.CultivatedPlant:
         if( def.category == ThingCategory.Plant )
         {
             return (double) Find.Map.Biome.CommonalityOfPlant( def ) == 0.0;
         }
         return false;
     case ThingRequestGroup.FoodSource:
         if( !def.IsNutritionGivingIngestible )
         {
             return def.IsFoodMachine();
         }
         return true;
     case ThingRequestGroup.FoodSourceNotPlantOrTree:
         if(
             ( !def.IsNutritionGivingIngestible )||
             ( ( def.ingestible.foodType & ~FoodTypeFlags.Plant & ~FoodTypeFlags.Tree ) == FoodTypeFlags.None )
         )
         {
             return def.IsFoodMachine();
         }
         return true;
     case ThingRequestGroup.Corpse:
         return def.thingClass == typeof (Corpse);
     case ThingRequestGroup.Blueprint:
         return def.IsBlueprint;
     case ThingRequestGroup.BuildingArtificial:
         if(
             ( def.category == ThingCategory.Building )||
             ( def.IsFrame )
         )
         {
             return
                 (
                     def.building == null
                     ? 0
                     :
                     (
                         def.building.isNaturalRock
                         ? 1
                         :
                         (
                             def.building.isResourceRock
                             ?
                             1 :
                             0
                         )
                     )
                 ) == 0;
         }
         return false;
     case ThingRequestGroup.BuildingFrame:
         return def.IsFrame;
     case ThingRequestGroup.Pawn:
         return def.category == ThingCategory.Pawn;
     case ThingRequestGroup.PotentialBillGiver:
         return !def.AllRecipes.NullOrEmpty();
     case ThingRequestGroup.Medicine:
         return def.IsMedicine;
     case ThingRequestGroup.Filth:
         return def.filth != null;
     case ThingRequestGroup.AttackTarget:
         return typeof( IAttackTarget ).IsAssignableFrom( def.thingClass );
     case ThingRequestGroup.Weapon:
         return def.IsWeapon;
     case ThingRequestGroup.Refuelable:
         return def.HasComp( typeof( CompRefuelable ) );
     case ThingRequestGroup.HaulableEverOrMinifiable:
         if( !def.EverHaulable )
         {
             return def.Minifiable;
         }
         return true;
     case ThingRequestGroup.Construction:
         if( !def.IsBlueprint )
         {
             return def.IsFrame;
         }
         return true;
     case ThingRequestGroup.HasGUIOverlay:
         return def.drawGUIOverlay;
     case ThingRequestGroup.Apparel:
         return def.IsApparel;
     case ThingRequestGroup.MinifiedThing:
         return typeof( MinifiedThing ).IsAssignableFrom( def.thingClass );
     case ThingRequestGroup.Grave:
         return typeof( Building_Grave ).IsAssignableFrom( def.thingClass );
     case ThingRequestGroup.Art:
         return def.HasComp( typeof( CompArt ) );
     case ThingRequestGroup.Container:
         return typeof( IThingContainerOwner ).IsAssignableFrom( def.thingClass );
     case ThingRequestGroup.DropPod:
         if( !typeof( DropPod ).IsAssignableFrom( def.thingClass ) )
         {
             return typeof( DropPodIncoming ).IsAssignableFrom( def.thingClass );
         }
         return true;
     default:
         throw new ArgumentException("group");
     }
 }