public void DropTeam() { // Find exit spot. IntVec3 exitSpot = IntVec3.Invalid; bool exitSpotIsValid = Expedition.TryFindRandomExitSpot(this.Map, this.Position, out exitSpot); if (exitSpotIsValid) { // Spawn expedition pawns. List <Pawn> stayingAboardPawns = new List <Pawn>(); List <Pawn> droppedPawns = new List <Pawn>(); foreach (Pawn pawn in this.pawnsAboard) { if (pawn.kindDef == Util_PawnKindDefOf.Pilot) { stayingAboardPawns.Add(pawn); } else { droppedPawns.Add(pawn); GenSpawn.Spawn(pawn, this.Position + IntVec3Utility.RandomHorizontalOffset(3f), this.Map); } } this.pawnsAboard = stayingAboardPawns; // Make lord. LordMaker.MakeNewLord(Util_Faction.MiningCoFaction, new LordJob_ExitMap(exitSpot), this.Map, droppedPawns); // Spawn payment. SpawnPayment(droppedPawns.Count); Util_Faction.AffectGoodwillWith(Util_Faction.MiningCoFaction, Faction.OfPlayer, droppedPawns.Count); } }
public void SpawnExplosions() { for (int explosionIndex = 0; explosionIndex < 5; explosionIndex++) { GenExplosion.DoExplosion(this.Position + IntVec3Utility.RandomHorizontalOffset(5f), this.Map, Rand.Range(3f, 7f), DamageDefOf.Bomb, this, Rand.Range(8, 45)); } }
public void SpawnFuelPuddleAndFire() { for (int fireIndex = 0; fireIndex < 150; fireIndex++) { IntVec3 spawnCell = this.Position + IntVec3Utility.RandomHorizontalOffset(12f); GenSpawn.Spawn(ThingDefOf.Filth_Fuel, spawnCell, this.Map); Fire fire = GenSpawn.Spawn(ThingDefOf.Fire, spawnCell, this.Map) as Fire; fire.fireSize = Rand.Range(0.25f, 1.25f); } }
public void EjectPlayerPawns() { List <Pawn> leftPawnsAboard = new List <Pawn>(); foreach (Pawn pawn in this.pawnsAboard) { if (pawn.Faction == Faction.OfPlayer) { this.orbitalHealingPawnsAboardCount--; GenSpawn.Spawn(pawn, this.Position + IntVec3Utility.RandomHorizontalOffset(5f), this.Map); if (Util_Faction.MiningCoFaction.HostileTo(Faction.OfPlayer) == false) { // Only give refund if not ennemy to colony! :-D SpawnItem(ThingDefOf.Silver, null, Util_Spaceship.orbitalHealingCost, this.Position, this.Map, 5f); } } else { leftPawnsAboard.Add(pawn); } } this.pawnsAboard = leftPawnsAboard; }
public static Thing SpawnItem(ThingDef itemDef, ThingDef stuff, int quantity, IntVec3 position, Map map, float radius) { Thing item = null; int remainingQuantity = quantity; while (remainingQuantity > 0) { int stackCount = 0; if (remainingQuantity > itemDef.stackLimit) { stackCount = itemDef.stackLimit; } else { stackCount = remainingQuantity; } remainingQuantity -= stackCount; item = ThingMaker.MakeThing(itemDef, stuff); item.stackCount = stackCount; Thing placedItem = null; GenDrop.TryDropSpawn(item, position + IntVec3Utility.RandomHorizontalOffset(radius), map, ThingPlaceMode.Near, out placedItem); } return(item); }