Inheritance: MapComponent, ILoadReferenceable
        public ManagerJob_Foraging( Manager manager )
            : base(manager)
        {
            // all plants that yield something, and it isn't wood.
            AllowedPlants = manager.map.Biome.AllWildPlants
                               .Where( plant => plant.plant.harvestYield > 0 &&
                                                plant.plant.harvestedThingDef != null &&
                                                plant.plant.harvestTag != "Wood" )
                               .ToDictionary( k => k, v => false );

            // add cave world fauna
            List<ThingDef> caveWorldFauna =
                DefDatabase<ThingDef>.AllDefsListForReading.Where(
                                                                  def =>
                                                                  def.plant?.sowTags.Contains( "Fungiponics" ) ?? false )
                                     .ToList();
            foreach ( ThingDef fungus in caveWorldFauna )
            {
                AllowedPlants.Add( fungus, false );
            }

            // populate the trigger field, count all harvested thingdefs from the allowed plant list
            Trigger = new Trigger_Threshold( this );
            Trigger.ThresholdFilter.SetDisallowAll();
            foreach ( ThingDef plant in AllowedPlants.Keys )
            {
                Trigger.ThresholdFilter.SetAllow( plant.plant.harvestedThingDef, true );
            }

            // create History tracker
            History = new History( new[] {"stock", "designated"}, new[] {Color.white, Color.grey} );
        }
 public Dialog_CreateJobsForIngredients( Manager manager, RecipeDef recipe, int count )
 {
     targetCount = count;
     targetRecipe = recipe;
     ingredients = recipe.ingredients.Select( ic => new IngredientSelector( manager, ic, targetCount, recipe ) ).ToList();
     this.manager = manager;
 }
        public ManagerJob_Livestock( Manager manager )
            : base(manager)
        {
            // init designations
            Designations = new List<Designation>();

            // start history tracker
            _history = new History( Utilities_Livestock.AgeSexArray.Select( ageSex => ageSex.ToString() ).ToArray() );

            // set up the trigger, set all target counts to 5
            Trigger = new Trigger_PawnKind( this.manager );

            // set all training to false
            Training = new TrainingTracker();

            // set areas for restriction and taming to unrestricted
            TameArea = null;
            RestrictToArea = false;
            RestrictArea = Utilities_Livestock.AgeSexArray.Select( k => (Area) null ).ToList();

            // set defaults for boolean options
            TryTameMore = false;
            ButcherExcess = true;
            ButcherTrained = false;
        }
 public BillGiverTracker( ManagerJob_Production job )
 {
     manager = job.manager;
     Recipe = job.Bill.recipe;
     _job = job;
     _assignedBills = new Dictionary<Bill_Production, Building_WorkTable>();
     SpecificBillGivers = new List<Building_WorkTable>();
 }
        public ManagerJob_Production( Manager manager, RecipeDef recipe )
            : base(manager)
        {
            Bill = recipe.UsesUnfinishedThing ? new Bill_ProductionWithUft( recipe ) : new Bill_Production( recipe );
            _hasMeaningfulIngredientChoices = Dialog_CreateJobsForIngredients.HasPrerequisiteChoices( manager, recipe );
            MainProduct = new MainProductTracker( Bill.recipe );
            Trigger = new Trigger_Threshold( this );
            BillGivers = new BillGiverTracker( this );

            History = new History( new[] {Trigger.ThresholdFilter.Summary} );
        }
        public ManagerJob_Hunting( Manager manager )
            : base(manager)
        {
            // populate the trigger field, set the root category to meats and allow all but human meat.
            Trigger = new Trigger_Threshold( this );
            Trigger.ThresholdFilter.SetDisallowAll();
            Trigger.ThresholdFilter.SetAllow( Utilities_Hunting.RawMeat, true );
            Trigger.ThresholdFilter.SetAllow( Utilities_Hunting.HumanMeat, false );

            // populate the list of animals from the animals in the biome - allow all by default.
            AllowedAnimals = manager.map.Biome.AllWildAnimals.ToDictionary( pk => pk, v => true );

            History = new History( new[] {"stock", "corpses", "designated"},
                                   new Color[] {Color.white, new Color( .7f, .7f, .7f ), new Color( .4f, .4f, .4f )} );
        }
        public ManagerTab_Power( Manager manager )
            : base(manager)
        {
            // get list of thingdefs set to use the power comps - this should be static throughout the game (barring added mods midgame)
            _traderDefs = GetTraderDefs().ToList();
            _batteryDefs = GetBatteryDefs().ToList();

            // get a dictionary of powercomps actually existing on the map for each thingdef.
            RefreshCompLists();

            // set up the history trackers.
            tradingHistory =
                new History(
                    _traderDefs.Select(
                                       def =>
                                       new ThingCount( def,
                                                       manager.map.listerBuildings.AllBuildingsColonistOfDef( def )
                                                              .Count() ) )
                               .ToArray() )
                {
                    DrawOptions = false,
                    DrawInlineLegend = false,
                    Suffix = "W",
                    DrawInfoInBar = true,
                    DrawMaxMarkers = true
                };

            overallHistory = new History( new[] {"Production", "Consumption", "Batteries"} )
                             {
                                 DrawOptions = false,
                                 DrawInlineLegend = false,
                                 Suffix = "W",
                                 DrawIcons = false,
                                 DrawCounts = false,
                                 DrawInfoInBar = true,
                                 DrawMaxMarkers = true,
                                 MaxPerChapter = true
                             };
        }
        public ManagerJob_Forestry( Manager manager )
            : base(manager)
        {
            // populate the trigger field, set the root category to wood.
            Trigger = new Trigger_Threshold( this );
            Trigger.ThresholdFilter.SetDisallowAll();
            Trigger.ThresholdFilter.SetAllow( Utilities_Forestry.Wood, true );

            // populate the list of trees from the plants in the biome - allow all by default.
            // A tree is defined as any plant that yields wood or has a wood harvesting tag.
            AllowedTrees =
                manager.map.Biome.AllWildPlants.Where(
                                              pd =>
                                              pd.plant.harvestTag == "Wood" ||
                                              pd.plant.harvestedThingDef == Utilities_Forestry.Wood )
                    // add harvesttag to allow non-wood yielding woody plants.
                   .ToDictionary( pk => pk, v => true );

            // initialize clearAreas list with current areas
            UpdateClearAreas();

            History = new History( new[] {"stock", "designated"}, new[] {Color.white, Color.grey} );
        }
 public ManagerTab_Foraging( Manager manager )
     : base(manager)
 {
     _selected = new ManagerJob_Foraging( manager );
 }
 public Trigger( Manager manager ) { this.manager = manager; }
