Beispiel #1
0
            static public void Postfix(ref int __result, CompShearable __instance)
            {
                if (!Genes.EffectsThing(__instance.parent))
                {
                    return;
                }

                __result = (int)(__result * Genes.GetGene((Pawn)(__instance.parent), AnimalGenetics.GatherYield));
            }
        public static string AnimalImportantInfo(Pawn p, bool gender = false)
        {
            String e = "";

            if (!Settings.trade_tags)
            {
                return(e);
            }

            // M/F
            if (gender && p.RaceProps.hasGenders)
            {
                if (e.Length > 0)
                {
                    e += ";";
                }
                e += p.gender.ToString().Substring(0, 1);
            }

            // [T]rained
            if (p.training != null)
            {
                int trained = 0;
                foreach (TrainableDef current2 in DefDatabase <TrainableDef> .AllDefs)
                {
                    if (p.training.HasLearned(current2))
                    {
                        trained++;
                    }
                }
                if (trained > 0)
                {
                    if (e.Length > 0)
                    {
                        e += ";";
                    }
                    e += "T" + trained;
                }
            }

            // [W]ool
            CompShearable wool = p.TryGetComp <CompShearable>();

            if (wool != null && wool.Fullness > 0.05)
            {
                if (e.Length > 0)
                {
                    e += ";";
                }
                e += "W" + wool.Fullness.ToStringPercent();
            }

            return(e);
        }
Beispiel #3
0
        public static void ForceWool(Pawn p)
        {
            CompShearable compShearable = p.TryGetComp <CompShearable>();

            if (compShearable != null)
            {
                while (compShearable.Fullness < 1)
                {
                    compShearable.CompTick();
                }
                DebugActionsUtility.DustPuffFrom(p);
            }
        }
        public static string AnimalImportantInfo(Pawn p, bool gender = false)
        {
            String e = "";

            // M/F
            if (gender && p.RaceProps.hasGenders)
            {
                if (e.Length > 0)
                {
                    e += ";";
                }
                e += p.gender.ToString().Substring(0, 1);
            }

            // [T]rained
            if (p.training != null)
            {
                int trained = 0;
                foreach (TrainableDef current2 in DefDatabase <TrainableDef> .AllDefs)
                {
                    if (p.training.HasLearned(current2))
                    {
                        trained++;
                    }
                }
                if (trained > 0)
                {
                    if (e.Length > 0)
                    {
                        e += ";";
                    }
                    e += "T" + trained;
                }
            }

            // [P]regnant
            if (p.health.hediffSet.HasHediff(HediffDefOf.Pregnant))
            {
                Hediff_Pregnant hediff_Pregnant = (Hediff_Pregnant)p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Pregnant);
                if (hediff_Pregnant.Visible)
                {
                    if (e.Length > 0)
                    {
                        e += ";";
                    }
                    e += "P" + hediff_Pregnant.GestationProgress.ToStringPercent();
                }
            }

            // [W]ool
            CompShearable wool = p.TryGetComp <CompShearable>();

            if (wool != null && wool.Fullness > 0.05)
            {
                if (e.Length > 0)
                {
                    e += ";";
                }
                e += "W" + wool.Fullness.ToStringPercent();
            }

            return(e);
        }