Ejemplo n.º 1
0
        public static void add_anus(Pawn pawn, Pawn parent = null)
        {
            BodyPartRecord partBPR = Genital_Helper.get_anusBPR(pawn);

            if (partBPR == null)
            {
                //--Log.Message("[RJW] add_anus( " + xxx.get_pawnname(pawn) + " ) doesn't have an anus");
                return;
            }
            else if (pawn.health.hediffSet.PartIsMissing(partBPR))
            {
                //--Log.Message("[RJW] add_anus( " + xxx.get_pawnname(pawn) + " ) had an anus but was removed.");
                return;
            }
            if (Genital_Helper.has_anus(pawn))
            {
                //--Log.Message("[RJW] add_anus( " + xxx.get_pawnname(pawn) + " ) already has an anus");
                return;
            }

            if (pawn.TryAddRacePart(SexPartType.Anus))
            {
                return;
            }

            LegacySexPartAdder.AddAnus(pawn, partBPR, parent);
        }
        //Plant Insect eggs/mech chips/other preg mod hediff?
        public static bool PlantSomething(HediffDef def, Pawn target, bool isToAnal = false, int amount = 1)
        {
            if (def == null)
            {
                return(false);
            }
            if (!isToAnal && !Genital_Helper.has_vagina(target))
            {
                return(false);
            }
            if (isToAnal && !Genital_Helper.has_anus(target))
            {
                return(false);
            }

            BodyPartRecord Part = (isToAnal) ? Genital_Helper.get_anusBPR(target) : Genital_Helper.get_genitalsBPR(target);

            if (Part != null || Part.parts.Count != 0)
            {
                //killoff normal preg
                if (!isToAnal)
                {
                    if (RJWSettings.DevMode)
                    {
                        Log.Message("[RJW] removing other pregnancies");
                    }

                    var preg = GetPregnancy(target);
                    if (preg != null)
                    {
                        if (preg is Hediff_BasePregnancy)
                        {
                            (preg as Hediff_BasePregnancy).Kill();
                        }
                        else
                        {
                            target.health.RemoveHediff(preg);
                        }
                    }
                }

                for (int i = 0; i < amount; i++)
                {
                    if (RJWSettings.DevMode)
                    {
                        Log.Message("[RJW] planting something weird");
                    }
                    target.health.AddHediff(def, Part);
                }

                return(true);
            }
            return(false);
        }