Example #1
0
 // ===================== Other functions =====================
 public void Notify_BecameHostileToColony()
 {
     if (this.healingPawns.Count > 0)
     {
         string        letterText            = "";
         StringBuilder pawnKeptAsGuestString = new StringBuilder();
         if (this.healingPawns.Count == 1)
         {
             string hisHerIts = GenderUtility.GetPossessive(this.healingPawns.First().pawn.gender);
             string himHerIt  = GenderUtility.GetObjective(this.healingPawns.First().pawn.gender);
             letterText = "-- Comlink with MiningCo. --\n\n"
                          + "\"A friend of yours is being healed in our medibay. I think we will keep " + himHerIt + " aboard as... \"guest\" for " + hisHerIts + " own safety.\n"
                          + "It is really dangerous down there, you know, and there are lot of menial - ehr, I mean \"interresting\" - tasks to do aboard an orbital station to keep " + himHerIt + " occupied.\n\n"
                          + "MiningCo. medibay officer out.\"\n\n"
                          + "-- End of transmission --\n\n"
                          + "The following colonist is kept as \"guest\" aboard the orbital station until you pay a compensation: " + this.healingPawns.First().pawn.Name.ToStringShort + ".";
         }
         else
         {
             letterText = "-- Comlink with MiningCo. --\n\n"
                          + "\"Some friends of yours are being healed in our medibay. I think we will keep them aboard as... \"guests\" for their own safety.\n"
                          + "It is really dangerous down there, you know, and there are lot of menial - ehr, I mean \"interresting\" - tasks to do aboard an orbital station to keep them occupied.\n\n"
                          + "MiningCo. medibay officer out.\"\n\n"
                          + "-- End of transmission --\n\n"
                          + "The following colonists are kept as \"guests\" aboard the orbital station until you pay a compensation: ";
             for (int pawnIndex = 0; pawnIndex < this.healingPawns.Count; pawnIndex++)
             {
                 pawnKeptAsGuestString.AppendWithComma(this.healingPawns[pawnIndex].pawn.Name.ToStringShort);
             }
             pawnKeptAsGuestString.Append(".");
             letterText += pawnKeptAsGuestString.ToString();
         }
         Find.LetterStack.ReceiveLetter("Orbital \"guests\"", letterText, LetterDefOf.NeutralEvent);
     }
 }
Example #2
0
        public bool SendPawnBackToMap(Pawn pawn, Map map)
        {
            IntVec3 dropSpot        = IntVec3.Invalid;
            bool    dropSpotIsValid = false;

            // Check orbital relay is powered on.
            Building_OrbitalRelay orbitalRelay = Util_OrbitalRelay.GetOrbitalRelay(map);

            if (orbitalRelay == null)
            {
                return(false);
            }
            if (orbitalRelay.powerComp.PowerOn == false)
            {
                return(false);
            }
            // Look for an available landing pad.
            Building_LandingPad landingPad = Util_LandingPad.GetBestAvailableLandingPad(map);

            if (landingPad == null)
            {
                return(false);
            }
            // Get a nearby drop spot.
            dropSpotIsValid = DropCellFinder.TryFindDropSpotNear(landingPad.Position, map, out dropSpot, false, false);

            if (dropSpot.IsValid)
            {
                string hisHerIts = GenderUtility.GetPossessive(pawn.gender);
                string heSheIt   = GenderUtility.GetPronoun(pawn.gender);
                string himHerIt  = GenderUtility.GetObjective(pawn.gender);

                // Restore needs level.
                pawn.needs.food.ForceSetLevel(Rand.Range(0.75f, 1f));
                pawn.needs.rest.ForceSetLevel(Rand.Range(0.75f, 1f));
                pawn.needs.joy.ForceSetLevel(Rand.Range(0.5f, 0.8f));
                pawn.needs.comfort.ForceSetLevel(Rand.Range(0.6f, 0.9f));
                pawn.needs.space.ForceSetLevel(Rand.Range(0.1f, 0.3f)); // Drop-pod is very small.

                ActiveDropPodInfo dropPodInfo = new ActiveDropPodInfo();
                bool healingSuccessful        = (Rand.Value < 0.98f);
                if (healingSuccessful)
                {
                    string orbitalHealingFailedText = "-- Comlink with MiningCo. --\n\n"
                                                      + "\"Healing of " + pawn.NameStringShort + " is now finished. Everything went fine during the treatment.\n"
                                                      + "We just launched " + hisHerIts + " drop pod toward your colony.\n\n"
                                                      + "I hope you are satisfied of our services.\n\n"
                                                      + "MiningCo. medibay officer out.\"\n\n"
                                                      + "-- End of transmission --";
                    Find.LetterStack.ReceiveLetter("Orbital healing finished", orbitalHealingFailedText, LetterDefOf.PositiveEvent, new TargetInfo(dropSpot, map));
                }
                else
                {
                    // Dying pawn with heart attack.
                    string orbitalHealingSuccessfulText = "-- Comlink with MiningCo. --\n\n"
                                                          + "\"Though we did our best to heal " + pawn.NameStringShort + ", it seems " + hisHerIts + " metabolism was disturbed by the last injection.\n\n"
                                                          + "I am affraid that we need to immediately send " + himHerIt + " back to you as our rules strictly forbid civilian bodies storage.\n\n"
                                                          + "Please accept those silvers as a compensation.\n\n"
                                                          + "MiningCo. medibay officer out.\"\n\n"
                                                          + "-- End of transmission --";
                    Find.LetterStack.ReceiveLetter("Orbital healing interrupted", orbitalHealingSuccessfulText, LetterDefOf.NegativeEvent, new TargetInfo(dropSpot, map));
                    pawn.health.AddHediff(HediffDef.Named("HeartAttack"));
                    pawn.health.AddHediff(HediffDefOf.Anesthetic);
                    Thing compensation = ThingMaker.MakeThing(ThingDefOf.Silver);
                    compensation.stackCount = Mathf.RoundToInt(0.5f * Util_Spaceship.orbitalHealingCost);
                    dropPodInfo.innerContainer.TryAdd(compensation);
                }
                dropPodInfo.innerContainer.TryAdd(pawn);
                dropPodInfo.leaveSlag = true;
                DropPodUtility.MakeDropPodAt(dropSpot, map, dropPodInfo);
                return(true);
            }
            return(false);
        }