public Tale_DoublePawnKilledBy(Pawn victim, DamageInfo dinfo) : base(victim, null) { if (dinfo.Instigator != null && dinfo.Instigator is Pawn) { this.secondPawnData = TaleData_Pawn.GenerateFrom((Pawn)dinfo.Instigator); } }
public static TaleData_Pawn GenerateFrom(Pawn pawn) { TaleData_Pawn taleData_Pawn = new TaleData_Pawn(); taleData_Pawn.pawn = pawn; taleData_Pawn.kind = pawn.kindDef; taleData_Pawn.faction = pawn.Faction; taleData_Pawn.gender = (pawn.RaceProps.hasGenders ? pawn.gender : Gender.None); if (pawn.story != null) { taleData_Pawn.title = pawn.story.title; } if (pawn.RaceProps.Humanlike) { taleData_Pawn.name = pawn.Name; if (pawn.equipment.Primary != null) { taleData_Pawn.primaryEquipment = pawn.equipment.Primary.def; } if (pawn.apparel.WornApparel.TryRandomElement(out Apparel result)) { taleData_Pawn.notableApparel = result.def; } } return(taleData_Pawn); }
public Tale_SinglePawn(Pawn pawn) { pawnData = TaleData_Pawn.GenerateFrom(pawn); if (pawn.SpawnedOrAnyParentSpawned) { surroundings = TaleData_Surroundings.GenerateFrom(pawn.PositionHeld, pawn.MapHeld); } }
public static TaleData_Pawn GenerateRandom() { PawnKindDef random = DefDatabase <PawnKindDef> .GetRandom(); Faction faction = FactionUtility.DefaultFactionFrom(random.defaultFactionType); Pawn pawn = PawnGenerator.GeneratePawn(random, faction); return(TaleData_Pawn.GenerateFrom(pawn)); }
public Tale_DoublePawn(Pawn firstPawn, Pawn secondPawn) { firstPawnData = TaleData_Pawn.GenerateFrom(firstPawn); if (secondPawn != null) { secondPawnData = TaleData_Pawn.GenerateFrom(secondPawn); } if (firstPawn.SpawnedOrAnyParentSpawned) { surroundings = TaleData_Surroundings.GenerateFrom(firstPawn.PositionHeld, firstPawn.MapHeld); } }
public static TaleData_Pawn GenerateFrom(Pawn pawn) { TaleData_Pawn taleData_Pawn = new TaleData_Pawn(); taleData_Pawn.pawn = pawn; taleData_Pawn.kind = pawn.kindDef; taleData_Pawn.faction = pawn.Faction; taleData_Pawn.gender = (pawn.RaceProps.hasGenders ? pawn.gender : Gender.None); taleData_Pawn.age = pawn.ageTracker.AgeBiologicalYears; taleData_Pawn.chronologicalAge = pawn.ageTracker.AgeChronologicalYears; taleData_Pawn.everBeenColonistOrTameAnimal = PawnUtility.EverBeenColonistOrTameAnimal(pawn); taleData_Pawn.everBeenQuestLodger = PawnUtility.EverBeenQuestLodger(pawn); taleData_Pawn.isFactionLeader = (pawn.Faction != null && pawn.Faction.leader == pawn); if (pawn.royalty != null) { taleData_Pawn.royalTitles = new List <RoyalTitle>(); foreach (RoyalTitle item in pawn.royalty.AllTitlesForReading) { taleData_Pawn.royalTitles.Add(new RoyalTitle(item)); } } TaggedString text = ""; PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn); taleData_Pawn.relationInfo = text.Resolve(); if (pawn.story != null) { taleData_Pawn.title = pawn.story.title; } if (pawn.RaceProps.Humanlike) { taleData_Pawn.name = pawn.Name; if (pawn.equipment.Primary != null) { taleData_Pawn.primaryEquipment = pawn.equipment.Primary.def; } if (pawn.apparel.WornApparel.TryRandomElement(out Apparel result)) { taleData_Pawn.notableApparel = result.def; } } return(taleData_Pawn); }
public static TaleData_Pawn GenerateFrom(Pawn pawn) { TaleData_Pawn taleData_Pawn = new TaleData_Pawn(); taleData_Pawn.pawn = pawn; taleData_Pawn.kind = pawn.kindDef; taleData_Pawn.faction = pawn.Faction; taleData_Pawn.gender = ((!pawn.RaceProps.hasGenders) ? Gender.None : pawn.gender); if (pawn.RaceProps.Humanlike) { taleData_Pawn.name = pawn.Name; if (pawn.equipment.Primary != null) { taleData_Pawn.primaryEquipment = pawn.equipment.Primary.def; } Apparel apparel; if (pawn.apparel.WornApparel.TryRandomElement(out apparel)) { taleData_Pawn.notableApparel = apparel.def; } } return(taleData_Pawn); }
public override void GenerateTestData() { base.GenerateTestData(); firstPawnData = TaleData_Pawn.GenerateRandom(); secondPawnData = TaleData_Pawn.GenerateRandom(); }
public override void GenerateTestData() { base.GenerateTestData(); pawnData = TaleData_Pawn.GenerateRandom(); }