public static void MakeDeepStrikerAt(IntVec3 center, DropPodInfo info, Faction faction) { Deepstriker_ThingDef def; if (ResolveDeepStrikerDef(faction, out def)) { Deepstriker_Incoming deepStrikerIncoming = (Deepstriker_Incoming)ThingMaker.MakeThing(def, null); deepStrikerIncoming.contents = info; GenSpawn.Spawn(deepStrikerIncoming, center); } else { Log.Error("No Deepstriker vehicle found for Faction " + faction.ToString()); } }
public override bool TryExecute( IncidentParms parms ) { IntVec3 dropSpot = GenSquareFinder.RandomSquareWith( (sq)=>sq.Standable() && !sq.IsFogged() ); Find.LetterStack.ReceiveLetter( new UI.Letter("RefugeePodCrash".Translate(), UI.LetterType.BadNonUrgent, dropSpot)); Faction fac = Find.FactionManager.FirstFactionOfDef( FactionDef.Named("Spacer") ); Pawn refugee = PawnGenerator.GeneratePawn( PawnKindDef.Named("SpaceRefugee"), fac ); refugee.healthTracker.ForceIncap(); DropPodInfo contents = new DropPodInfo(refugee, 180); DropPodUtility.MakeDropPodAt( dropSpot, contents ); Find.Storyteller.intenderPopulation.Notify_PopulationGainIncident(); return true; }
public override bool TryExecute(IncidentParms parms) { IntVec3 dropSpot = GenSquareFinder.RandomSquareWith((sq) => sq.Standable() && !sq.IsFogged()); Find.LetterStack.ReceiveLetter(new UI.Letter("RefugeePodCrash".Translate(), UI.LetterType.BadNonUrgent, dropSpot)); Faction fac = Find.FactionManager.FirstFactionOfDef(FactionDef.Named("Spacer")); Pawn refugee = PawnGenerator.GeneratePawn(PawnKindDef.Named("SpaceRefugee"), fac); refugee.healthTracker.ForceIncap(); DropPodInfo contents = new DropPodInfo(refugee, 180); DropPodUtility.MakeDropPodAt(dropSpot, contents); Find.Storyteller.intenderPopulation.Notify_PopulationGainIncident(); return(true); }
public static void UnloadThingGroupsNear(Faction faction, IntVec3 dropCenter, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool canRoofPunch = true) { foreach (List <Thing> current in thingsGroups) { IntVec3 intVec; if (!DropCellFinder.TryFindDropSpotNear(dropCenter, out intVec, true, canRoofPunch)) { Log.Warning(string.Concat(new object[] { "DropThingsNear failed to find a place to drop ", current.FirstOrDefault <Thing>(), " near ", dropCenter, ". Dropping on random square instead." })); intVec = CellFinderLoose.RandomCellWith((IntVec3 c) => c.Walkable(), 1000); } for (int i = 0; i < current.Count; i++) { current[i].SetForbidden(true, false); } if (instaDrop) { foreach (Thing current2 in current) { GenPlace.TryPlaceThing(current2, intVec, ThingPlaceMode.Near, null); } } else { DropPodInfo dropPodInfo = new DropPodInfo(); foreach (Thing current3 in current) { dropPodInfo.containedThings.Add(current3); } dropPodInfo.openDelay = openDelay; dropPodInfo.leaveSlag = leaveSlag; Deepstriker_Utilities.MakeDeepStrikerAt(intVec, dropPodInfo, faction); } } }