Esempio n. 1
0
 public override void PostDraw()
 {
     if (cpawn.needs.TryGetNeed <Need_Soul>() == null)
     {
         //Log.Message("NoNeed");
         HarmonyPatches.CreateNewSoul(cpawn);
     }
     if (cpawn.needs.TryGetNeed <Need_Soul>().NoPatron)
     {
         return;
     }
     if (cpawn.needs.TryGetNeed <Need_Soul>().patronInfo.PatronName != "Slaanesh" || cpawn.needs.TryGetNeed <Need_Soul>().patronInfo.PatronName != "Undivided")
     {
         this.DrawOverlays(PatronName, cpawn);
     }
 }
Esempio n. 2
0
 public static void CanGetThoughtPostfix(ThoughtDef def, SituationalThoughtHandler __instance, ref bool __result)
 {
     if (__result)
     {
         try
         {
             Need_Soul soul;
             if (HarmonyPatches.HasSoulTraitNullyfyingTraits(def, __instance.pawn, out soul))
             {
                 __result = false;
                 return;
             }
             ThoughtDefCorruption Tdef = def as ThoughtDefCorruption;
             if (Tdef != null)
             {
                 if (IsAutomaton(__instance.pawn))
                 {
                     if (Tdef.IsAutomatonThought)
                     {
                         return;
                     }
                     else
                     {
                         __result = false;
                         return;
                     }
                 }
                 if (!Tdef.requiredSoulTraits.NullOrEmpty())
                 {
                     for (int i = 0; i < soul.SoulTraits.Count; i++)
                     {
                         if (!Tdef.requiredSoulTraits.Contains(soul.SoulTraits[i].SDef))
                         {
                             __result = false;
                         }
                     }
                 }
             }
         }
         finally
         {
             ProfilerThreadCheck.EndSample();
         }
     }
 }
Esempio n. 3
0
        private static bool HasSoulTraitNullyfyingTraits(ThoughtDef def, Pawn p, out Need_Soul soul)
        {
            if (p.needs.TryGetNeed <Need_Soul>() == null)

            {
                HarmonyPatches.CreateNewSoul(p);
            }
            soul = p.needs.TryGetNeed <Need_Soul>();
            List <SoulTrait> straitlist = soul.SoulTraits;

            foreach (SoulTrait strait in straitlist)
            {
                foreach (ThoughtDef tdef in strait.SDef.NullifiesThoughts)
                {
                    if (tdef.defName == def.defName)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }