public void DropAcquiredMats() { List <Thing> list = new List <Thing>(); foreach (ThingDef def in acquiredMats.Keys) { int remaining = 0; if (acquiredMats.TryGetValue(def, out remaining)) { remaining = (int)(remaining * 0.75); while (remaining > 0) { int num = UnityEngine.Mathf.Min(def.stackLimit, remaining); Thing thing = ThingMaker.MakeThing(def); thing.stackCount = num; remaining -= num; list.Add(thing); } } } foreach (var thing in list) { IntVec3 loc = DropCellFinder.TradeDropSpot(); DropPodUtility.MakeDropPodAt(loc, new DropPodInfo { SingleContainedThing = thing, leaveSlag = false }); } }
private void HostileDefeated() { // Killed all hostiles - Win outcome if (!GenHostility.AnyHostileActiveThreatTo(((MapParent)parent).Map, Faction.OfPlayer)) { active = false; DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(Find.AnyPlayerHomeMap), Find.AnyPlayerHomeMap, rewards, 110, false, true, true); parent.Faction.TryAffectGoodwillWith(Faction.OfPlayer, +15, false, true); if (!Find.WorldObjects.Settlements.Where(s => s.Faction == enemy && !s.Faction.def.hidden && Find.WorldReachability.CanReach(Find.AnyPlayerHomeMap.Tile, s.Tile)).TryRandomElement(out Settlement enemySet)) { Find.LetterStack.ReceiveLetter("LetterLabelOutpostdefensesuccess".Translate(), TranslatorFormattedStringExtensions.Translate("Outpostdefensesuccess", parent.Faction.leader, parent.Faction.def.leaderTitle, GenLabel.ThingsLabel(rewards, string.Empty)), EndGameDefOf.FE_JointRaid.letterDef, null, parent.Faction, null); active = false; return; } List <Thing> rewardsNew = ThingSetMakerDefOf.Reward_StandardByDropPod.root.Generate(new ThingSetMakerParams() { totalMarketValueRange = new FloatRange?(SiteTuning.BanditCampQuestRewardMarketValueRange * SiteTuning.QuestRewardMarketValueThreatPointsFactor.Evaluate(StorytellerUtility.DefaultSiteThreatPointsNow() + 500f)) }); Thing silver = ThingMaker.MakeThing(ThingDefOf.Silver); silver.stackCount = (int)FE_IncidentWorker_Jointraid.SilverBonusRewardCurve.Evaluate(parent.Faction.PlayerGoodwill); int random = new IntRange(Global.DayInTicks * 15, Global.DayInTicks * 25).RandomInRange; enemySet.GetComponent <WorldComp_JointRaid>().StartComp(random, parent.Faction, rewardsNew, silver); string text = TranslatorFormattedStringExtensions.Translate("OutpostdefensesuccessJointRaid", parent.Faction.leader, parent.Faction.def.leaderTitle, GenLabel.ThingsLabel(rewardsNew, string.Empty), random.ToStringTicksToPeriod(), GenThing.GetMarketValue(rewards).ToStringMoney(null), silver.stackCount.ToString(), GenLabel.ThingsLabel(rewards, string.Empty)).CapitalizeFirst(); GenThing.TryAppendSingleRewardInfo(ref text, rewards); Find.LetterStack.ReceiveLetter(EndGameDefOf.FE_JointRaid.letterLabel, text, EndGameDefOf.FE_JointRaid.letterDef, enemySet, parent.Faction, null); } }
// 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; }
private void SendDrop() { Map map = Current.Game.CurrentMap; GenDate.DayOfYear(ticks, Find.WorldGrid.LongLatOf(map.Tile).x); List <Thing> thingList = new List <Thing> { ThingMaker.MakeThing(AvaliDefs.AvaliNexus) }; Scribe_Values.Look(ref hasDropped, "hasDropped", false); Map target = map; List <Faction> newFactions = new List <Faction>(); IntVec3 intVec3 = DropCellFinder.TradeDropSpot(target); if (map.IsPlayerHome) { hasDropped = true; foreach (Faction faction in Find.FactionManager.AllFactions.Where(x => x.def == AvaliDefs.AvaliFaction)) { faction.SetRelationDirect(Faction.OfPlayer, FactionRelationKind.Ally); newFactions.Add(faction); } DropPodUtility.DropThingsNear(intVec3, target, (IEnumerable <Thing>)thingList); ChoiceLetter choiceLetter = LetterMaker.MakeLetter("IlluminateAirdrop".Translate(), "AirdropEventDesc".Translate(), AvaliMod.AvaliDefs.IlluminateAirdrop); Find.LetterStack.ReceiveLetter(choiceLetter, null); } else { SetupDrop(); } }
public void SpawnDropPod(IntVec3 root, Map map, ref LookTargets targets) { List <List <Thing> > groups = new List <List <Thing> >(); SpawnThings(out groups, ref targets); DropPodUtility.DropThingGroupsNear(root, map, groups, 140, false, true, true); }
public override bool TryExecute(IncidentParms parms) { Log.Message("IncidentWorker_RefugeePodCrashInCave:TryExecute"); if (Find.Map.Biome != Util_CaveBiome.CaveBiomeDef) { return(base.TryExecute(parms)); } IntVec3 intVec = IntVec3.Invalid; TryFindRefugeePodSpot(out intVec); if (intVec.IsValid == false) { return(false); } Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer); PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, faction, PawnGenerationContext.NonPlayer, false, false, false, false, true, false, 20f, false, true, true, null, null, null, null, null, null); Pawn pawn = PawnGenerator.GeneratePawn(request); HealthUtility.GiveInjuriesToForceDowned(pawn); string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate(); PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, LetterType.BadNonUrgent, intVec, null); DropPodUtility.MakeDropPodAt(intVec, new DropPodInfo { SingleContainedThing = pawn, openDelay = 180, leaveSlag = true }); return(true); }
public static bool Prefix(TransportPodsArrivalAction_LandInSpecificCell __instance, List <ActiveDropPodInfo> pods, int tile, IntVec3 ___cell, MapParent ___mapParent) { // Log.Message(string.Format("pods: {0}", pods.Count)); foreach (ActiveDropPodInfo info in pods) { for (int i = 0; i < info.innerContainer.Count; i++) { Thing dropship = info.innerContainer[i]; CompDropship comp = dropship.TryGetCompFast <CompDropship>(); if (comp != null) { // Log.Message(string.Format("pods: {0}", info.innerContainer.ContentsString)); Thing lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods); Traverse tv = Traverse.Create(__instance); IntVec3 c = ___cell; Map map = ___mapParent.Map; TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods); for (int ii = 0; ii < pods.Count; ii++) { DropPodUtility.MakeDropPodAt(c, map, pods[ii]); } Messages.Message("AvP_USCM_Dropship_MessageArrived".Translate(), lookTarget, MessageTypeDefOf.TaskCompletion, true); return(false); } } } return(true); }
public override bool TryExecute(IncidentParms parms) { Map map = (Map)parms.target; if (map.Biome != Util_CaveBiome.CaveBiomeDef) { return(base.TryExecute(parms)); } IntVec3 intVec = IntVec3.Invalid; TryFindRefugeePodSpot(map, out intVec); if (intVec.IsValid == false) { return(false); } Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer); PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, faction, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 20f, false, true, true, false, false, null, null, null, null, null, null); Pawn pawn = PawnGenerator.GeneratePawn(request); HealthUtility.DamageUntilDowned(pawn); string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate(); PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, LetterDefOf.BadNonUrgent, new GlobalTargetInfo(intVec, map, false), null); DropPodUtility.MakeDropPodAt(intVec, map, new ActiveDropPodInfo { SingleContainedThing = pawn, openDelay = 180, leaveSlag = true }); return(true); }
private static void SendDropPod(FCEvent evt) { Map playerHomeMap = Find.World.GetComponent <FactionFC>().TaxMap; MakeDeliveryLetterAndMessage(evt); DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(playerHomeMap), playerHomeMap, evt.goods, 110, false, false, false, false); }
private void TryTransfer(Caravan caravan) { Map map = Find.AnyPlayerHomeMap; quest.CheckPrisoners(); for (int i = quest.DropedPawns.Count - 1; i >= 0; i--) { Pawn p = quest.DropedPawns[i]; if (caravan.ContainsPawn(p)) { caravan.pawns.Remove(p); Find.WorldPawns.RemovePawn(p); quest.DropedPawns.Remove(p); IntVec3 intVec = DropCellFinder.TradeDropSpot(map); Thing rewardCopy = ThingMaker.MakeThing(ThingDefOf.Silver); rewardCopy.stackCount = quest.Rewards[0].stackCount; DropPodUtility.DropThingsNear(intVec, map, new List <Thing> { rewardCopy }, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: false); Find.LetterStack.ReceiveLetter("CaravanArrivalAction_TransferPrisoners_SuccessTitle".Translate(), "CaravanArrivalAction_TransferPrisoners_SuccessDesc".Translate(p.Name.ToStringFull, GssRaids.GssFaction.Name, quest.Rewards[0]), LetterDefOf.PositiveEvent, new LookTargets(intVec, map)); } } if (quest.DropedPawns.Count == 0) { quest.Site.EndQuest(null, EndCondition.Success); } }
private void DropAcquiredMats() { List <Thing> list = new List <Thing>(); foreach (var item in ShoppingList.AcquiredMats) { int remaining = item.amount; while (remaining > 0) { int num = UnityEngine.Mathf.Min(item.thing.stackLimit, remaining); Thing thing = ThingMaker.MakeThing(item.thing); thing.stackCount = num; remaining -= num; list.Add(thing); } } foreach (var thing in list) { IntVec3 loc = DropCellFinder.TradeDropSpot(); DropPodUtility.MakeDropPodAt(loc, new DropPodInfo { SingleContainedThing = thing, leaveSlag = false }); } }
public static bool BuyAndDropItem(SellableItemWithModif tradeItem, Map map, bool receiveLetter = true) { if (!TakeSilverFromPlayer(tradeItem.MarketValue, map)) { return(false); } List <Thing> toTrade = new List <Thing> { tradeItem.Item }; IntVec3 intVec = DropCellFinder.TradeDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, toTrade, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: false); if (receiveLetter) { Find.LetterStack.ReceiveLetter("BuyAndDropItem_NotifyTitle".Translate(), "BuyAndDropItem_NotifyDesc".Translate(), LetterDefOf.PositiveEvent, toTrade); } tradeItem.Item = null; map.resourceCounter.UpdateResourceCounts(); return(true); }
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); } }
public static bool Prefix( TransportPodsArrivalAction_LandInSpecificCell __instance, List <ActiveDropPodInfo> pods, int tile) { foreach (ActiveDropPodInfo pod in pods) { for (int index = 0; index < pod.innerContainer.Count; index++) { if (pod.innerContainer[index].TryGetComp <CompLaunchableSRTS>() != null) { Thing lookTarget = TransportPodsArrivalActionUtility.GetLookTarget(pods); Traverse traverse = Traverse.Create((object)__instance); IntVec3 c = traverse.Field("cell").GetValue <IntVec3>(); Map map = traverse.Field("mapParent").GetValue <MapParent>().Map; TransportPodsArrivalActionUtility.RemovePawnsFromWorldPawns(pods); for (int i = 0; i < pods.Count; ++i) { pods[i].openDelay = 0; DropPodUtility.MakeDropPodAt(c, map, pods[i]); } Messages.Message("MessageTransportPodsArrived".Translate(), (LookTargets)lookTarget, MessageTypeDefOf.TaskCompletion, true); return(false); } } } return(true); }
private void DropThingGroupsAt(IntVec3 dropCenter, Map map, List <List <Thing> > thingsGroups, int openDelay = 110, bool instaDrop = false, bool leaveSlag = false, bool forbid = true, bool allowFogged = true) { foreach (List <Thing> thingsGroup in thingsGroups) { if (forbid) { for (int index = 0; index < thingsGroup.Count; ++index) { thingsGroup[index].SetForbidden(true, false); } } if (instaDrop) { foreach (Thing thing in thingsGroup) { GenPlace.TryPlaceThing(thing, dropCenter, map, ThingPlaceMode.Near); } } else { ActiveDropPodInfo info = new ActiveDropPodInfo(); foreach (Thing thing in thingsGroup) { info.innerContainer.TryAdd(thing); } info.openDelay = openDelay; info.leaveSlag = leaveSlag; DropPodUtility.MakeDropPodAt(dropCenter, map, info); } } }
private void SendDrop() { GenDate.DayOfYear(ticks, Find.WorldGrid.LongLatOf(map.Tile).x); List <Thing> thingList = new List <Thing>(); thingList.Add(ThingMaker.MakeThing(AvaliDefs.AvaliNexus)); Scribe_Values.Look(ref hasDropped, "hasDropped", false); Map target = map; List <Faction> newFactions = new List <Faction>(); IntVec3 intVec3 = DropCellFinder.TradeDropSpot(target); if (RimValiUtility.PawnOfRaceCount(Faction.OfPlayer, AvaliDefs.RimVali) >= 5 && !hasDropped) { hasDropped = true; for (int a = 0; a < random.Next(2, 5); a++) { Faction faction = FactionGenerator.NewGeneratedFaction(AvaliDefs.AvaliFaction); faction.Name = "IlluminateFactionName".Translate() + ": #" + a.ToString(); faction.SetRelationDirect(Faction.OfPlayer, FactionRelationKind.Ally); newFactions.Add(faction); } DropPodUtility.DropThingsNear(intVec3, target, (IEnumerable <Thing>)thingList); ChoiceLetter choiceLetter = LetterMaker.MakeLetter("IlluminateAirdrop".Translate(), "AirdropEventDesc".Translate(), AvaliMod.AvaliDefs.IlluminateAirdrop, newFactions[random.Next(newFactions.Count)]); Find.LetterStack.ReceiveLetter(choiceLetter, null); } }
private void SendCapsules(List <Thing> toDrop) { Map map = Find.AnyPlayerHomeMap; IntVec3 intVec = DropCellFinder.TradeDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, toDrop, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: false); }
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); } }
private void Payment(List <Thing> payment, bool vassalPay, bool TributePay, string factionList) { if (GenLocalDate.Year(Find.AnyPlayerHomeMap) >= year) { year = GenLocalDate.Year(Find.AnyPlayerHomeMap) + 1; } if (GenLocalDate.DayOfYear(Find.AnyPlayerHomeMap) >= dayOfMonth) { dayOfMonth = ClosestNumberOf15(GenLocalDate.DayOfYear(Find.AnyPlayerHomeMap) + 1); } if (!payment.NullOrEmpty()) { string text = ""; if (vassalPay && TributePay) { text += "FactionVassalSilverRecivedBoth".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } else if (vassalPay) { text += "FactionVassalSilverRecivedVassals".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } else if (TributePay) { text += "FactionVassalSilverRecivedTrivutaries".Translate(GenThing.GetMarketValue(payment).ToStringMoney(), GenLabel.ThingsLabel(payment, string.Empty)); } factionList.Remove(factionList.Count() - 1); DropPodUtility.DropThingsNear(DropCellFinder.TradeDropSpot(Find.AnyPlayerHomeMap), Find.AnyPlayerHomeMap, payment, 110, false, true, true); Find.LetterStack.ReceiveLetter("LetterFactionVassalSilverRecived".Translate(), text + factionList, LetterDefOf.PositiveEvent, null); } }
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); }
public override bool TryExecuteWorker(IncidentParms parms) { Map map = (Map)parms.target; List <TargetInfo> list = new List <TargetInfo>(); ThingDef shipPartDef = def.mechClusterBuilding; IntVec3 intVec = FindDropPodLocation(map, (IntVec3 spot) => CanPlaceAt(spot)); if (intVec == IntVec3.Invalid) { return(false); } float points = Mathf.Max(parms.points * 0.9f, 300f); Thing thing = ThingMaker.MakeThing(shipPartDef); Building building_CrashedShipPart = (Building)thing; CompPawnSpawnerOnDamaged damaged = building_CrashedShipPart.TryGetCompFast <CompPawnSpawnerOnDamaged>(); thing.SetFaction(faction, null); List <Pawn> list2 = PawnGroupMakerUtility.GeneratePawns(new PawnGroupMakerParms { groupKind = PawnGroupKindDefOf.Combat, tile = map.Tile, faction = faction, points = points }).ToList(); LordMaker.MakeNewLord(faction, new LordJob_SleepThenMechanoidsDefend(new List <Thing> { thing }, faction, 28f, intVec, canAssaultColony: false, isMechCluster: false), map, list2); DropPodUtility.DropThingsNear(intVec, map, list2.Cast <Thing>()); foreach (Pawn item in list2) { item.TryGetCompFast <CompCanBeDormant>()?.ToSleep(); } list.AddRange(list2.Select((Pawn p) => new TargetInfo(p))); GenSpawn.Spawn(SkyfallerMaker.MakeSkyfaller(ThingDefOf.CrashedShipPartIncoming, thing), intVec, map); list.Add(new TargetInfo(intVec, map)); SendStandardLetter(parms, list); return(true); bool CanPlaceAt(IntVec3 loc) { CellRect cellRect = GenAdj.OccupiedRect(loc, Rot4.North, shipPartDef.Size); if (loc.Fogged(map) || !cellRect.InBounds(map)) { return(false); } foreach (IntVec3 item2 in cellRect) { RoofDef roof = item2.GetRoof(map); if (roof != null && roof.isNatural) { return(false); } } return(GenConstruct.CanBuildOnTerrain(shipPartDef, loc, map, Rot4.North)); } }
private void CreatePod() { ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.openDelay = 10; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(base.Position, base.Map, activeDropPodInfo, true); }
public override void OnResult(Quest quest) { var map = quest.HomeMap; var pos = QuestUtility.FindDropSpot(map); DropPodUtility.DropThingsNear(pos, map, things, canRoofPunch: false); Messages.Message("QuestReceived".Translate().Formatted(Label), new LookTargets(pos, map), MessageTypeDefOf.PositiveEvent); }
private void GiveRewardsAndSendLetter(bool giveTech, bool newFaction) { string text = "RD_GratefulSurvivors".Translate(); string text2 = "RD_GratefulSurvivorsDesc".Translate(); //"The survivors of the crash are very thankful for your help, and have send some supplies as a gesture of gratitude."; if (giveTech) { ThingDef.Named("Gun_ChargeRifle"); ThingDef thingDef = this.RandomHiTechReward(); ThingDef stuff = null; if (thingDef.MadeFromStuff) { stuff = GenStuff.DefaultStuffFor(thingDef); } this.rewards.TryAdd(ThingMaker.MakeThing(thingDef, stuff), true); text2 = "RD_GratefulSurvivorsAmazedDesc".Translate(); //"The survivors of the crash are amazed by your rapid and professional emergency medical response, thanks to which no-one died. In gratitude, they have included a special system removed form the wreck."; } Find.LetterStack.ReceiveLetter(text, text2, LetterDefOf.PositiveEvent, null); Map map = Find.AnyPlayerHomeMap ?? ((MapParent)this.parent).Map; QuestComp_MedicalEmergency.tmpRewards.AddRange(this.rewards); this.rewards.Clear(); IntVec3 dropCenter = DropCellFinder.TradeDropSpot(map); DropPodUtility.DropThingsNear(dropCenter, map, QuestComp_MedicalEmergency.tmpRewards, 110, false, false, true); QuestComp_MedicalEmergency.tmpRewards.Clear(); if (newFaction) { int tile = this.parent.Tile; this.CloseMapImmediate(); Faction faction = FactionGenerator.NewGeneratedFaction(FactionDefOf.Ancients); map.pawnDestinationReservationManager.GetPawnDestinationSetFor(faction); Find.FactionManager.Add(faction); Settlement settlement = (Settlement)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.Settlement); settlement.SetFaction(faction); settlement.Tile = tile; settlement.Name = SettlementNameGenerator.GenerateSettlementName(settlement, null); Find.WorldObjects.Add(settlement); faction.leader = null; foreach (Pawn pawn in this.injured) { if (!pawn.Dead && pawn.Faction != Faction.OfPlayer) { pawn.SetFactionDirect(faction); if (faction.leader == null) { faction.leader = pawn; } } } faction.TryAffectGoodwillWith(Faction.OfPlayer, 100); string text3 = "RD_NewFaction".Translate(); //New Faction! string text4 = "RD_NewFactionDesc".Translate() + faction.Name; //"The survivors of the crash have decided to make a life for themselves here, and have founded a new faction" Find.LetterStack.ReceiveLetter(text3, text4, LetterDefOf.PositiveEvent, null); } }
public static void DropTravelingTransportPods(List <ActiveDropPodInfo> dropPods, IntVec3 near, Map map) { RemovePawnsFromWorldPawns(dropPods); for (int i = 0; i < dropPods.Count; i++) { DropCellFinder.TryFindDropSpotNear(near, map, out IntVec3 result, allowFogged: false, canRoofPunch: true); DropPodUtility.MakeDropPodAt(result, map, dropPods[i]); } }
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); }
private void CapsuleDelivery() { Map map = Find.AnyPlayerHomeMap; IntVec3 intVec = DropCellFinder.TradeDropSpot(map); DropPodUtility.DropThingsNear(intVec, map, Items, 110, canInstaDropDuringInit: false, leaveSlag: false, canRoofPunch: false); Find.LetterStack.ReceiveLetter("DeliveryItems_Title".Translate(), "DeliveryItems_Desc".Translate(), LetterDefOf.PositiveEvent, new LookTargets(intVec, map)); }
public static void DropTravelingTransportPods(List <ActiveDropPodInfo> dropPods, IntVec3 near, Map map) { ByakheeArrivalActionUtility.RemovePawnsFromWorldPawns(dropPods); for (int i = 0; i < dropPods.Count; i++) { IntVec3 c; DropCellFinder.TryFindDropSpotNear(near, map, out c, false, true, true, null, true); DropPodUtility.MakeDropPodAt(c, map, dropPods[i]); } }
private void CreatePod() { ActiveDropPodInfo info = new ActiveDropPodInfo { openDelay = 10, leaveSlag = true }; DropPodUtility.MakeDropPodAt(base.Position, base.Map, info); }
private void DropSupplies(ThingDef thingDef, int count, IntVec3 cell) { List <Thing> list = new List <Thing>(); Thing thing = ThingMaker.MakeThing(thingDef, null); thing.stackCount = count; list.Add(thing); //If turrets are near-empty or empty, call in ammo droppod DropPodUtility.DropThingsNear(cell, parent.Map, list, 110, false, false, true, true); }