Exemple #11
0
 public ManagerTab_Overview(Manager manager) : base(manager)
 {
 }
Exemple #12
0
        public void DrawOverview(Rect rect)
        {
            if (Jobs.NullOrEmpty())
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                GUI.color   = Color.grey;
                Widgets.Label(rect, "FM.NoJobs".Translate());
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.color   = Color.white;
            }
            else
            {
                Rect viewRect    = rect;
                Rect contentRect = viewRect.AtZero();
                contentRect.height = OverviewHeight;
                if (OverviewHeight > viewRect.height)
                {
                    contentRect.width -= ScrollbarWidth;
                }

                GUI.BeginGroup(viewRect);
                Widgets.BeginScrollView(viewRect, ref _overviewScrollPosition, contentRect);

                Vector2 cur = Vector2.zero;

                for (var i = 0; i < Jobs.Count; i++)
                {
                    var row = new Rect(cur.x, cur.y, contentRect.width, 50f);

                    // highlights
                    if (i % 2 == 1)
                    {
                        Widgets.DrawAltRect(row);
                    }
                    if (Jobs[i] == Selected)
                    {
                        Widgets.DrawHighlightSelected(row);
                    }

                    // go to job icon
                    var iconRect = new Rect(Margin, row.yMin + (LargeListEntryHeight - LargeIconSize) / 2, LargeIconSize, LargeIconSize);
                    if (Widgets.ButtonImage(iconRect, Jobs[i].Tab.Icon))
                    {
                        MainTabWindow_Manager.GoTo(Jobs[i].Tab, Jobs[i]);
                    }

                    // order buttons
                    DrawOrderButtons(new Rect(row.xMax - 50f, row.yMin, 50f, 50f), Manager.For(manager), Jobs[i]);

                    // job specific overview.
                    Rect jobRect = row;
                    jobRect.width -= LargeListEntryHeight + LargeIconSize + 2 * Margin; // - (a + b)?
                    jobRect.x     += LargeIconSize + 2 * Margin;
                    Jobs[i].DrawListEntry(jobRect, true, true);
                    Widgets.DrawHighlightIfMouseover(row);
                    if (Widgets.ButtonInvisible(jobRect))
                    {
                        Selected = Jobs[i];
                    }

                    cur.y += 50f;
                }

                Widgets.EndScrollView();
                GUI.EndGroup();

                OverviewHeight = cur.y;
            }
        }
 public ManagerTab_Livestock( Manager manager )
     : base(manager)
 {
 }
 public ManagerJob_Trading( Manager manager )
     : base(manager)
 {
 }
 public ManagerTab( Manager manager )
 {
     this.manager = manager;
 }
            public RecipeDef targetRecipe; // the parent recipe itself.

            #endregion Fields

            #region Constructors

            public IngredientSelector( Manager manager, IngredientCount ingredient, int count, RecipeDef targetRecipe )
            {
                // set up vars
                this.ingredient = ingredient;
                this.targetRecipe = targetRecipe;
                this.manager = manager;
                targetCount = (int) Math.Sqrt( count ) * (int) ingredient.GetBaseCount();
                allowedThingDefs = ingredient.filter.AllowedThingDefs.ToList();

                // if there's only one allowed we don't need to manually choose.
                if ( allowedThingDefs.Count == 1 )
                {
                    recipeSelector = new RecipeSelector( manager, allowedThingDefs.First(), targetCount );
                }
            }
 public Trigger_PawnKind( Manager manager )
     : base(manager)
 {
     CountTargets = Utilities_Livestock.AgeSexArray.ToDictionary( k => k, v => 5 );
 }
        // copypasta from AutoEquip.
        public static Manager For( Map map )
        {
            var instance = map.GetComponent<Manager>();
            if ( instance != null )
                return instance;

            instance = new Manager( map );
            map.components.Add( instance );
            return instance;
        }
 public ManagerTab_Production( Manager manager )
     : base(manager)
 {
 }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell));

            var manage = Manage(TargetIndex.A);

            yield return(manage);

            // if made to by player, keep doing that untill we're out of jobs
            yield return(Toils_Jump.JumpIf(manage, () => GetActor().CurJob.playerForced&& Manager.For(Map).JobStack.NextJob != null));
        }
 // set defaults
 public ManagerJob_Livestock( PawnKindDef pawnKindDef, Manager manager )
     : this(manager)
 {
     // set pawnkind and get list of current colonist pawns of that def.
     Trigger.pawnKind = pawnKindDef;
 }
            public RecipeSelector( Manager manager, ThingDef thingDef, int count )
            {
                target = thingDef;
                targetCount = count;
                this.manager = manager;
                newCount = count.ToString();

                recipes = GetRecipesFor( manager, thingDef );
            }
Exemple #23
0
 public ManagerTab_Mining(Manager manager) : base(manager)
 {
     _selected = new ManagerJob_Mining(manager);
 }
 public ManagerTab_ImportExport( Manager manager )
     : base(manager)
 {
 }