コード例 #1
0
        private void                        MergeExceptionsIntoHopperSettings(ThingFilter exceptionFilter)
        {
            //Log.Message( string.Format( "{0}.CompHopperUser.MergeExceptionsIntoHopperSettings( ThingFilter )", this.parent.ThingID ) );
            if (!exceptionFilter.ExceptedCategories().NullOrEmpty())
            {
                foreach (var category in exceptionFilter.ExceptedCategories())
                {
                    var categoryDef = DefDatabase <ThingCategoryDef> .GetNamed(category, true);

                    foreach (var hopperSetting in hopperSettings)
                    {
                        hopperSetting.settings.filter.SetAllow(categoryDef, false);
                    }
                }
            }
            if (!exceptionFilter.ExceptedThingDefs().NullOrEmpty())
            {
                foreach (var thingDef in exceptionFilter.ExceptedThingDefs())
                {
                    foreach (var hopperSetting in hopperSettings)
                    {
                        hopperSetting.settings.filter.SetAllow(thingDef, false);
                    }
                }
            }
        }
コード例 #2
0
 private void MergeExceptionsIntoHopperSettings( ThingFilter exceptionFilter )
 {
     //Log.Message( string.Format( "{0}.CompHopperUser.MergeExceptionsIntoHopperSettings( ThingFilter )", this.parent.ThingID ) );
     if( !exceptionFilter.ExceptedCategories().NullOrEmpty() )
     {
         foreach( var category in exceptionFilter.ExceptedCategories() )
         {
             var categoryDef = DefDatabase<ThingCategoryDef>.GetNamed( category, true );
             foreach( var hopperSetting in hopperSettings )
             {
                 hopperSetting.settings.filter.SetAllow( categoryDef, false );
             }
         }
     }
     if( !exceptionFilter.ExceptedThingDefs().NullOrEmpty() )
     {
         foreach( var thingDef in exceptionFilter.ExceptedThingDefs() )
         {
             foreach( var hopperSetting in hopperSettings )
             {
                 hopperSetting.settings.filter.SetAllow( thingDef, false );
             }
         }
     }
 }