public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Values.Look(ref factionCount, "factionCount", 6f);
            Scribe_Values.Look(ref outlanderCivilMin, "outlanderCivilMin", 1f);
            Scribe_Values.Look(ref outlanderHostileMin, "outlanderHostileMin", 1f);
            Scribe_Values.Look(ref tribalCivilMin, "tribalCivilMin", 1f);
            Scribe_Values.Look(ref tribalHostileMin, "tribalHostileMin", 1f);
            Scribe_Values.Look(ref tribalSavageMin, "tribalSavageMin", 1f);
            Scribe_Values.Look(ref pirateMin, "pirateMin", 1f);
            Scribe_Values.Look(ref empireMin, "empireMin", 1f);
            SetIncidents.SetIncidentLevels();

            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                if (factionCount < 0)
                {
                    if (ModsConfig.RoyaltyActive)
                    {
                        factionCount = 6f;
                    }
                    else
                    {
                        factionCount = 5f;
                    }
                }
            }

            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                strFacCnt = ((int)factionCount).ToString();
                strOutCiv = ((int)outlanderCivilMin).ToString();
                strOutHos = ((int)outlanderHostileMin).ToString();
                strTriCiv = ((int)tribalCivilMin).ToString();
                strTriHos = ((int)tribalHostileMin).ToString();
                strTriSav = ((int)tribalSavageMin).ToString();
                strPir    = ((int)pirateMin).ToString();
                strEmp    = ((int)empireMin).ToString();
            }
        }
Exemplo n.º 2
0
        public override void ExposeData()
        {
            base.ExposeData();
            Scribe_Values.Look(ref factionGrouping, "factionGrouping", 0.5f);
            Scribe_Values.Look(ref factionDensity, "factionDensity", 2.5f);
            Scribe_Values.Look(ref allowMechanoids, "allowMechanoids", true);
            Scribe_Values.Look(ref randomGoodwill, "randomGoodwill", true);
            Scribe_Values.Look(ref dynamicColors, "dynamicColors", true);
            Scribe_Values.Look(ref spreadPirates, "spreadPirates", true);
            Scribe_Values.Look(ref relationsChangeOverTime, "relationsChangeOverTime", true);

            if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                float v = 0;
                Scribe_Values.Look(ref v, "factionCount");
            }

            if (Scribe.mode == LoadSaveMode.PostLoadInit)
            {
                this.strFacDen = ((int)this.factionDensity).ToString();
            }

            SetIncidents.SetIncidentLevels();
        }
        private static void Init()
        {
            Settings_ModdedFactions.VerifyCustomFactions();

            List <CustomFaction> loaded = new List <CustomFaction>();

            foreach (FactionDef def in DefDatabase <FactionDef> .AllDefs)
            {
                if (def.isPlayer)
                {
                    continue;
                }

                switch (def.defName)
                {
                case "Ancients":
                case "AncientsHostile":
                case "Mechanoid":
                case "Insect":
                case "OutlanderCivil":
                case "OutlanderRough":
                case "TribeCivil":
                case "TribeRough":
                case "TribeSavage":
                case "Pirate":
                case "Empire":
                    continue;

                default:
                    CustomFaction cf = new CustomFaction
                    {
                        FactionDef           = def,
                        RequiredCountDefault = def.requiredCountAtGameStart,
                        RequiredCount        = def.requiredCountAtGameStart,
                        MaxCountAtStart      = def.maxCountAtGameStart
                    };

                    bool contains = false;
                    foreach (CustomFaction f in Main.CustomFactions)
                    {
                        if (f.FactionDef == def)
                        {
                            f.MaxCountAtStart      = def.maxCountAtGameStart;
                            f.RequiredCountDefault = def.requiredCountAtGameStart;
                            if (f.RequiredCount == -1)
                            {
                                f.RequiredCount = def.requiredCountAtGameStart;
                            }
                            contains = true;
                            break;
                        }
                    }
                    loaded.Add(cf);
                    if (!contains)
                    {
                        Main.CustomFactions.Add(cf);
                    }
                    break;
                }
            }

            for (int i = CustomFactions.Count - 1; i >= 0; --i)
            {
                if (!loaded.Contains(CustomFactions[i]))
                {
                    CustomFactions.RemoveAt(i);
                }
            }
            SetIncidents.SetIncidentLevels();

            loaded.Clear();
            loaded = null;
        }
 static void Prefix()
 {
     SetIncidents.SetIncidentLevels();
 }