예제 #1
0
        /// <summary>
        /// operation - move part data from thing to hediff
        /// </summary>
        public static Hediff recipePartAdder(RecipeDef recipe, Pawn pawn, BodyPartRecord part, List <Thing> ingredients)
        {
            Hediff hd    = HediffMaker.MakeHediff(recipe.addsHediff, pawn, part);
            Thing  thing = ingredients.Find(x => x.def.defName == recipe.addsHediff.defName);

            CompThingBodyPart  CompThing  = thing.TryGetComp <rjw.CompThingBodyPart>();
            CompHediffBodyPart CompHediff = hd.TryGetComp <rjw.CompHediffBodyPart>();

            if (CompHediff != null && CompThing != null)
            {
                if (CompThing.SizeBase > 0)
                {
                    CompHediff.FluidType     = CompThing.FluidType;
                    CompHediff.FluidAmmount  = CompThing.FluidAmmount;
                    CompHediff.FluidModifier = CompThing.FluidModifier;
                    CompHediff.SizeBase      = CompThing.SizeBase;
                    CompHediff.SizeOwner     = CompThing.SizeOwner;
                    CompHediff.RaceOwner     = CompThing.RaceOwner;
                    CompHediff.PreviousOwner = CompThing.PreviousOwner;
                    CompHediff.Eggs          = CompThing.Eggs;
                    CompHediff.updatesize();
                }
                else                  //not initialised things, drop pods, trader?  //TODO: figure out how to populate rjw parts at gen
                {
                    hd = MakePart(hd.def, pawn, part);
                }
            }

            return(hd);
        }
예제 #2
0
        /// <summary>
        /// operation - move part data from hediff to thing
        /// </summary>
        public static Thing recipePartRemover(Hediff hd)
        {
            Thing thing = ThingMaker.MakeThing(hd.def.spawnThingOnRemoved);

            CompThingBodyPart  CompThing  = thing.TryGetComp <rjw.CompThingBodyPart>();
            CompHediffBodyPart CompHediff = hd.TryGetComp <rjw.CompHediffBodyPart>();

            if (CompThing != null && CompHediff != null)
            {
                CompThing.FluidType     = CompHediff.FluidType;
                CompThing.FluidAmmount  = CompHediff.FluidAmmount;
                CompThing.FluidModifier = CompHediff.FluidModifier;
                CompThing.Size          = CompHediff.Size;
                CompThing.SizeBase      = CompHediff.SizeBase;
                CompThing.SizeOwner     = CompHediff.SizeOwner;
                CompThing.RaceOwner     = CompHediff.RaceOwner;
                CompThing.PreviousOwner = xxx.get_pawnname(CompHediff.Pawn);
                CompThing.Eggs          = CompHediff.Eggs;
            }
            return(thing);
        }