Exemplo n.º 1
0
        public static void updateFactionOnPlanet()
        {
            FactionFC worldcomp = Find.World.GetComponent <FactionFC>();
            Faction   faction1  = FactionColonies.getPlayerColonyFaction();

            //Log.Message((faction1 != null).ToString());
            if (faction1 == null && worldcomp.factionCreated == true)
            {
                Log.Message("Moved to new planet - Adding faction copy");
                //FactionColonies.createPlayerColonyFaction();
                FactionColonies.copyPlayerColonyFaction();
                faction1 = FactionColonies.getPlayerColonyFaction();
            }
            //Log.Message(((bool)(faction1 != null)).ToString());
            foreach (Faction factionOther in Find.FactionManager.AllFactionsListForReading)
            {
                //Log.Message(factionOther.def.defName);
                if (factionOther != faction1 && faction1.RelationWith(factionOther, true) == null)
                {
                    faction1.TryMakeInitialRelationsWith(factionOther);
                }
            }
            worldcomp.updateFactionIcon(ref faction1, "FactionIcons/" + worldcomp.factionIconPath);
            worldcomp.factionUpdated = true;
            //foreach (SettlementFC settlement in worldcomp.settlements)
            //{
            //    Settlement obj = Find.WorldObjects.SettlementAt(settlement.mapLocation);
            //    if (obj != null && obj.Faction != faction1)
            //    {
            //        obj.SetFaction(faction1);
            //    }
            //}
        }