protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; Thing item = ThingMaker.MakeThing(ThingDef.Named("Apparel_Pants"), ThingDefOf.Hyperweave); Thing item2 = ThingMaker.MakeThing(ThingDef.Named("Apparel_BasicShirt"), ThingDefOf.Hyperweave); Thing item3 = ThingMaker.MakeThing(ThingDef.Named("Apparel_Jacket"), ThingDefOf.Hyperweave); Thing item4 = ThingMaker.MakeThing(ThingDef.Named("Apparel_Tuque"), ThingDefOf.Hyperweave); Thing item5 = ThingMaker.MakeThing(ThingDef.Named("MealSurvivalPack"), null); Thing item6 = ThingMaker.MakeThing(ThingDef.Named("MealSurvivalPack"), null); Thing item7 = ThingMaker.MakeThing(ThingDef.Named("MealSurvivalPack"), null); Thing item8 = ThingMaker.MakeThing(ThingDef.Named("MealSurvivalPack"), null); Thing item9 = ThingMaker.MakeThing(ThingDef.Named("Gun_Autopistol"), null); List <Thing> list = new List <Thing>(); list.Add(item); list.Add(item2); list.Add(item3); list.Add(item4); list.Add(item5); list.Add(item6); list.Add(item7); list.Add(item8); list.Add(item9); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, list, 110, false, false, true); Find.LetterStack.ReceiveLetter("MO_SurvivalPods".Translate(), "MO_SurvivalPodsDesc".Translate(), LetterDefOf.PositiveEvent, new TargetInfo(intVec, map, false), null); //"A cluster of survival pods landed nearby, you will find some essential surviving items in there." return(true); }
// Token: 0x0600005C RID: 92 RVA: 0x00003CE8 File Offset: 0x00001EE8 public override void OnEndReceiver(RealmData realmData) { if (!receiver.preferences.receiveItems) { state = TransactionResponse.DECLINED; } if (state == TransactionResponse.ACCEPTED) { var singleContainedThing = realmPawn.FromRealmPawn(realmData); var intVec = DropCellFinder.RandomDropSpot(Find.CurrentMap); DropPodUtility.MakeDropPodAt(intVec, Find.CurrentMap, new ActiveDropPodInfo { SingleContainedThing = singleContainedThing, openDelay = 110, leaveSlag = false }); Find.LetterStack.ReceiveLetter( $"{Enum.GetName(typeof(TransactionType), transaction)} pod", $"A {Enum.GetName(typeof(TransactionType), transaction)?.ToLower()} was sent to you by {sender.name}", LetterDefOf.PositiveEvent, new GlobalTargetInfo(intVec, Find.CurrentMap)); return; } if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageTypeDefOf.RejectInput); return; } var unused = state; }
public override void OnEndReceiver(RealmData realmData) { // Nothing if (state == TransactionResponse.ACCEPTED) { Pawn pawn = realmPawn.FromRealmPawn(realmData); // We drop it IntVec3 position = DropCellFinder.RandomDropSpot(); DropPodUtility.MakeDropPodAt(position, new DropPodInfo { SingleContainedThing = pawn, openDelay = 110, leaveSlag = false }); Find.LetterStack.ReceiveLetter( "Colonist pod", "A colonist was sent to you by " + sender.name, LetterType.Good, position ); } else if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageSound.RejectInput); } }
private TunnelHiveLikeSpawner SpawnTunnelLikeCluster(int hiveCount, Map map) { IntVec3 loc = DropCellFinder.RandomDropSpot(map); ThingDef_HiveLike tD = (ThingDef_HiveLike)this.def.mechClusterBuilding; ThingDef_TunnelHiveLikeSpawner thingDef = (ThingDef_TunnelHiveLikeSpawner)tD.TunnelDef; TunnelHiveLikeSpawner hivelike = (TunnelHiveLikeSpawner)ThingMaker.MakeThing(thingDef, null); GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.def, null), loc, map); //hivelike.SetFaction(hivelike.faction, null); IncidentWorker_Hivelike.SpawnItemInstantly(hivelike); for (int i = 0; i < hiveCount - 1; i++) { TunnelHiveLikeSpawner hivelike2; CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>(); if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(true, out hivelike2)) { IncidentWorker_Hivelike.SpawnItemInstantly(hivelike2); hivelike = hivelike2; //Log.Message(string.Format("7 e")); } //Log.Message(string.Format("7 f")); } //Log.Message(string.Format("8")); return(hivelike); }
public override void OnEndReceiver(RealmData realmData) { // Nothing if (state == TransactionResponse.ACCEPTED) { Pawn pawn = realmAnimal.FromRealmAnimal(realmData); // We drop it IntVec3 position = DropCellFinder.RandomDropSpot(Find.VisibleMap); DropPodUtility.MakeDropPodAt(position, Find.VisibleMap, new ActiveDropPodInfo { SingleContainedThing = pawn, openDelay = 110, leaveSlag = false }); Find.LetterStack.ReceiveLetter( "Animal pod", "An animal was sent to you by " + sender.name, LetterDefOf.PositiveEvent, new RimWorld.Planet.GlobalTargetInfo(position, Find.VisibleMap) ); } else if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageTypeDefOf.RejectInput); } }
// Token: 0x06000009 RID: 9 RVA: 0x00002394 File Offset: 0x00000594 protected override bool TryExecuteWorker(IncidentParms parms) { var activeSlagPodDef = (ActiveSlagPodDef)ThingDef.Named("ActiveSlagPod"); bool result; if (activeSlagPodDef == null) { Log.Error("ActiveSlagPod was not defined!"); result = false; } else if (activeSlagPodDef.slagpodContents == null) { Log.Error("slagpodContents was not defined in ActiveSlagPod!"); result = false; } else { var things = activeSlagPodDef.slagpodContents.root.Generate(); var map = (Map)parms.target; var intVec = DropCellFinder.RandomDropSpot(map); SlagPodUtility.DropThingsNear(intVec, map, things, 1, false, true, true); Find.LetterStack.ReceiveLetter("LetterLabelSlagPodDrop".Translate(), "SlagPodDrop".Translate(), LetterDefOf.PositiveEvent, new TargetInfo(intVec, map)); result = true; } return(result); }
public override bool PreCalculateDroppingSpot() { Map map = parms.target as Map; IncidentInterceptorUtility.IsIntercepting_RandomDropSpot = GeneratorPatchFlag.Generate; DropSpot = DropCellFinder.RandomDropSpot(map); lookTargets = new TargetInfo(DropSpot, map, false); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; Faction faction = Find.FactionManager.RandomNonHostileFaction(true, true, true, TechLevel.Neolithic); Faction faction2 = Find.FactionManager.FirstFactionOfDef(FactionDefOf.PlayerColony); int freeColonistsSpawnedCount = map.mapPawns.FreeColonistsSpawnedCount; bool flag = !FactionUtility.HostileTo(faction, faction2) && map.resourceCounter.TotalHumanEdibleNutrition < 4f * (float)freeColonistsSpawnedCount; bool result; if (flag) { Thing thing = ThingMaker.MakeThing(ThingDef.Named("MealSimple"), null); Thing thing2 = ThingMaker.MakeThing(ThingDef.Named("MealFine"), null); Thing thing3 = ThingMaker.MakeThing(ThingDef.Named("MealSimple"), null); Thing thing4 = ThingMaker.MakeThing(ThingDef.Named("MealFine"), null); List <Thing> list = new List <Thing>(); int num = Rand.Range(20, 40); bool flag2 = num > thing.def.stackLimit; if (flag2) { num = thing.def.stackLimit; } bool flag3 = num == 0; if (flag3) { num = 1; } int num2 = Rand.Range(20, 40); bool flag4 = num2 > thing2.def.stackLimit; if (flag4) { num2 = thing2.def.stackLimit; } bool flag5 = num2 == 0; if (flag5) { num2 = 1; } thing.stackCount = num; thing2.stackCount = num2; thing3.stackCount = num; thing4.stackCount = num2; list.Add(thing); list.Add(thing2); list.Add(thing3); list.Add(thing4); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, list, 110, false, false, true); Find.LetterStack.ReceiveLetter("MO_Thanksgiving".Translate(), "MO_ThanksgivingDesc".Translate(), LetterDefOf.PositiveEvent, new TargetInfo(intVec, map, false), null); //"One of the tribes has noticed your food stores are low. They have provided you with some food, no strings attached.\n\nThey thank you for being such good friends and they hope your friendship will be further cemented by this act." result = true; } else { result = false; } return(result); }
// Token: 0x060015AA RID: 5546 RVA: 0x000A92C8 File Offset: 0x000A76C8 public override void Arrive(List <Pawn> pawns, IncidentParms parms) { Map map = (Map)parms.target; for (int i = 0; i < pawns.Count; i++) { IntVec3 dropCenter = DropCellFinder.RandomDropSpot(map); DeepStrikeUtility.DropThingsNear(dropCenter, map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, true, false, true); } }
// Token: 0x060045E0 RID: 17888 RVA: 0x00178498 File Offset: 0x00176698 public override void Arrive(List <Pawn> pawns, IncidentParms parms) { Map map = (Map)parms.target; bool canRoofPunch = parms.faction != null && parms.faction.HostileTo(Faction.OfPlayer); for (int i = 0; i < pawns.Count; i++) { TunnelRaidUtility.DropThingsNear(DropCellFinder.RandomDropSpot(map), map, Gen.YieldSingle <Thing>(pawns[i]), parms.podOpenDelay, false, true, canRoofPunch); } }
public override void EndVote() { Map map = Helper.AnyPlayerMap; Find.WindowStack.TryRemove(typeof(VoteWindow)); Messages.Message(new Message("Chat voted for: " + VoteKeyLabel(DecideWinner()), MessageTypeDefOf.PositiveEvent), true); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, thingsOptions[DecideWinner()], 110, false, true, true); Find.LetterStack.ReceiveLetter("LetterLabelCargoPodCrash".Translate(), "CargoPodCrash".Translate(), LetterDefOf.PositiveEvent, new TargetInfo(intVec, map, false), null, null); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <Thing> things = DefDatabase <ThingSetMakerDef> .GetNamed("RB_BeeResourcePod").root.Generate(); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, things, 110, false, true, true, true); base.SendStandardLetter("RB_LetterLabelBeeCargoPodCrash".Translate(), "RB_BeeCargoPodCrash".Translate(), LetterDefOf.PositiveEvent, parms, new TargetInfo(intVec, map, false), Array.Empty <NamedArgument>()); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 IntVec = DropCellFinder.RandomDropSpot(map); LookTargets lookie = new LookTargets(IntVec, map); Thing thing = GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("AM_AncientBuriedChunk"), null), IntVec, map, WipeMode.FullRefund); Find.LetterStack.ReceiveLetter("LetterLabelStrangeChunk".Translate(), "LetterStrangeChunk".Translate(), LetterDefOf.NeutralEvent, lookie, null, null); return(true); }
public static void Enter(Pawn pawn, StringBuilder message) { var map = Find.CurrentMap; if (pawn.Map == map) { message.Append("You're already on the current map"); return; } IntVec3 intVec = DropCellFinder.RandomDropSpot(map); LetterDef textLetterDef = LetterDefOf.NeutralEvent; string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate().AdjustedFor(pawn, "PAWN"); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); textLetterDef = LetterDefOf.ThreatSmall; } else { text += "RefugeePodCrash_NonHostile".Translate(new object[] { pawn }).AdjustedFor(pawn, "PAWN"); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, textLetterDef, new TargetInfo(intVec, map, false), null, null); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(new[] { pawn }, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); message.Append(text); }
private static void GetSpotAddDropSpots(Map map, List <IntVec3> cells) { var tradeDropSpot = DropCellFinder.TradeDropSpot(map); cells.Add(tradeDropSpot); if (tradeDropSpot.IsValid && DropCellFinder.TryFindDropSpotNear(tradeDropSpot, map, out var near, false, false)) { cells.Add(near); } cells.Add(DropCellFinder.RandomDropSpot(map)); }
public static bool FindAnyLandingSpot(out IntVec3 spot, Faction faction, Map map, IntVec2?size) { if (!DropCellFinder.FindSafeLandingSpot(out spot, faction, map, 0, 15, 25, size)) { IntVec3 intVec = DropCellFinder.RandomDropSpot(map); if (!DropCellFinder.TryFindDropSpotNear(intVec, map, out spot, false, false, false, size)) { spot = intVec; } } return(true); }
public override void OnEndReceiver(RealmData realmData) { // Double check to ensure it wasn't bypassed by the sender if (!receiver.preferences.receiveItems) { state = TransactionResponse.DECLINED; } if (state == TransactionResponse.ACCEPTED) { // We spawn the new items ! List <Thing> thingsToSpawn = new List <Thing>(); foreach (KeyValuePair <RealmThing, int> entry in realmThings) { RealmThing realmThing = entry.Key; Thing thing = realmData.FromRealmThing(realmThing); int leftToSpawn = entry.Value; // We make new things until we create everything // For example, if 180 granites blocks are sent (can be stacked by 75), we // will create 3 Thing (2 full and 1 semi-full) while (leftToSpawn > 0) { realmThing.stackCount = Math.Min(leftToSpawn, thing.def.stackLimit); thingsToSpawn.Add(realmData.FromRealmThing(realmThing)); leftToSpawn -= realmThing.stackCount; } } // We spawn the said item IntVec3 position = DropCellFinder.RandomDropSpot(Find.VisibleMap); DropPodUtility.DropThingsNear(position, Find.VisibleMap, thingsToSpawn); Find.LetterStack.ReceiveLetter( "Ship pod", "A pod was sent from " + sender.name + " containing items", LetterDefOf.PositiveEvent, new RimWorld.Planet.GlobalTargetInfo(position, Find.VisibleMap) ); } else if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageTypeDefOf.RejectInput); } else if (state == TransactionResponse.TOOFAST) { // This should never happen as the server rejects intercepted packets } }
public void Notify_EatenPumkinPetes() { eatenPumkinPetesCounter += 1; if (eatenPumkinPetesCounter == 50) { eatenPumkinPetesCounter = 0; List <Thing> things = new List <Thing>(); ThingWithComps thingWithComps = (ThingWithComps)ThingMaker.MakeThing(RWBYDefOf.Apparel_PumpkinPetes, GenStuff.RandomStuffFor(RWBYDefOf.Apparel_PumpkinPetes)); thingWithComps.TryGetComp <CompQuality>().SetQuality((QualityCategory)Rand.RangeInclusive(0, 6), ArtGenerationContext.Colony); things.Add(thingWithComps); IntVec3 intVec = DropCellFinder.RandomDropSpot(AbilityUser.Map); DropPodUtility.DropThingsNear(intVec, AbilityUser.Map, things, 110, false, false, false); Find.LetterStack.ReceiveLetter("LetterLabelPumpkinPetePodCrash".Translate(), "LetterTextPumpkinPetePodCrash".Translate(), LetterDefOf.PositiveEvent, new TargetInfo(intVec, AbilityUser.Map, false), null, null); } }
public override void Apply(User user, RealmData realmData) { // We spawn the object with a DropPod Log.Message("Drop pod to spawn !"); Thing thing = realmData.FromRealmThing(realmThing); IntVec3 position = DropCellFinder.RandomDropSpot(); DropPodUtility.DropThingsNear(position, new Thing[] { thing }); Find.LetterStack.ReceiveLetter( "Ship pod", "A pod was sent from " + userFrom.name + " containing " + thing.Label, LetterType.Good, position ); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <Thing> things = ThingSetMakerDefOf.ResourcePod.root.Generate(); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, things, 110, false, true, true); var text = "CargoPodCrash".Translate(); if (Quote != null) { text += "\n\n"; text += Helper.ReplacePlaceholder(Quote, item: things[0].LabelShort); } Find.LetterStack.ReceiveLetter("LetterLabelCargoPodCrash".Translate(), text, LetterDefOf.PositiveEvent, new TargetInfo(intVec, map, false), null, null); return(true); }
public override void OnEndReceiver(RealmData realmData) { // Double check to ensure it wasn't bypassed by the sender if (!receiver.preferences.receiveAnimals) { realmData.NotifyPacketToServer(new ConfirmServerTransactionPacket { transaction = this, response = TransactionResponse.DECLINED }); return; } // Nothing if (state == TransactionResponse.ACCEPTED) { Pawn pawn = realmAnimal.FromRealmAnimal(realmData); // We drop it IntVec3 position = DropCellFinder.RandomDropSpot(Find.VisibleMap); DropPodUtility.MakeDropPodAt(position, Find.VisibleMap, new ActiveDropPodInfo { SingleContainedThing = pawn, openDelay = 110, leaveSlag = false }); Find.LetterStack.ReceiveLetter( "Animal pod", "An animal was sent to you by " + sender.name, LetterDefOf.PositiveEvent, new RimWorld.Planet.GlobalTargetInfo(position, Find.VisibleMap) ); } else if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageTypeDefOf.RejectInput); } else if (state == TransactionResponse.TOOFAST) { // This should never happen as the server rejects intercepted packets. } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = parms.target as Map; //Get a random cell. IntVec3 intVec = DropCellFinder.RandomDropSpot((Map)parms.target); //Spawn Black Ibex Cthulhu.Utility.SpawnPawnsOfCountAt(CultsDefOf.Cults_BlackGoat, intVec, map, Rand.Range(6, 10)); //Spawn some Black Ibex as player pets Cthulhu.Utility.SpawnPawnsOfCountAt(CultsDefOf.Cults_BlackGoat, intVec, map, Rand.Range(1, 2), Faction.OfPlayer); Messages.Message("A herd of black ibex have appeared on the overworld map", MessageTypeDefOf.PositiveEvent); map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = intVec; Cthulhu.Utility.ApplyTaleDef("Cults_SpellMotherOfGoats", map); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <Thing> things = ThingSetMakerDefOf.RefugeePod.root.Generate(); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); Pawn pawn = this.FindPawn(things); pawn.guest.getRescuedThoughtOnUndownedBecauseOfPlayer = true; string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } else { text += "RefugeePodCrash_NonHostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN"); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); if (Quote != null) { text += "\n\n"; text += Quote; } Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, new TargetInfo(intVec, map, false), null, null); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { var map = (Map)parms.target; var things = ThingSetMakerDefOf.RefugeePod.root.Generate(); var intVec = DropCellFinder.RandomDropSpot(map); var pawn = FindPawn(things); pawn.guest.getRescuedThoughtOnUndownedBecauseOfPlayer = true; var label = "LetterLabelRefugeePodCrash".Translate(); var text = "RefugeePodCrash".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); text += "\n\n"; if (pawn.Faction == null) { text += "RefugeePodCrash_Factionless".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } else if (pawn.Faction.HostileTo(Faction.OfPlayer)) { text += "RefugeePodCrash_Hostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } else { text += "RefugeePodCrash_NonHostile".Translate(pawn.Named("PAWN")).AdjustedFor(pawn); } PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.NeutralEvent, new TargetInfo(intVec, map)); var activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); //Give the pawn the Scuttlebug Infection var torso = pawn.health.hediffSet.GetNotMissingParts().First(bpr => bpr.def == BodyPartDefOf.Torso); var unused = pawn.health.hediffSet.GetNotMissingParts().First(bpr => bpr.def == BodyPartDefOf.Head); pawn.health.AddHediff(HediffDef.Named("ScuttlebugInfection"), torso); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 intVec = DropCellFinder.RandomDropSpot(map); Building_Overgrown_DropPod overgrown_DropPod = (Building_Overgrown_DropPod)ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("AA_Overgrown_DropPod", true)); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); List <Thing> things = new List <Thing>(); things.Add(overgrown_DropPod); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); LookTargets lookie = new LookTargets(intVec, map); Find.LetterStack.ReceiveLetter("LetterLabelCactipinePod".Translate(), "CactipineDropPod".Translate(), LetterDefOf.NeutralEvent, lookie, null, null); //GenSpawn.Spawn(overgrown_DropPod, intVec, map); return(true); }
public override bool TryExecute(IncidentParms parms) { IntVec3 intVec = DropCellFinder.RandomDropSpot(); Find.LetterStack.ReceiveLetter("LetterLabelRefugeePodCrash".Translate(), "RefugeePodCrash".Translate(), LetterType.BadNonUrgent, intVec); Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer); Pawn pawn = PawnGenerator.GeneratePawn(Verse.PawnKindDef.Named("MechanoidCovert"), faction); pawn.gender = Gender.Female; FixBackstory(pawn); FixHair(pawn); pawn.Name = NameGenerator.GenerateName(pawn); HealthUtility.GiveInjuriesToForceDowned(pawn); DropPodUtility.MakeDropPodAt(intVec, new DropPodInfo { SingleContainedThing = pawn, openDelay = 180, leaveSlag = true }); return(true); }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; IntVec3 intvec = DropCellFinder.RandomDropSpot(map); if (!this.TryFindEntryCell(map, out intvec)) { return(false); } PawnKindDef marapol = PawnKindDef.Named("AM_Marapol"); int stayTime = Rand.RangeInclusive(90000, 150000); IntVec3 invalid = IntVec3.Invalid; if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(intvec, map, 10.0f, out invalid)) { invalid = IntVec3.Invalid; } Pawn pawn = null; IntVec3 location = CellFinder.RandomClosewalkCellNear(intvec, map, 10, null); pawn = PawnGenerator.GeneratePawn(marapol, null); GenSpawn.Spawn(pawn, location, map, Rot4.Random, WipeMode.Vanish, false); //TODO: Fill inventory with random gear based on age of colony. pawn.TryGetComp <CompHauler>().addToCargo(ThingMaker.MakeThing(ThingDef.Named("AM_AncientBuriedChunk"))); pawn.mindState.exitMapAfterTick = (Find.TickManager.TicksGame + stayTime); if (invalid.IsValid) { pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(invalid, map, 10, null); } Find.LetterStack.ReceiveLetter("LetterLabelLostMarapol".Translate(marapol.label.CapitalizeFirst()), "LetterLostMarapol".Translate(marapol.label), LetterDefOf.PositiveEvent, pawn, null, null); return(true); }
public override void OnEndReceiver(RealmData realmData) { if (state == TransactionResponse.ACCEPTED) { // We spawn the new items ! List <Thing> thingsToSpawn = new List <Thing>(); foreach (KeyValuePair <RealmThing, int> entry in realmThings) { RealmThing realmThing = entry.Key; Thing thing = realmData.FromRealmThing(realmThing); int leftToSpawn = entry.Value; // We make new things until we create everything // For example, if 180 granites blocks are sent (can be stacked by 75), we // will create 3 Thing (2 full and 1 semi-full) while (leftToSpawn > 0) { realmThing.stackCount = Math.Min(leftToSpawn, thing.def.stackLimit); thingsToSpawn.Add(realmData.FromRealmThing(realmThing)); leftToSpawn -= realmThing.stackCount; } } // We spawn the said item IntVec3 position = DropCellFinder.RandomDropSpot(); DropPodUtility.DropThingsNear(position, thingsToSpawn); Find.LetterStack.ReceiveLetter( "Ship pod", "A pod was sent from " + sender.name + " containing items", LetterType.Good, position ); } else if (state == TransactionResponse.INTERRUPTED) { Messages.Message("Unexpected interruption during item transaction with " + sender.name, MessageSound.RejectInput); } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; for (int x = 0; x < 10; x++) { List <Thing> things = ThingSetMakerDefOf.ResourcePod.root.Generate(); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, things, 110, false, true, true); } var text = "TwitchToolkitCargoPodFrenzyInc".Translate(); if (Quote != null) { text += "\n\n"; text += Helper.ReplacePlaceholder(Quote); } Find.LetterStack.ReceiveLetter("TwitchToolkitCargoPodFrenzyInc".Translate(), text, LetterDefOf.PositiveEvent, null, null, null); return(true); }
private HiveLike SpawnHiveLikeCluster(int hiveCount, Map map) { ; IntVec3 loc = DropCellFinder.RandomDropSpot(map); ThingDef_HiveLike thingDef = (ThingDef_HiveLike)this.def.mechClusterBuilding; HiveLike hivelike = (HiveLike)ThingMaker.MakeThing(thingDef, null); GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.OfTunnel, null), loc, map); hivelike.SetFaction(hivelike.OfFaction, null); IncidentWorker_Hivelike.SpawnItemInstantly(hivelike); for (int i = 0; i < hiveCount - 1; i++) { HiveLike hivelike2; CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>(); if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(true, out hivelike2)) { IncidentWorker_Hivelike.SpawnItemInstantly(hivelike2); hivelike = hivelike2; } } return(hivelike); }