Esempio n. 1
0
            public Command_SplitOffSubpart(CompIncludedChildParts comp)
            {
                this.comp = comp;

                // use same icon as thing it belongs to
                this.icon      = comp.parent.def.uiIcon;
                this.iconAngle = comp.parent.def.uiIconAngle;

                this.defaultLabel = "Remove sub-part";
                this.defaultDesc  = "Chose a part to remove from this one's subparts.";
            }
            public Command_AddExistingSubpart(CompIncludedChildParts comp)
            {
                this.comp = comp;

                // use same icon as thing it belongs to
                this.icon      = comp.parent.def.uiIcon;
                this.iconAngle = comp.parent.def.uiIconAngle;

                this.defaultLabel = "Add sub-part";
                this.defaultDesc  = "Chose a part to add to this one's sub-parts.";
            }
Esempio n. 3
0
        /// <summary>
        /// Recursively installs the included parts, or drops them when possible
        /// </summary>
        /// <param name="compChildParts">Where to get the parts to install</param>
        public static void RecursiveInstallation(this CompIncludedChildParts compChildParts, Pawn pawn, BodyPartRecord part)
        {
            List <BodyPartRecord> partsToConsider = new List <BodyPartRecord>(part.GetDirectChildParts().Append(part));

            // iterate over included child things
            foreach (Thing childThing in compChildParts.IncludedParts)
            {
                if (TryGetRecipeAndPart(pawn, childThing.def, partsToConsider.Contains, out RecipeDef recipe, out BodyPartRecord bpr))
                {
                    // apply the recipe
                    recipe.Worker.ApplyOnPawn(pawn, bpr, null, new List <Thing> {
                        childThing
                    }, null);

                    partsToConsider.Remove(bpr);
                }