public static void ApplyTaleDef(string defName, Map map) { var randomPawn = map.mapPawns.FreeColonists.RandomElement(); var taleToAdd = TaleDef.Named(defName); TaleRecorder.RecordTale(taleToAdd, randomPawn); }
private void ShipOpen() { // loop over all contents for (int i = 0; i < this.info.containedThings.Count; i++) { // Setup a new thing Thing thing = this.info.containedThings[i]; // Place thing in world GenPlace.TryPlaceThing(thing, GenAdj.RandomAdjacentCell8Way(this.Position), ThingPlaceMode.Near); // If its a pawn Pawn pawn = thing as Pawn; // if its a humanlike pawn if (pawn != null && pawn.RaceProps.Humanlike) { // Record a tale TaleRecorder.RecordTale(TaleDef.Named("LandedInPod"), new object[] { pawn }); } } // All contents dealt with, clear list this.info.containedThings.Clear(); // Play open sound DropPodCrashed.OpenSound.PlayOneShot(base.Position); }
private void PodOpen() { for (int i = 0; i < this.info.containedThings.Count; i++) { Thing thing = this.info.containedThings[i]; GenPlace.TryPlaceThing(thing, base.Position, ThingPlaceMode.Near); Pawn pawn = thing as Pawn; if (pawn != null && pawn.RaceProps.Humanlike) { TaleRecorder.RecordTale(TaleDef.Named("LandedInPod"), new object[] { pawn }); } } this.info.containedThings.Clear(); if (this.info.leaveSlag) { for (int j = 0; j < 1; j++) { Thing thing2 = ThingMaker.MakeThing(ThingDefOf.ChunkSlagSteel, null); GenPlace.TryPlaceThing(thing2, base.Position, ThingPlaceMode.Near); } } SoundDef.Named("DropPodOpen").PlayOneShot(base.Position); }
public static void ApplyTaleDef(string defName, Pawn pawn) { var taleToAdd = TaleDef.Named(defName); if ((pawn.IsColonist || pawn.IsSlaveOfColony || pawn.HostFaction == Faction.OfPlayer) && taleToAdd != null) { TaleRecorder.RecordTale(taleToAdd, pawn); } }
public static void ApplyTaleDef(string defName, Map map) { Pawn randomPawn = map.mapPawns.FreeColonists.RandomElement <Pawn>(); TaleDef taleToAdd = TaleDef.Named(defName); TaleRecorder.RecordTale(taleToAdd, new object[] { randomPawn, }); }
public static void ApplyTaleDef(string defName, Pawn pawn) { TaleDef taleToAdd = TaleDef.Named(defName); if ((pawn.IsColonist || pawn.HostFaction == Faction.OfPlayer) && taleToAdd != null) { TaleRecorder.RecordTale(taleToAdd, new object[] { pawn, }); } }
public override void SpawnSetup() { base.SpawnSetup(); var thingDef = (ThingSpawnPawnDef)def; var newPawn = (PawnConverted)PawnGenerator.GeneratePawn(thingDef.spawnPawnDef, Faction.OfColony); IntVec3 pos = CellFinder.RandomClosewalkCellNear(Position, 2); newPawn.workTypes = thingDef.workTypes; GenSpawn.Spawn(newPawn, pos); TaleRecorder.RecordTale(TaleDef.Named("CreatedMechanoid"), new object[] { newPawn }); Destroy(); }
private static void RecruitingSuccess(Pawn guest) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDef.Named("RecruitGuest"), KnowledgeAmount.Total); Find.LetterStack.ReceiveLetter(labelRecruitSuccess, String.Format(txtRecruitSuccess, guest), LetterType.Good, guest); if (guest.Faction != Faction.OfPlayer) { if (guest.Faction != null) { guest.Faction.AffectGoodwillWith(Faction.OfPlayer, -guest.RecruitPenalty()); if (guest.RecruitPenalty() >= 1) { //Log.Message("txtRecruitFactionAnger"); string message; if (guest.Faction.leader != null) { message = String.Format(txtRecruitFactionAnger, guest.Faction.leader.Name, guest.Faction.Name, guest.NameStringShort, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefAnger, message, LetterType.BadNonUrgent); } else { message = String.Format(txtRecruitFactionAngerLeaderless, guest.Faction.Name, guest.NameStringShort, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionAnger, message, LetterType.BadNonUrgent); } } else if (guest.RecruitPenalty() <= -1) { //Log.Message("txtRecruitFactionPlease"); string message; if (guest.Faction.leader != null) { message = String.Format(txtRecruitFactionPlease, guest.Faction.leader.Name, guest.Faction.Name, guest.NameStringShort, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefPlease, message, LetterType.Good); } else { message = String.Format(txtRecruitFactionPleaseLeaderless, guest.Faction.Name, guest.NameStringShort, (-guest.RecruitPenalty()).ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionPlease, message, LetterType.Good); } } } guest.Adopt(); } var taleParams = new object[] { guest.MapHeld.mapPawns.FreeColonistsSpawned.RandomElement(), guest }; TaleRecorder.RecordTale(TaleDef.Named("Recruited"), taleParams); }
public void StartPlaying(Pawn musician, Thing instrument, Thing venue, bool isWork) { var venueHash = venue.GetHashCode(); foreach (var otherVenueHash in Performances.Keys) { if (!RadiusAndRoomCheck(Performances[otherVenueHash].Venue, venue)) { continue; } venueHash = otherVenueHash; break; } if (!Performances.ContainsKey(venueHash)) { Performances[venueHash] = new Performance(venue); } var musicianHash = musician.GetHashCode(); if (Performances[venueHash].Performers.ContainsKey(musicianHash)) { return; } Performances[venueHash].Performers[musicianHash] = new Performer { Musician = musician, Instrument = instrument }; Performances[venueHash].CalculateQuality(); if (Performances[venueHash].Quality >= 2f) { TaleRecorder.RecordTale(TaleDef.Named("PlayedMusic"), musician, instrument.def); } if (isWork) { WorkPerformanceTimestamps[musician.GetHashCode()] = Find.TickManager.TicksGame; } #if DEBUG Verse.Log.Message(string.Format("Musicians: {0}", string.Join(", ", Performances[venueHash].Performers.Select(x => LogMusician(x.Value.Musician, x.Value.Instrument)).ToArray()))); Verse.Log.Message(string.Format("Quality: {0}", Performances[venueHash].Quality)); #endif }
private static void RecruitingSuccess(Pawn guest, int recruitPenalty) { if (guest.Faction != Faction.OfPlayer) { if (guest.Faction != null) { guest.Faction.TryAffectGoodwillWith(Faction.OfPlayer, -recruitPenalty, false, true, null, guest); if (recruitPenalty >= 1) { // TODO: Use Translate instead of Format string message; if (guest.Faction.leader != null) { message = Format(txtRecruitFactionAnger, guest.Faction.leader.Name, guest.Faction.Name, guest.Name.ToStringShort, GenText.ToStringByStyle(-recruitPenalty, ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefAnger, message, LetterDefOf.NegativeEvent, GlobalTargetInfo.Invalid, guest.Faction); } else { message = Format(txtRecruitFactionAngerLeaderless, guest.Faction.Name, guest.Name.ToStringShort, GenText.ToStringByStyle(-recruitPenalty, ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionAnger, message, LetterDefOf.NegativeEvent, GlobalTargetInfo.Invalid, guest.Faction); } } else if (recruitPenalty <= -1) { // TODO: Use Translate instead of Format string message; if (guest.Faction.leader != null) { message = Format(txtRecruitFactionPlease, guest.Faction.leader.Name, guest.Faction.Name, guest.Name.ToStringShort, GenText.ToStringByStyle(-recruitPenalty, ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionChiefPlease, message, LetterDefOf.PositiveEvent, GlobalTargetInfo.Invalid, guest.Faction); } else { message = Format(txtRecruitFactionPleaseLeaderless, guest.Faction.Name, guest.Name.ToStringShort, GenText.ToStringByStyle(-recruitPenalty, ToStringStyle.Integer, ToStringNumberSense.Offset)); Find.LetterStack.ReceiveLetter(labelRecruitFactionPlease, message, LetterDefOf.PositiveEvent, GlobalTargetInfo.Invalid, guest.Faction); } } } guest.Adopt(); } var taleParams = new object[] { guest.MapHeld.mapPawns.FreeColonistsSpawned.RandomElement(), guest }; TaleRecorder.RecordTale(TaleDef.Named("Recruited"), taleParams); }
public void InitializeCult(Pawn newFounder) { Map map = newFounder.Map; founder = newFounder; leader = newFounder; foundingFaction = newFounder.Faction; foundingCity = Find.WorldObjects.SettlementAt(newFounder.Map.Tile); influences = new List <CultInfluence>(); foreach (Settlement set in Find.WorldObjects.Settlements) { if (set == foundingCity) { influences.Add(new CultInfluence(set, 1.0f)); } else { influences.Add(new CultInfluence(set, 0.0f)); } } active = true; Find.World.GetComponent <WorldComponent_GlobalCultTracker>().worldCults.Add(this); if (foundingFaction == Faction.OfPlayerSilentFail) { SendCultLetterFounded(newFounder); //It's a day to remember TaleDef taleToAdd = TaleDef.Named("FoundedCult"); if ((newFounder.IsColonist || newFounder.HostFaction == Faction.OfPlayer) && taleToAdd != null) { TaleRecorder.RecordTale(taleToAdd, new object[] { newFounder, }); } //The founder will remember that, too. newFounder.needs.mood.thoughts.memories.TryGainMemory(CultsDefOf.Cults_FoundedCult); map.GetComponent <MapComponent_LocalCultTracker>().ResolveTerribleCultFounder(newFounder); } }
protected override IEnumerable <Toil> MakeNewToils() { //Commence fail checks! this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedOrNull(TargetIndex.B); this.FailOnAggroMentalState(TargetIndex.A); yield return(Toils_Reserve.Reserve(TakeeIndex)); yield return(Toils_Reserve.Reserve(AltarIndex, Building_SacrificialAltar.LyingSlotsCount)); yield return(new Toil { initAction = delegate { DropAltar.ChangeState(Building_SacrificialAltar.State.sacrificing, Building_SacrificialAltar.SacrificeState.gathering); } }); //Toil 1: Go to prisoner. yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch) .FailOnDespawnedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B) .FailOn(() => job.def == JobDefOf.Arrest && !Takee.CanBeArrestedBy(pawn)) .FailOn(() => !pawn.CanReach(DropAltar, PathEndMode.OnCell, Danger.Deadly)) .FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(new Toil { initAction = delegate { if (!job.def.makeTargetPrisoner) { return; } var targetAThing = (Pawn)job.targetA.Thing; var lord = targetAThing.GetLord(); lord?.Notify_PawnAttemptArrested(targetAThing); GenClamor.DoClamor(targetAThing, 10f, ClamorDefOf.Harm); if (job.def == JobDefOf.Arrest && !targetAThing.CheckAcceptArrest(pawn)) { pawn.jobs.EndCurrentJob(JobCondition.Incompletable); } } }); //Toil 2: Carry prisoner. yield return(Toils_Haul.StartCarryThing(TargetIndex.A)); //Toil 3: Go to the altar. yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.InteractionCell)); //Toil 4: Release the prisoner. yield return(Toils_Reserve.Release(TargetIndex.B)); //Toil 5: Restrain the prisoner. yield return(new Toil { initAction = delegate { //In-case this fails... var position = DropAltar.Position; pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out _); if (DropAltar.Destroyed || !DropAltar.AnyUnoccupiedLyingSlot) { return; } Takee.Position = DropAltar.GetLyingSlotPos(); Takee.Notify_Teleported(false); Takee.stances.CancelBusyStanceHard(); var newJob = new Job(CultsDefOf.Cults_WaitTiedDown, DropAltar); Takee.jobs.StartJob(newJob); }, defaultCompleteMode = ToilCompleteMode.Instant }); //Toil 6: Time to chant ominously var chantingTime = new Toil { defaultCompleteMode = ToilCompleteMode.Delay, defaultDuration = CultUtility.ritualDuration }; chantingTime.WithProgressBarToilDelay(TargetIndex.A); chantingTime.PlaySustainerOrSound(CultsDefOf.RitualChanting); var deitySymbol = ((CosmicEntityDef)DropAltar.SacrificeData.Entity.def).Symbol; chantingTime.initAction = delegate { if (deitySymbol != null) { MoteMaker.MakeInteractionBubble(pawn, null, ThingDefOf.Mote_Speech, deitySymbol); } //STATE - SACRIFICING DropAltar.ChangeState(Building_SacrificialAltar.State.sacrificing, Building_SacrificialAltar.SacrificeState.sacrificing); }; yield return(chantingTime); //Toil 8: Execution of Prisoner yield return(new Toil { initAction = delegate { //BodyPartDamageInfo value = new BodyPartDamageInfo(this.Takee.health.hediffSet.GetBrain(), false, quiet); Takee.TakeDamage(new DamageInfo(DamageDefOf.ExecutionCut, 99999, 0f, -1f, pawn, Utility.GetHeart(Takee.health.hediffSet))); if (!Takee.Dead) { Takee.Kill(null); } //ThoughtUtility.GiveThoughtsForPawnExecuted(this.Takee, PawnExecutionKind.GenericHumane); TaleRecorder.RecordTale(TaleDefOf.ExecutedPrisoner, pawn, Takee); CultUtility.SacrificeExecutionComplete(DropAltar); }, defaultCompleteMode = ToilCompleteMode.Instant }); AddFinishAction(() => { //It's a day to remember var taleToAdd = TaleDef.Named("HeldSermon"); if ((pawn.IsColonist || pawn.IsSlaveOfColony || pawn.HostFaction == Faction.OfPlayer) && taleToAdd != null) { TaleRecorder.RecordTale(taleToAdd, pawn); } //When the ritual is finished -- then let's give the thoughts /* * if (DropAltar.currentSacrificeState == Building_SacrificialAltar.SacrificeState.finished) * { * if (this.pawn == null) return; * if (DropAltar.sacrifice != null) * { * CultUtility.AttendSacrificeTickCheckEnd(this.pawn, DropAltar.sacrifice, true); * } * else * { * CultUtility.AttendSacrificeTickCheckEnd(this.pawn, null); * } * } */ }); }