コード例 #1
0
        protected override void GiveThoughtsToReceipient(Pawn recipient)
        {
            if (!recipient.IsCapableOfThought())
            {
                return;
            }

            if (recipient == PrimaryVictim)
            {
                // I was sold
            }
            else
            {
                // Animal or Prisoner sold
                if (PrimaryVictim.RaceProps.Animal)
                {
                    // Vanilla v1.1, there are new features here
                    Pawn firstDirectRelationPawn = PrimaryVictim.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond);
                    if (firstDirectRelationPawn != null && firstDirectRelationPawn == recipient && firstDirectRelationPawn.needs.mood != null)
                    {
                        PrimaryVictim.relations.RemoveDirectRelation(PawnRelationDefOf.Bond, recipient);
                        firstDirectRelationPawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.SoldMyBondedAnimalMood);
                    }
                }
                else if (PrimaryVictim.RaceProps.Humanlike)
                {
                    // Some prisoner was sold
                    if (PrimaryVictim.IsPrisonerOfColony)
                    {
                        recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowPrisonerSold, Instigator);
                    }
                }

                // Relationship was sold, if there is any
                PawnRelationDef relation = recipient.GetMostImportantRelation(PrimaryVictim);
                if (relation != null)
                {
                    foreach (ThoughtDef soldThought in relation.soldThoughts)
                    {
                        recipient.needs.mood.thoughts.memories.TryGainMemory(soldThought, Instigator);
                    }
                }

                // Remove marriage-related memories, etc.
                Pawn spouse = PrimaryVictim.GetSpouse();
                if (spouse != null && recipient == spouse && !recipient.Dead)
                {
                    MemoryThoughtHandler memories = recipient.needs.mood.thoughts.memories;
                    memories.RemoveMemoriesOfDef(ThoughtDefOf.GotMarried);
                    memories.RemoveMemoriesOfDef(ThoughtDefOf.HoneymoonPhase);
                }
            }
        }
コード例 #2
0
        protected override void GiveThoughtsToReceipient(Pawn recipient)
        {
            if (!recipient.IsCapableOfThought())
            {
                return;
            }

            if (recipient == PrimaryVictim)
            {
                // I was sold
            }
            else
            {
                // Animal or Prisoner sold
                if (PrimaryVictim.RaceProps.Animal)
                {
                    // ADDITIONAL TODO
                }
                else if (PrimaryVictim.RaceProps.Humanlike)
                {
                    // Some prisoner was sold
                    if (PrimaryVictim.IsPrisonerOfColony)
                    {
                        recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.KnowPrisonerSold, Instigator);
                    }
                }

                // Relationship was sold, if there is any
                PawnRelationDef relation = recipient.GetMostImportantRelation(PrimaryVictim);
                if (relation != null)
                {
                    ThoughtDef soldThought = relation.soldThought;
                    if (soldThought != null)
                    {
                        recipient.needs.mood.thoughts.memories.TryGainMemory(soldThought, Instigator);
                    }
                }

                // Remove marriage-related memories, etc.
                Pawn spouse = PrimaryVictim.GetSpouse();
                if (spouse != null && recipient == spouse && !recipient.Dead)
                {
                    MemoryThoughtHandler memories = recipient.needs.mood.thoughts.memories;
                    memories.RemoveMemoriesOfDef(ThoughtDefOf.GotMarried);
                    memories.RemoveMemoriesOfDef(ThoughtDefOf.HoneymoonPhase);
                }
            }
        }