Exemple #1
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);
 }
Exemple #2
0
 public static bool                  IsFoodMachine(this ThingDef thingDef)
 {
     if (typeof(Building_NutrientPasteDispenser).IsAssignableFrom(thingDef.thingClass))
     {
         return(true);
     }
     if (typeof(Building_AutomatedFactory).IsAssignableFrom(thingDef.thingClass))
     {   // Make sure we are only return factories which are configured as food synthesizers
         var propsFactory = thingDef.GetCompProperty <CompProperties_AutomatedFactory>();
         if (propsFactory != null)
         {
             if (
                 (propsFactory.outputVector == FactoryOutputVector.DirectToPawn) &&
                 (propsFactory.productionMode == FactoryProductionMode.PawnInteractionOnly)
                 )
             {
                 return(true);
             }
         }
     }
     return(false);
 }