Esempio n. 1
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            base.DoSettingsWindowContents(inRect);

            ToggleableSpawnDef toggleablespawndef = (from k in DefDatabase <ToggleableSpawnDef> .AllDefsListForReading
                                                     where k.defName == "AA_ToggleableAnimals"
                                                     select k).RandomElement();


            if (settings.pawnSpawnStates == null)
            {
                settings.pawnSpawnStates = new Dictionary <string, bool>();
            }
            foreach (string defName in toggleablespawndef.toggleablePawns)
            {
                if (!settings.pawnSpawnStates.ContainsKey(defName) && DefDatabase <ThingDef> .GetNamedSilentFail(defName) != null)
                {
                    settings.pawnSpawnStates[defName] = false;
                }
            }



            settings.DoWindowContents(inRect);
        }
Esempio n. 2
0
        public static bool DetectAlphaCreatureAndOptions(PawnKindDef theCreature)
        {
            if (theCreature != null)
            {
                if (!AlphaAnimals_Mod.settings.flagVanillaAnimals)
                {
                    ToggleableSpawnDef toggleablespawndef = (from k in DefDatabase <ToggleableSpawnDef> .AllDefsListForReading
                                                             where k.defName == "AA_VanillaAnimalToggles"
                                                             select k).RandomElement();
                    if (toggleablespawndef.toggleablePawns.Contains(theCreature.defName))
                    {
                        return(true);
                    }
                }



                if (AlphaAnimals_Mod.settings.pawnSpawnStates != null && AlphaAnimals_Mod.settings.pawnSpawnStates.Keys.Contains(theCreature.defName))
                {
                    if (AlphaAnimals_Mod.settings.pawnSpawnStates[theCreature.defName])
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }