Exemplo n.º 1
0
        private void GenerateLoot(Verse.Map map)
        {
            int itemsCount = Rand.Range(minSupply, maxSupply);

            for (int i = 0; i < itemsCount; i++)
            {
                Building_Container thingContainer = (Building_Container)ThingMaker.MakeThing(ThingDefOfLocal.OpenableContainer);

                IntVec3 pos = map.AllCells.Where(vec => !vec.Fogged(map)).RandomElement();
                if (pos == null)
                {
                    continue;
                }

                GenerateApparels(map, thingContainer);

                GenerateWeapons(map, thingContainer);

                if (thingContainer.items.Count == 0)
                {
                    if (Rand.Chance(0.20f))
                    {
                        GenerateWeapons(map, thingContainer);
                    }
                }

                GenSpawn.Spawn(thingContainer, pos, map);
            }
        }
Exemplo n.º 2
0
        public Dangerous_AlreadyStand(float threatPoints, Faction faction, Verse.Map map, int maxGroups, int maxPawnsInGroup)
        {
            this.maxGroups       = maxGroups;
            this.maxPawnsInGroup = maxPawnsInGroup;

            SpawnEnemies(threatPoints, faction, map);
        }
Exemplo n.º 3
0
        public void DoEnter(Caravan caravan)
        {
            Pawn t     = caravan.PawnsListForReading[0];
            bool flag2 = !mapParent.HasMap;

            Verse.Map orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(mapParent.Tile, MapSize, null);
            foreach (var a in orGenerateMap.areaManager.AllAreas)
            {
                Log.Message($"AREA --> {a.Label} --> {a} --> {a.TrueCount}");
            }
            if (flag2)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, generator.ExpandLabel).CapitalizeFirst());
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredShipCrash")} {generator.ExpandLabel}", stringBuilder.ToString(), LetterDefOf.NeutralEvent);
            }
            else
            {
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredShipCrash")} {generator.ExpandLabel}", "LetterCaravanEnteredMap".Translate(caravan.Label, generator.ExpandLabel).CapitalizeFirst(), LetterDefOf.NeutralEvent, t);
            }
            Verse.Map        map       = orGenerateMap;
            CaravanEnterMode enterMode = CaravanEnterMode.Edge;

            CaravanEnterMapUtility.Enter(caravan, map, enterMode, CaravanDropInventoryMode.DoNotDrop);
        }
        public override void DoEnter(Caravan caravan)
        {
            Pawn t     = caravan.PawnsListForReading[0];
            bool flag2 = !MapParent.HasMap;

            Verse.Map orGenerateMap = GetOrGenerateMap(MapParent.Tile, MapSize, null);
            if (flag2)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, Site).CapitalizeFirst());
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredMassiveFire")} {Site.Label}", stringBuilder.ToString(), LetterDefOf.NeutralEvent);
            }
            else
            {
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredMassiveFire")} {Site.Label}", "LetterCaravanEnteredMap".Translate(caravan.Label, Site).CapitalizeFirst(), LetterDefOf.NeutralEvent, t);
            }
            Verse.Map map      = orGenerateMap;
            IntVec3   enterPos = new IntVec3(82, 0, 5);

            CaravanEnterMapUtility.Enter(caravan, map, (Pawn p) => enterPos);

            DoomsdaySite site = (DoomsdaySite)MapParent;
            var          comp = site.GetComponent <DoomsdayUltimatumComp>();

            if (comp.HelpingFactions != null)
            {
                CacheAndChangeRelations(comp);

                GeneratePawns(comp, ref enterPos, map);
            }
        }
Exemplo n.º 5
0
        public override void RunGenerator(ShipCrashWorker main, Verse.Map map, Faction owner)
        {
            this.main = main;

            GenerateLoot(map);

            GenerateDangerous(map, owner);
        }
Exemplo n.º 6
0
        private void GenerateItems(Verse.Map map)
        {
            List <ThingDef> items = new List <ThingDef>();

            foreach (var thing in DefDatabase <ThingDef> .AllDefs)
            {
                if (thing.category == ThingCategory.Item)
                {
                    if (thing.thingCategories != null)
                    {
                        if (thing.thingCategories.Contains(ThingCategoryDefOf.ResourcesRaw))
                        {
                            items.Add(thing);
                        }
                    }
                }
            }

            if (items.Count == 0)
            {
                return;
            }

            int itemsCount = Rand.Range(minSupply, maxSupply);

            for (int i = 0; i < itemsCount; i++)
            {
                IntVec3 pos = map.AllCells.Where(vec => !vec.Fogged(map)).RandomElement();
                if (pos == null)
                {
                    continue;
                }

                int count = Rand.Range(1, 4);

                Building_Container thingContainer = (Building_Container)ThingMaker.MakeThing(ThingDefOfLocal.OpenableContainer);
                for (int i2 = 0; i2 < count; i2++)
                {
                    ThingDef item = items.RandomElement();

                    int maxCount = 30;
                    if (item.BaseMarketValue >= 5)
                    {
                        maxCount = 10;
                    }
                    if (item.BaseMarketValue > 8)
                    {
                        maxCount = 15;
                    }

                    int itemCount = Rand.Range(6, maxCount);
                    thingContainer.AddItem(item, itemCount);
                    dangerousLevel += (item.BaseMarketValue * itemCount) * 0.5f;
                }

                GenSpawn.Spawn(thingContainer, pos, map);
            }
        }
Exemplo n.º 7
0
        public override void RunGenerator(ShipCrashWorker main, Verse.Map map, Faction owner)
        {
            this.main = main;

            GenerateItems(map);

            if (dangerous)
            {
                GenerateDangerous(owner, map);
            }
        }
Exemplo n.º 8
0
        public Dangerous_HiddenAttack(int ticksBeforeAttack, float threatPoints, Faction faction, Verse.Map map, int maxPawns = -1)
        {
            ticks      = ticksBeforeAttack;
            startTimer = true;

            this.points  = threatPoints;
            this.faction = faction;
            this.map     = map;

            this.maxPawns = maxPawns;
        }
Exemplo n.º 9
0
 private void GenerateDangerous(Faction owner, Verse.Map map)
 {
     if (Rand.Chance(0.3f))
     {
         Dangerous_HiddenAttack dang = new Dangerous_HiddenAttack(Rand.Range(8000, 15000), dangerousLevel, owner, map, 30);
         main.parent.AllComps.Add(dang);
     }
     else
     {
         Dangerous_AlreadyStand dang = new Dangerous_AlreadyStand(dangerousLevel, owner, map, 4, 6);
     }
 }
        public void DoEnter(Caravan caravan)
        {
            Pawn t     = caravan.PawnsListForReading[0];
            bool flag2 = !mapParent.HasMap;

            Verse.Map map = GetOrGenerateMap(mapParent.Tile, MapSize, null);
            Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
            Find.LetterStack.ReceiveLetter("Quest_MissingPeople_EnterToMapTitle".Translate(), "Quest_MissingPeople_EnterToMap".Translate(), LetterDefOf.NeutralEvent);

            CaravanEnterMode enterMode = CaravanEnterMode.Edge;

            CaravanEnterMapUtility.Enter(caravan, map, enterMode, CaravanDropInventoryMode.DoNotDrop);

            Quest.UnlimitedTime = true;
        }
Exemplo n.º 11
0
        private void GenerateApparels(Verse.Map map, Building_Container thingContainer)
        {
            List <ThingDef> items = new List <ThingDef>();

            foreach (var thing in DefDatabase <ThingDef> .AllDefs)
            {
                if (thing.category == ThingCategory.Item)
                {
                    if (thing.thingCategories != null)
                    {
                        if (thing.thingCategories.Contains(ThingCategoryDefOf.Apparel))
                        {
                            items.Add(thing);
                        }
                    }
                }
            }

            if (items.Count == 0)
            {
                return;
            }

            int count = Rand.Range(0, 3);

            if (count == 0)
            {
                return;
            }

            for (int i2 = 0; i2 < count; i2++)
            {
                ThingDef item  = items.RandomElement();
                Thing    item2 = ThingMaker.MakeThing(item, GenStuff.RandomStuffFor(item));
                if (Rand.Chance(0.08f))
                {
                    item2.TryGetComp <CompQuality>()?.SetQuality(QualityCategory.Legendary, ArtGenerationContext.Colony);
                }
                else
                {
                    int val = Rand.Range(0, 5);
                    item2.TryGetComp <CompQuality>()?.SetQuality((QualityCategory)val, ArtGenerationContext.Colony);
                }

                thingContainer.AddItem(item2);
                dangerousLevel += item2.MarketValue;
            }
        }
Exemplo n.º 12
0
 private void GenerateDangerous(Verse.Map map, Faction owner)
 {
     if (Rand.Chance(0.23f))
     {
         Dangerous_HiddenFlyAttack dang = new Dangerous_HiddenFlyAttack(Rand.Range(3500, 10000), dangerousLevel, owner, map, Rand.Range(5, 10), Rand.Range(14, 25), 30);
         main.parent.AllComps.Add(dang);
     }
     else if (Rand.Chance(0.32f))
     {
         Dangerous_HiddenAttack dang = new Dangerous_HiddenAttack(Rand.Range(8000, 10000), dangerousLevel, owner, map, 30);
         main.parent.AllComps.Add(dang);
     }
     else
     {
         Dangerous_AlreadyStand dang = new Dangerous_AlreadyStand(dangerousLevel, owner, map, 8, 10);
     }
 }
Exemplo n.º 13
0
        private void GenerateDangerous(Verse.Map map, Faction owner)
        {
            if (dangerousLevel < 3000f)
            {
                dangerousLevel *= 1.24f;
            }

            if (Rand.Chance(0.5f))
            {
                Dangerous_HiddenAttack dang = new Dangerous_HiddenAttack(Rand.Range(7500, 14000), dangerousLevel, owner, map, 20);
                dang.parent = main.parent;
                main.parent.AllComps.Add(dang);
            }
            else
            {
                Dangerous_AlreadyStand dang = new Dangerous_AlreadyStand(dangerousLevel, owner, map, 5, 8);
            }
        }
Exemplo n.º 14
0
        private Command LeaveCommand(Verse.Map map)
        {
            Command_Action command = new Command_Action();

            command.defaultLabel = Translator.Translate("ShipSite_LeaveCommandLabel");
            command.defaultDesc  = Translator.Translate("ShipSite_LeaveCommandDesc");
            command.icon         = ContentFinder <Texture2D> .Get("Map/leaving-queue");

            command.action = delegate
            {
                ForceReform(this);
            };

            if (map.mapPawns.FreeColonistsCount == 0)
            {
                command.Disable();
            }

            return(command);
        }
Exemplo n.º 15
0
        private void GenerateLoot(Verse.Map map, Faction owner)
        {
            List <ThingDef> items = new List <ThingDef>();

            foreach (var thing in DefDatabase <ThingDef> .AllDefs)
            {
                if (thing.category == ThingCategory.Item)
                {
                    if (thing.thingCategories != null)
                    {
                        if (thing.thingCategories.Contains(ThingCategoryDefOf.Foods) ||
                            thing.thingCategories.Contains(ThingCategoryDefOf.Medicine))
                        {
                            items.Add(thing);
                        }
                    }
                }
            }

            if (items.Count == 0)
            {
                return;
            }

            int itemsCount = Rand.Range(minSupply, maxSupply);

            for (int i = 0; i < itemsCount; i++)
            {
                IntVec3 pos = map.AllCells.Where(vec => !vec.Fogged(map)).RandomElement();
                if (pos == null)
                {
                    continue;
                }

                Building_Container thingContainer = (Building_Container)ThingMaker.MakeThing(ThingDefOfLocal.OpenableContainer);
                GenerateItems(thingContainer, items);
                GeneratePawns(thingContainer, owner);

                GenSpawn.Spawn(thingContainer, pos, map);
            }
        }
        public virtual void DoEnter(Caravan caravan)
        {
            Pawn t     = caravan.PawnsListForReading[0];
            bool flag2 = !mapParent.HasMap;

            Verse.Map orGenerateMap = GetOrGenerateMap(mapParent.Tile, MapSize, null);
            if (flag2)
            {
                Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
                PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, questSite.Label).CapitalizeFirst());
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredMassiveFire")} {questSite.Label}", stringBuilder.ToString(), LetterDefOf.NeutralEvent);
            }
            else
            {
                Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredMassiveFire")} {questSite.Label}", "LetterCaravanEnteredMap".Translate(caravan.Label, questSite.Label).CapitalizeFirst(), LetterDefOf.NeutralEvent, t);
            }
            Verse.Map map = orGenerateMap;

            CaravanEnter(caravan, map);
        }
Exemplo n.º 17
0
        public virtual void DoEnter(Caravan caravan, MapParent mapParent)
        {
            Pawn t = caravan.PawnsListForReading[0];

            Verse.Map orGenerateMap = GetOrGenerateMap(Tile, GetMapSize(), mapParent, null);
            Find.TickManager.Notify_GeneratedPotentiallyHostileMap();
            PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(orGenerateMap.mapPawns.AllPawns, "LetterRelatedPawnsSite".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent, informEvenIfSeenBefore: true);
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("LetterCaravanEnteredMap".Translate(caravan.Label, "EnteredToRandomPlace".Translate()).CapitalizeFirst());
            Find.LetterStack.ReceiveLetter($"{Translator.Translate("CaravanEnteredMassiveFire")} {"EnteredToRandomPlace".Translate()}", stringBuilder.ToString(), LetterDefOf.NeutralEvent);
            CaravanEnterMode enterMode = CaravanEnterMode.Edge;

            if (RandomPlaceDef.UseMapSpawnSpot)
            {
                CaravanEnterMapUtility.Enter(caravan, orGenerateMap, (Pawn p) => RandomPlaceDef.Map.PawnsSpawnPos, CaravanDropInventoryMode.DoNotDrop);
            }
            else
            {
                CaravanEnterMapUtility.Enter(caravan, orGenerateMap, enterMode, CaravanDropInventoryMode.DoNotDrop);
            }
        }
        private static void Postfix(UnityEngine.Rect rect, Verse.Pawn colonist, Verse.Map pawnMap, bool highlight, bool reordering)
        {
            CompBadge cb = colonist.GetComp <CompBadge>();

            if (cb == null)
            {
                return;
            }

            float iwidth = ICON_WIDTH;

            switch (Settings.badgeSize)
            {
            case Settings.BadgeSize.Small:
                iwidth = iwidth - 10f;
                break;

            case Settings.BadgeSize.Large:
                iwidth = iwidth + 10f;
                break;
            }
            float iwidth_half   = iwidth / 2.0f;
            float ibottommargin = iwidth_half;

            // default position is Top, adjust starting from this
            if (cb.badges[0] != "")
            {
                Rect brect = new Rect(rect.x - iwidth_half, rect.y - iwidth_half, iwidth, iwidth);
                switch (Settings.badgePosition)
                {
                case Settings.BadgePosition.Bottom:
                    brect.y += rect.height - ibottommargin;
                    break;

                case Settings.BadgePosition.Right:
                    brect.x += rect.width;
                    break;
                }
                GUI.DrawTexture(brect, DefDatabase <BadgeDef> .GetNamed(cb.badges[0]).Symbol, ScaleMode.ScaleToFit);
            }

            if (cb.badges[1] != "")
            {
                Rect brect = new Rect(rect.xMax - iwidth_half, rect.y - iwidth_half, iwidth, iwidth);
                switch (Settings.badgePosition)
                {
                case Settings.BadgePosition.Bottom:
                    brect.y += rect.height - ibottommargin;
                    break;

                case Settings.BadgePosition.Left:
                    brect.x -= rect.width;
                    brect.y += rect.height - ibottommargin;
                    break;

                case Settings.BadgePosition.Right:
                    brect.y += rect.height - ibottommargin;
                    break;
                }
                GUI.DrawTexture(brect, DefDatabase <BadgeDef> .GetNamed(cb.badges[1]).Symbol, ScaleMode.ScaleToFit);
            }
        }
Exemplo n.º 19
0
 public MapCellsInRandomOrder(Map map)
 {
     this.map = map;
 }
		private static void PassPawnsToWorld(Map map)
		{
			List<Pawn> list = new List<Pawn>();
			List<Pawn> list2 = new List<Pawn>();
			bool flag = map.ParentFaction != null && map.ParentFaction.HostileTo(Faction.OfPlayer);
			List<Pawn> list3 = map.mapPawns.AllPawns.ToList<Pawn>();
			for (int i = 0; i < list3.Count; i++)
			{
				Find.Storyteller.Notify_PawnEvent(list3[i], AdaptationEvent.LostBecauseMapClosed, null);
				try
				{
					Pawn pawn = list3[i];
					if (pawn.Spawned)
					{
						pawn.DeSpawn(DestroyMode.Vanish);
					}
					if (pawn.IsColonist && flag)
					{
						list.Add(pawn);
						map.ParentFaction.kidnapped.KidnapPawn(pawn, null);
					}
					else
					{
						if (pawn.Faction == Faction.OfPlayer || pawn.HostFaction == Faction.OfPlayer)
						{
							list2.Add(pawn);
							PawnBanishUtility.Banish(pawn, map.Tile);
						}
						MapDeiniter.CleanUpAndPassToWorld(pawn);
					}
				}
				catch (Exception ex)
				{
					Log.Error(string.Concat(new object[]
					{
						"Could not despawn and pass to world ",
						list3[i],
						": ",
						ex
					}), false);
				}
			}
			if (list.Any<Pawn>() || list2.Any<Pawn>())
			{
				StringBuilder stringBuilder = new StringBuilder();
				if (list.Any<Pawn>())
				{
					list.SortByDescending((Pawn x) => x.RaceProps.Humanlike);
					for (int j = 0; j < list.Count; j++)
					{
						stringBuilder.AppendLine(string.Concat(new string[]
						{
							"  - ",
							list[j].LabelCap,
							" (",
							"capturedBy".Translate(new object[]
							{
								map.ParentFaction.Name
							}),
							")"
						}));
					}
				}
				if (list2.Any<Pawn>())
				{
					list2.SortByDescending((Pawn x) => x.RaceProps.Humanlike);
					for (int k = 0; k < list2.Count; k++)
					{
						stringBuilder.AppendLine("  - " + list2[k].LabelCap);
					}
				}
				string label;
				string text;
				if (map.IsPlayerHome)
				{
					label = "LetterLabelPawnsLostBecauseMapClosed_Home".Translate();
					text = "LetterPawnsLostBecauseMapClosed_Home".Translate();
				}
				else
				{
					label = "LetterLabelPawnsLostBecauseMapClosed_Caravan".Translate();
					text = "LetterPawnsLostBecauseMapClosed_Caravan".Translate();
				}
				text = text + ":\n\n" + stringBuilder.ToString().TrimEndNewlines();
				Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NegativeEvent, new GlobalTargetInfo(map.Tile), null, null);
			}
		}
		public static void Deinit(Map map)
		{
			try
			{
				MapDeiniter.PassPawnsToWorld(map);
			}
			catch (Exception arg)
			{
				Log.Error("Error while deiniting map: could not pass pawns to world: " + arg, false);
			}
			try
			{
				MapDeiniter.NotifyFactions(map);
			}
			catch (Exception arg2)
			{
				Log.Error("Error while deiniting map: could not notify factions: " + arg2, false);
			}
			try
			{
				map.weatherManager.EndAllSustainers();
			}
			catch (Exception arg3)
			{
				Log.Error("Error while deiniting map: could not end all weather sustainers: " + arg3, false);
			}
			try
			{
				Find.SoundRoot.sustainerManager.EndAllInMap(map);
			}
			catch (Exception arg4)
			{
				Log.Error("Error while deiniting map: could not end all effect sustainers: " + arg4, false);
			}
			try
			{
				map.areaManager.Notify_MapRemoved();
			}
			catch (Exception arg5)
			{
				Log.Error("Error while deiniting map: could not remove areas: " + arg5, false);
			}
			try
			{
				Find.TickManager.RemoveAllFromMap(map);
			}
			catch (Exception arg6)
			{
				Log.Error("Error while deiniting map: could not remove things from the tick manager: " + arg6, false);
			}
			try
			{
				MapDeiniter.NotifyEverythingWhichUsesMapReference(map);
			}
			catch (Exception arg7)
			{
				Log.Error("Error while deiniting map: could not notify things/regions/rooms/etc: " + arg7, false);
			}
			try
			{
				map.listerThings.Clear();
				map.spawnedThings.Clear();
			}
			catch (Exception arg8)
			{
				Log.Error("Error while deiniting map: could not remove things from thing listers: " + arg8, false);
			}
			try
			{
				Find.Archive.Notify_MapRemoved(map);
			}
			catch (Exception arg9)
			{
				Log.Error("Error while deiniting map: could not remove look targets: " + arg9, false);
			}
			try
			{
				Find.Storyteller.incidentQueue.Notify_MapRemoved(map);
			}
			catch (Exception arg10)
			{
				Log.Error("Error while deiniting map: could not remove queued incidents: " + arg10, false);
			}
		}
Exemplo n.º 22
0
        public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish)
        {
            Map map = base.Map;

            base.DeSpawn(mode);
            if (def.IsEdifice())
            {
                map.edificeGrid.DeRegister(this);
                if (def.Fillage == FillCategory.Full)
                {
                    map.terrainGrid.Drawer.SetDirty();
                }
                if (def.AffectsFertility)
                {
                    map.fertilityGrid.Drawer.SetDirty();
                }
            }
            if (mode != DestroyMode.WillReplace)
            {
                if (def.MakeFog)
                {
                    foreach (IntVec3 item in this.OccupiedRect())
                    {
                        map.fogGrid.Notify_FogBlockerRemoved(item);
                    }
                }
                if (def.holdsRoof)
                {
                    RoofCollapseCellsFinder.Notify_RoofHolderDespawned(this, map);
                }
                if (def.IsSmoothable)
                {
                    SmoothSurfaceDesignatorUtility.Notify_BuildingDespawned(this, map);
                }
            }
            if (sustainerAmbient != null)
            {
                sustainerAmbient.End();
            }
            CellRect cellRect = this.OccupiedRect();

            for (int i = cellRect.minZ; i <= cellRect.maxZ; i++)
            {
                for (int j = cellRect.minX; j <= cellRect.maxX; j++)
                {
                    IntVec3     loc         = new IntVec3(j, 0, i);
                    MapMeshFlag mapMeshFlag = MapMeshFlag.Buildings;
                    if (def.coversFloor)
                    {
                        mapMeshFlag |= MapMeshFlag.Terrain;
                    }
                    if (def.Fillage == FillCategory.Full)
                    {
                        mapMeshFlag |= MapMeshFlag.Roofs;
                        mapMeshFlag |= MapMeshFlag.Snow;
                    }
                    map.mapDrawer.MapMeshDirty(loc, mapMeshFlag);
                    map.glowGrid.MarkGlowGridDirty(loc);
                }
            }
            map.listerBuildings.Remove(this);
            map.listerBuildingsRepairable.Notify_BuildingDeSpawned(this);
            map.listerArtificialBuildingsForMeditation.Notify_BuildingDeSpawned(this);
            map.listerBuldingOfDefInProximity.Notify_BuildingDeSpawned(this);
            if (def.building.leaveTerrain != null && Current.ProgramState == ProgramState.Playing && canChangeTerrainOnDestroyed)
            {
                foreach (IntVec3 item2 in this.OccupiedRect())
                {
                    map.terrainGrid.SetTerrain(item2, def.building.leaveTerrain);
                }
            }
            map.designationManager.Notify_BuildingDespawned(this);
            if (!this.CanBeSeenOver())
            {
                map.exitMapGrid.Notify_LOSBlockerDespawned();
            }
            if (def.building.hasFuelingPort)
            {
                FuelingPortUtility.LaunchableAt(FuelingPortUtility.GetFuelingPortCell(base.Position, base.Rotation), map)?.Notify_FuelingPortSourceDeSpawned();
            }
            map.avoidGrid.Notify_BuildingDespawned(this);
        }
Exemplo n.º 23
0
 public abstract void RunGenerator(ShipCrashWorker main, Verse.Map map, Faction owner);
Exemplo n.º 24
0
        private void SpawnEnemies(float threatPoints, Faction faction, Verse.Map map)
        {
            PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms
            {
                faction = faction,
                points  = threatPoints * 0.4f,
                generateFightersOnly = true,
                groupKind            = PawnGroupKindDefOf.Combat,
                raidStrategy         = RaidStrategyDefOf.ImmediateAttack,
                forceOneIncap        = true
            };

            List <Pawn> pawns = PawnGroupMakerUtility.GeneratePawns(pawnGroupMakerParms).ToList();

            List <int> groups = new List <int>()
            {
                pawns.Count
            };
            int totalPawns = pawns.Count - 1;

            if (pawns.Count > 5)
            {
                groups.Clear();

                if (pawns.Count < maxPawnsInGroup)
                {
                    maxPawnsInGroup = pawns.Count;
                }

                while (groups.Count < maxGroups)
                {
                    if (totalPawns <= 0)
                    {
                        break;
                    }

                    int pawnsGroupCount = Rand.Range(1, maxPawnsInGroup);

                    if (pawnsGroupCount > totalPawns)
                    {
                        pawnsGroupCount = totalPawns;
                    }

                    groups.Add(pawnsGroupCount);
                    totalPawns -= pawnsGroupCount;
                }
            }

            int total = 0;

            for (int i = 0; i < groups.Count; i++)
            {
                MultipleCaravansCellFinder.FindStartingCellsFor2Groups(map, out IntVec3 playerStartingSpot, out IntVec3 second);

                for (int i2 = 0; i2 < groups[i]; i2++)
                {
                    IntVec3 loc = CellFinder.RandomSpawnCellForPawnNear(second, map);
                    GenSpawn.Spawn(pawns[total], loc, map);
                    total++;
                }
            }

            LordJob lordJob = new LordJob_AssaultColony(faction, canKidnap: true, canTimeoutOrFlee: false);

            if (lordJob != null)
            {
                LordMaker.MakeNewLord(faction, lordJob, map, pawns);
            }
        }
Exemplo n.º 25
0
 public override void SpawnSetup(Verse.Map map, bool respawningAfterLoad)
 {
     base.SpawnSetup(map, respawningAfterLoad);
 }
Exemplo n.º 26
0
        public static void DoThingFilterConfigWindow(Rect rect, ref Vector2 scrollPosition, ThingFilter filter, ThingFilter parentFilter = null, int openMask = 1, IEnumerable <ThingDef> forceHiddenDefs = null, IEnumerable <SpecialThingFilterDef> forceHiddenFilters = null, bool forceHideHitPointsConfig = false, List <ThingDef> suppressSmallVolumeTags = null, Map map = null)
        {
            Widgets.DrawMenuSection(rect);
            Text.Font = GameFont.Tiny;
            float num   = rect.width - 2f;
            Rect  rect2 = new Rect(rect.x + 1f, rect.y + 1f, num / 2f, 24f);

            if (Widgets.ButtonText(rect2, "ClearAll".Translate()))
            {
                filter.SetDisallowAll(forceHiddenDefs, forceHiddenFilters);
                SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
            }
            if (Widgets.ButtonText(new Rect(rect2.xMax + 1f, rect2.y, rect.xMax - 1f - (rect2.xMax + 1f), 24f), "AllowAll".Translate()))
            {
                filter.SetAllowAll(parentFilter);
                SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
            }
            Text.Font = GameFont.Small;
            rect.yMin = rect2.yMax;
            TreeNode_ThingCategory node = ThingCategoryNodeDatabase.RootNode;
            bool flag  = true;
            bool flag2 = true;

            if (parentFilter != null)
            {
                node  = parentFilter.DisplayRootCategory;
                flag  = parentFilter.allowedHitPointsConfigurable;
                flag2 = parentFilter.allowedQualitiesConfigurable;
            }
            Rect viewRect = new Rect(0f, 0f, rect.width - 16f, viewHeight);

            Widgets.BeginScrollView(rect, ref scrollPosition, viewRect);
            float y = 2f;

            if (flag && !forceHideHitPointsConfig)
            {
                DrawHitPointsFilterConfig(ref y, viewRect.width, filter);
            }
            if (flag2)
            {
                DrawQualityFilterConfig(ref y, viewRect.width, filter);
            }
            float num2  = y;
            Rect  rect3 = new Rect(0f, y, viewRect.width, 9999f);
            Listing_TreeThingFilter listing_TreeThingFilter = new Listing_TreeThingFilter(filter, parentFilter, forceHiddenDefs, forceHiddenFilters, suppressSmallVolumeTags);

            listing_TreeThingFilter.Begin(rect3);
            listing_TreeThingFilter.DoCategoryChildren(node, 0, openMask, map, isRoot: true);
            listing_TreeThingFilter.End();
            if (Event.current.type == EventType.Layout)
            {
                viewHeight = num2 + listing_TreeThingFilter.CurHeight + 90f;
            }
            Widgets.EndScrollView();
        }
Exemplo n.º 27
0
 private void GenerateDangerous(Faction owner, Verse.Map map)
 {
     Dangerous_AlreadyStand dang = new Dangerous_AlreadyStand(dangerousLevel, owner, map, 4, 4);
 }
Exemplo n.º 28
0
 public static void TryJump(IntVec3 cell, Map map)
 {
     TryJump(new GlobalTargetInfo(cell, map));
 }